You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(134) |
Sep
(52) |
Oct
(13) |
Nov
(342) |
Dec
(163) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(44) |
Feb
(62) |
Mar
(158) |
Apr
(38) |
May
(70) |
Jun
(58) |
Jul
(104) |
Aug
(207) |
Sep
(83) |
Oct
(122) |
Nov
(23) |
Dec
(49) |
2004 |
Jan
(119) |
Feb
(132) |
Mar
(192) |
Apr
(140) |
May
(77) |
Jun
(74) |
Jul
(201) |
Aug
(63) |
Sep
(102) |
Oct
(70) |
Nov
(173) |
Dec
(78) |
2005 |
Jan
(174) |
Feb
(197) |
Mar
(105) |
Apr
(59) |
May
(77) |
Jun
(43) |
Jul
(21) |
Aug
(18) |
Sep
(47) |
Oct
(37) |
Nov
(74) |
Dec
(50) |
2006 |
Jan
(44) |
Feb
(19) |
Mar
(32) |
Apr
(24) |
May
(31) |
Jun
(55) |
Jul
(138) |
Aug
(28) |
Sep
(12) |
Oct
(41) |
Nov
(58) |
Dec
(24) |
2007 |
Jan
(28) |
Feb
(14) |
Mar
(10) |
Apr
(68) |
May
(30) |
Jun
(26) |
Jul
(18) |
Aug
(63) |
Sep
(19) |
Oct
(29) |
Nov
(20) |
Dec
(10) |
2008 |
Jan
(38) |
Feb
(7) |
Mar
(37) |
Apr
(120) |
May
(41) |
Jun
(36) |
Jul
(39) |
Aug
(24) |
Sep
(28) |
Oct
(30) |
Nov
(36) |
Dec
(75) |
2009 |
Jan
(46) |
Feb
(22) |
Mar
(50) |
Apr
(70) |
May
(134) |
Jun
(105) |
Jul
(75) |
Aug
(34) |
Sep
(38) |
Oct
(34) |
Nov
(19) |
Dec
(20) |
2010 |
Jan
(11) |
Feb
(20) |
Mar
(65) |
Apr
(83) |
May
(104) |
Jun
(73) |
Jul
(78) |
Aug
(57) |
Sep
(43) |
Oct
(35) |
Nov
(9) |
Dec
(4) |
2011 |
Jan
(21) |
Feb
(11) |
Mar
(18) |
Apr
(10) |
May
(18) |
Jun
(15) |
Jul
(48) |
Aug
(25) |
Sep
(17) |
Oct
(45) |
Nov
(15) |
Dec
(12) |
2012 |
Jan
(21) |
Feb
(9) |
Mar
(12) |
Apr
(9) |
May
(9) |
Jun
(5) |
Jul
(1) |
Aug
(10) |
Sep
(12) |
Oct
(1) |
Nov
(28) |
Dec
(5) |
2013 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
2016 |
Jan
(2) |
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory usw-pr-cvs1:/tmp/cvs-serv1539 Modified Files: org_lwjgl_Math_MatrixOpAdd_MatrixOpDirect.cpp org_lwjgl_Math_MatrixOpAdd_MatrixOpSafe.cpp org_lwjgl_Math_MatrixOpCopy_MatrixOpDirect.cpp org_lwjgl_Math_MatrixOpCopy_MatrixOpSafe.cpp org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect.cpp org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe.cpp org_lwjgl_Math_MatrixOpMultiply_MatrixOpDirect.cpp org_lwjgl_Math_MatrixOpMultiply_MatrixOpSafe.cpp org_lwjgl_Math_MatrixOpNegate_MatrixOpDirect.cpp org_lwjgl_Math_MatrixOpNegate_MatrixOpSafe.cpp org_lwjgl_Math_MatrixOpNormalise_MatrixOpDirect.cpp org_lwjgl_Math_MatrixOpNormalise_MatrixOpSafe.cpp org_lwjgl_Math_MatrixOpSubtract_MatrixOpDirect.cpp org_lwjgl_Math_MatrixOpSubtract_MatrixOpSafe.cpp Added Files: MatrixOpCommon.cpp MatrixOpCommon.h Log Message: First draft of ANSIC++ Vector code. Needs to be tested. --- NEW FILE: MatrixOpCommon.cpp --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/MatrixOpCommon.cpp //#include <iostream> #include <jni.h> #include "MatrixOpCommon.h" bool Matrix::identicalDataSpaces(Matrix & other) { if (address != other.address) return JNI_FALSE; if (stride != other.stride) return JNI_FALSE; if ((width * height) != (other.width * other.height)) return JNI_FALSE; return JNI_TRUE; } bool Matrix::intersectingDataSpaces(Matrix & other) { char * my_max_address = &address[ stride * elements ]; char * other_max_address = &other.address[ other.stride * other.elements]; if (address >= other.address || address <= other_max_address) return JNI_TRUE; if (other.address >= address || other.address <= my_max_address) return JNI_TRUE; return JNI_FALSE; } void Matrix::transposeMatrix(float * src, float * dst, int src_width, int src_height) { // square matrix transpose if (src_width == src_height) { for (int i = 0; i < src_width; i++) for (int j = 0; j < src_width; j++) dst[i + src_width * j] = src[j + i * src_width]; } // non square matrix transpose else { for (int i = 0; i < src_width; i ++) for (int j = 0; j < src_height; j++) dst[i + src_height * j] = src[j + i * src_height]; } } void Matrix::transposeMatrix(float * mat, int src_width, int src_height) { float temp; // square matrix transpose if (src_width == src_height) { for (int col = 0; col < src_width; col++) { for (int row = col+1; row < src_height; row++) { // swap the two elements temp = mat [col * src_height + row]; mat[col * src_height + row] = mat[row * src_width + col]; mat[row * src_width + col] = temp; } } } // non square matrix transpose else { transposeMatrix(mat, transpose_record, src_width, src_height); memcpy(mat, transpose_record, src_width * src_height * sizeof(float)); } } SrcMatrix::SrcMatrix ( jint addr, jint s, jint w, jint h, jint e, jboolean t): Matrix(addr, s, e), record_offset((char *) addr), record_size (w*h) { if (t) { width = h; height = w; } else { width = w; height = h; } elements = e; record = new float[width * height]; // vectors do not need to be transposed transpose = (t == JNI_TRUE) && (w != 1) && (h != 1); if (transpose && (width != height)) // only need temp storage for transpose if the matrix is not square transpose_record = new float[width*height]; else transpose_record = 0; if (elements == 1) { // fool the nextRecord function into returning a value elements = 2; nextRecord(); elements = 1; } } SrcMatrix::~SrcMatrix() { //cout << "SrcMatrix destructor \n"; delete [] record; if (transpose_record != 0) delete [] transpose_record; } float * SrcMatrix::nextRecord() { if (elements > 1) { //cout << "Elements: " << elements << "\n"; //cout << "Address: " << (unsigned int) (record_offset) << "\n"; // the record is not properly aligned if ((unsigned int) (record_offset) & FLOAT_ALIGNMENT) { // copy the floats into a buffer so that they are aligned // on 4 byte margins (not necessary on intel, but a good thing) memcpy (record, record_offset, record_size * sizeof(float)); if (transpose) transposeMatrix (record, height, width); record_offset = &record_offset[stride]; current_record_ptr = record; } // the record is aligned but it has to be transposed else if (transpose) { transposeMatrix ((float *) (record_offset), record, height, width); record_offset = &record_offset[stride]; current_record_ptr = record; } // nothing has to be done to the record else { // the floats are aligned in memory current_record_ptr = (float *) record_offset; record_offset = &record_offset[stride]; } } return current_record_ptr; } DstMatrix::DstMatrix (jint addr, jint s, jint w, jint h, jint e, jboolean t): Matrix(addr, s, e) { width = w; height = h; record_size = width * height; record = new float[record_size]; // vectors do not need to be transposed transpose = (t) && (w != 1) && (h != 1); if (transpose) transpose_record = new float[width*height]; else transpose_record = 0; data_buffered = JNI_FALSE; record_buffered = JNI_FALSE; record_offset = address - stride; } DstMatrix::~DstMatrix() { //cout << "DstMatrix destructor \n"; delete [] record; if (transpose_record != 0) delete [] transpose_record; // copy back any buffered data if (data_buffered) { char * src = buffer; char * dest = address; for (int i = 0; i < elements; i++) { memcpy(dest, src, record_size * sizeof(float)); src += stride; dest += stride; } delete [] buffer; } } void DstMatrix::configureBuffer(SrcMatrix & a, SrcMatrix & b) { if (!a.intersectingDataSpaces(b)) { // as long as the output only overlays 1 of the sources, and the other // source only has 1 matrix in it, only a record_buffer is required if (a.elements == 1 && identicalDataSpaces(b)) record_buffered = JNI_TRUE; else if (b.elements == 1 && identicalDataSpaces(a)) record_buffered = JNI_TRUE; else // otherwise all of the output has to be buffered createBuffer(); } else createBuffer(); } void DstMatrix::configureBuffer(SrcMatrix & a) { if (identicalDataSpaces(a)) record_buffered = JNI_TRUE; else if (intersectingDataSpaces(a)) createBuffer(); } void DstMatrix::createBuffer() { data_buffered = JNI_TRUE; buffer = new char[ elements * stride ]; record_offset = buffer - stride; } float * DstMatrix::nextRecord() { record_offset = &record_offset[stride]; if ((((unsigned int)(record_offset)) & FLOAT_ALIGNMENT) || transpose || record_buffered) { last_record_in_temp = JNI_TRUE; return record; } else { last_record_in_temp = JNI_FALSE; return (float *) record_offset; } } void DstMatrix::writeRecord() { if (last_record_in_temp) { // 3 reasons why the record would be in temp // // 1. The record is not aligned // 2. The result will need to be transposed // 3. Direct Mode where result would overlay an operand if (((unsigned int)(record_offset)) & FLOAT_ALIGNMENT) { if (transpose) transposeMatrix(record, width, height); memcpy (record, record_offset, record_size * sizeof(jfloat)); } else if (transpose) { transposeMatrix(record, (float *) record_offset, width, height); } else memcpy (record_offset, record, record_size * sizeof(jfloat)); } } /////////////////////////////////////////////////////////////////////////// void subMatrix (const float * src, int side, float * dst , int col_omit, int row_omit) { int index = 0; for (int c = 0; c < side; c++) { if (c == col_omit) continue; for (int r = 0; r < side; r++) { if (r == row_omit) continue; dst[index++] = src[r + c * side]; } } } float determinant (const float * matrix , int side) { // we are assuming for this case that the data is in column major format float det = 0; if (side == 2) // your basic cross product det = matrix[0] * matrix[3] - matrix[2] * matrix[1]; else { int temp_side = side - 1; float temp_matrix [temp_side * temp_side]; float sign = 1; for (int i = 0; i < side; i++) { // get a sub matrix by eliminating the ith row and the 0th column subMatrix(matrix, side, temp_matrix, 0, i); // add to the determinant sign * [a]i0 * [M]i0 det += sign * matrix[i] * determinant (temp_matrix, temp_side); // alternate the sign sign = (sign == 1) ? -1 : 1; } } return det; } --- NEW FILE: MatrixOpCommon.h --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/MatrixOpCommon.h /* * Matrix.h * * * Created by tristan on Sat Aug 24 2002. * Copyright (c) 2001 __MyCompanyName__. All rights reserved. * */ #define FLOAT_ALIGNMENT 0x00000003 float determinant (const float * matrix , int side); void subMatrix (const float * src, int side, float * dst , int col_omit, int row_omit); /////////////////////////////////////////////////////////////////////////////////////// // Matrix ////////////////////////////////////////////////////////////////////////////////////// class Matrix { protected: float * transpose_record; // to use while transposing the record public: char * address; // the start of the data jint stride; // the distance between each record jint width, // the width of the matrix height, // the height of the matrix elements; // the number of matricies jboolean transpose; // whether this matrix is or will be transposed Matrix (jint a, jint s, jint e): address((char *)a), stride(s), elements(e) {} bool identicalDataSpaces (Matrix & other); bool intersectingDataSpaces(Matrix & other); void transposeMatrix(float * src, float * dst, int src_width, int src_height); void transposeMatrix(float * mat, int src_width, int src_height); }; /////////////////////////////////////////////////////////////////////////////////////// // Src Matrix ////////////////////////////////////////////////////////////////////////////////////// class SrcMatrix: public Matrix { private: char * record_offset; // the offset of this record in memory float * record; // temporary storage to store a fully aligned and transposed // copy of the record, if the one in memory is not so float * current_record_ptr; // the address of the memory containing the record last // returned by the nextRecord() function jint record_size; // the total floats in each record public: SrcMatrix ( jint address, jint stride, jint width, jint height, jint elements, jboolean transpose); void rewind() { record_offset = address; } float * nextRecord(); ~SrcMatrix(); }; /////////////////////////////////////////////////////////////////////////////////////// // Dst Matrix ////////////////////////////////////////////////////////////////////////////////////// class DstMatrix: public Matrix { char * record_offset; // the offset of the record in memory jboolean data_buffered; // if all of the data has to be buffered char * buffer; // a buffer used when data_buffered jboolean last_record_in_temp; jboolean record_buffered; // if only a single record is buffered float * record; // to store data if source is unaligned jint record_size; public: DstMatrix (jint address, jint stride, jint width, jint height, jint elements, jboolean transpose); void configureBuffer(SrcMatrix & a, SrcMatrix & b); void configureBuffer(SrcMatrix & a); void createBuffer(); float * nextRecord(); void writeRecord(); ~DstMatrix(); }; Index: org_lwjgl_Math_MatrixOpAdd_MatrixOpDirect.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpAdd_MatrixOpDirect.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpAdd_MatrixOpDirect.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- org_lwjgl_Math_MatrixOpAdd_MatrixOpDirect.cpp 24 Aug 2002 21:16:53 -0000 1.1 +++ org_lwjgl_Math_MatrixOpAdd_MatrixOpDirect.cpp 28 Aug 2002 16:45:24 -0000 1.2 @@ -1,75 +1,101 @@ -/* - * Copyright (c) 2002 Light Weight Java Game Library Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'Light Weight Java Game Library' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * $Id$ - * - * Win32 math library. - * - * @author cix_foo <ci...@us...> - * @version $Revision$ - */ - -#include <windows.h> -#include "org_lwjgl_Math_MatrixOpAdd_MatrixOpDirect.h" -/* - * Class: org_lwjgl_Math_MatrixOpAdd_MatrixOpDirect - * Method: execute - * Signature: (IIIIIZIIIIIZIIZ)V - */ -JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpAdd_00024MatrixOpDirect_execute - ( - JNIEnv * env, - jobject obj, - jint leftSourceAddress, - jint leftSourceStride, - jint leftElements, - jint leftSourceWidth, - jint leftSourceHeight, - jboolean transposeLeftSource, - jint rightSourceAddress, - jint rightSourceStride, - jint rightElements, - jint rightSourceWidth, - jint rightSourceHeight, - jboolean transposeRightSource, - jint destAddress, - jint destStride, - jboolean transposeDest - ) -{ - float * leftSource = (float *) leftSourceAddress; - float * rightSource = (float *) rightSourceAddress; - float * dest = (float *) destAddress; -} +/* + * Copyright (c) 2002 Light Weight Java Game Library Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'Light Weight Java Game Library' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/** + * $Id$ + * + * Win32 math library. + * + * @author cix_foo <ci...@us...> + * @version $Revision$ + */ + +#include <windows.h> +#include "org_lwjgl_Math_MatrixOpAdd_MatrixOpDirect.h" +#include "MatrixOpCommon.h" +/* + * Class: org_lwjgl_Math_MatrixOpAdd_MatrixOpDirect + * Method: execute + * Signature: (IIIIIZIIIIIZIIZ)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpAdd_00024MatrixOpDirect_execute + ( + JNIEnv * env, + jobject obj, + jint leftSourceAddress, + jint leftSourceStride, + jint leftElements, + jint leftSourceWidth, + jint leftSourceHeight, + jboolean transposeLeftSource, + jint rightSourceAddress, + jint rightSourceStride, + jint rightElements, + jint rightSourceWidth, + jint rightSourceHeight, + jboolean transposeRightSource, + jint destAddress, + jint destStride, + jboolean transposeDest + ) +{ + SrcMatrix left (leftSourceAddress, leftSourceStride, + leftSourceWidth, leftSourceHeight, leftElements, transposeLeftSource); + SrcMatrix right (rightSourceAddress, leftSourceStride, + rightSourceWidth, rightSourceHeight, rightElements, transposeRightSource); + DstMatrix dest (destAddress, destStride, + left.width, left.height, left.elements * right.elements, transposeDest); + + dest.configureBuffer(left, right); + + float * leftRecord, * rightRecord, * destRecord; + + left.rewind(); + for (int i = 0; i < left.elements; i++) + { + leftRecord = left.nextRecord(); + + right.rewind(); + for (int j = 0; j < right.elements; j++) + { + rightRecord = right.nextRecord(); + destRecord = dest.nextRecord(); + + for (int k = (dest.width * dest.height) - 1; k >= 0; k--) + destRecord[k] = leftRecord[k] + rightRecord[k]; + + dest.writeRecord(); + } + } + +} Index: org_lwjgl_Math_MatrixOpAdd_MatrixOpSafe.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpAdd_MatrixOpSafe.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpAdd_MatrixOpSafe.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- org_lwjgl_Math_MatrixOpAdd_MatrixOpSafe.cpp 24 Aug 2002 21:16:53 -0000 1.1 +++ org_lwjgl_Math_MatrixOpAdd_MatrixOpSafe.cpp 28 Aug 2002 16:45:24 -0000 1.2 @@ -41,6 +41,7 @@ #include <windows.h> #include "org_lwjgl_Math_MatrixOpAdd_MatrixOpSafe.h" +#include "MatrixOpCommon.h" /* * Class: org_lwjgl_Math_MatrixOpAdd_MatrixOpSafe * Method: execute @@ -67,9 +68,33 @@ jboolean transposeDest ) { - float * leftSource = (float *) leftSourceAddress; - float * rightSource = (float *) rightSourceAddress; - float * dest = (float *) destAddress; + SrcMatrix left (leftSourceAddress, leftSourceStride, + leftSourceWidth, leftSourceHeight, leftElements, transposeLeftSource); + SrcMatrix right (rightSourceAddress, leftSourceStride, + rightSourceWidth, rightSourceHeight, rightElements, transposeRightSource); + DstMatrix dest (destAddress, destStride, + left.width, left.height, left.elements * right.elements, transposeDest); + + float * leftRecord, * rightRecord, * destRecord; + + left.rewind(); + for (int i = 0; i < leftElements; i++) + { + leftRecord = left.nextRecord(); + right.rewind(); + + for (int j = 0; j < rightElements; j++) + { + rightRecord = right.nextRecord(); + destRecord = dest.nextRecord(); + + for (int k = (leftSourceWidth * rightSourceWidth) - 1; k >= 0; k--) + destRecord[k] = leftRecord[k] + rightRecord[k]; + + dest.writeRecord(); + } + } + } Index: org_lwjgl_Math_MatrixOpCopy_MatrixOpDirect.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpCopy_MatrixOpDirect.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpCopy_MatrixOpDirect.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- org_lwjgl_Math_MatrixOpCopy_MatrixOpDirect.cpp 24 Aug 2002 21:16:53 -0000 1.1 +++ org_lwjgl_Math_MatrixOpCopy_MatrixOpDirect.cpp 28 Aug 2002 16:45:24 -0000 1.2 @@ -41,6 +41,7 @@ #include <windows.h> #include "org_lwjgl_Math_MatrixOpCopy_MatrixOpDirect.h" +#include "MatrixOpCommon.h" /* * Class: org_lwjgl_Math_MatrixOpCopy_MatrixOpDirect * Method: execute @@ -61,8 +62,29 @@ jboolean transposeDest ) { - float * source = (float *) sourceAddress; - float * dest = (float *) destAddress; + if (transposeSource == transposeDest) + { + transposeSource = false; + transposeDest = false; + } + + SrcMatrix source (sourceAddress, sourceStride, sourceWidth, sourceHeight, numElements, transposeSource); + DstMatrix dest (destAddress, destStride, source.width, source.height, source.elements, transposeDest); + + dest.configureBuffer(source); + + float * sourceRecord, * destRecord; + + for (int i = 0; i < source.elements; i++) + { + sourceRecord = source.nextRecord(); + destRecord = dest.nextRecord(); + + // just do a straight memory copy + memcpy(destRecord, sourceRecord, source.width*source.height*sizeof(jfloat)); + dest.writeRecord(); + } } + Index: org_lwjgl_Math_MatrixOpCopy_MatrixOpSafe.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpCopy_MatrixOpSafe.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpCopy_MatrixOpSafe.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- org_lwjgl_Math_MatrixOpCopy_MatrixOpSafe.cpp 24 Aug 2002 21:16:53 -0000 1.1 +++ org_lwjgl_Math_MatrixOpCopy_MatrixOpSafe.cpp 28 Aug 2002 16:45:24 -0000 1.2 @@ -41,6 +41,7 @@ #include <windows.h> #include "org_lwjgl_Math_MatrixOpCopy_MatrixOpSafe.h" +#include "MatrixOpCommon.h" /* * Class: org_lwjgl_Math_MatrixOpCopy_MatrixOpSafe * Method: execute @@ -61,6 +62,25 @@ jboolean transposeDest ) { - float * source = (float *) sourceAddress; - float * dest = (float *) destAddress; + // remove any unnecessary copying + if (transposeSource == transposeDest) + { + transposeSource = false; + transposeDest = false; + } + + SrcMatrix source (sourceAddress, sourceStride, sourceWidth, sourceHeight, numElements, transposeSource); + DstMatrix dest (destAddress, destStride, source.width, source.height, source.elements, transposeDest); + + float * sourceRecord, * destRecord; + + for (int i = 0; i < source.elements; i++) + { + sourceRecord = source.nextRecord(); + destRecord = dest.nextRecord(); + + // just do a straight memory copy + memcpy(destRecord, sourceRecord, source.width * source.height * sizeof(jfloat)); + dest.writeRecord(); + } } Index: org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect.cpp 24 Aug 2002 21:16:53 -0000 1.1 +++ org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect.cpp 28 Aug 2002 16:45:24 -0000 1.2 @@ -41,6 +41,7 @@ #include <windows.h> #include "org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect.h" +#include "MatrixOpCommon.h" /* * Class: org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect * Method: execute @@ -61,6 +62,47 @@ jboolean transposeDest ) { - float * source = (float *) sourceAddress; - float * dest = (float *) destAddress; + // We are under the assumption that sourceWidth == sourceHeight and the matrix + // defined within is invertable + + SrcMatrix source (sourceAddress, sourceStride, + sourceWidth, sourceHeight, numElements, transposeSource); + DstMatrix dest (destAddress, destStride, + source.width, source.height, source.elements, transposeDest); + + dest.configureBuffer(source); + + float * sourceRecord, * destRecord; + + int temp_side = source.width-1; + float temp_matrix [temp_side*temp_side]; + + for (int i = 0; i < source.elements; i++) + { + sourceRecord = source.nextRecord(); + destRecord = dest.nextRecord(); + + float det = determinant(sourceRecord, sourceWidth); + float sign; + + for (int c = 0; c < source.width; c++) + { + sign = (c & 1) ? 1.0f : -1.0f; + + for (int r = 0; r < source.width; r++) + { + // get the sub matrix + subMatrix(sourceRecord, source.width, temp_matrix, c, r); + + // transpose the result + destRecord[r + c * source.width] + = (sign / det) * determinant(temp_matrix, temp_side); + + // swap signs + sign = (sign == 1) ? -1.0f : 1.0f; + } + } + + dest.writeRecord(); + } } Index: org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe.cpp 24 Aug 2002 21:16:53 -0000 1.1 +++ org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe.cpp 28 Aug 2002 16:45:24 -0000 1.2 @@ -41,6 +41,9 @@ #include <windows.h> #include "org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe.h" +#include "MatrixOpCommon.h" + + /* * Class: org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe * Method: execute @@ -61,6 +64,45 @@ jboolean transposeDest ) { - float * source = (float *) sourceAddress; - float * dest = (float *) destAddress; + // We are under the assumption that sourceWidth == sourceHeight and the matrix + // defined within is invertable + + SrcMatrix source (sourceAddress, sourceStride, + sourceWidth, sourceHeight, numElements, transposeSource); + DstMatrix dest (destAddress, destStride, + source.width, source.height, source.elements, transposeDest); + + float * sourceRecord, * destRecord; + + int temp_side = source.width-1; + float temp_matrix [temp_side*temp_side]; + + for (int i = 0; i < source.elements; i++) + { + sourceRecord = source.nextRecord(); + destRecord = dest.nextRecord(); + + float det = determinant(sourceRecord, sourceWidth); + float sign; + + for (int c = 0; c < source.width; c++) + { + sign = (c & 1) ? 1.0f : -1.0f; + + for (int r = 0; r < source.width; r++) + { + // get the sub matrix + subMatrix(sourceRecord, source.width, temp_matrix, c, r); + + // transpose the result + destRecord[r + c * source.width] + = (sign / det) * determinant(temp_matrix, temp_side); + + // swap signs + sign = (sign == 1) ? -1.0f : 1.0f; + } + } + + dest.writeRecord(); + } } Index: org_lwjgl_Math_MatrixOpMultiply_MatrixOpDirect.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpMultiply_MatrixOpDirect.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpMultiply_MatrixOpDirect.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- org_lwjgl_Math_MatrixOpMultiply_MatrixOpDirect.cpp 24 Aug 2002 21:16:53 -0000 1.1 +++ org_lwjgl_Math_MatrixOpMultiply_MatrixOpDirect.cpp 28 Aug 2002 16:45:24 -0000 1.2 @@ -41,6 +41,8 @@ #include <windows.h> #include "org_lwjgl_Math_MatrixOpMultiply_MatrixOpDirect.h" +#include "MatrixOpCommon.h" +#include <cstring> /* * Class: org_lwjgl_Math_MatrixOpMultiply_MatrixOpDirect * Method: execute @@ -67,9 +69,55 @@ jboolean transposeDest ) { - float * leftSource = (float *) leftSourceAddress; - float * rightSource = (float *) rightSourceAddress; - float * dest = (float *) destAddress; -} + if (transposeLeftSource && transposeRightSource) + { + transposeLeftSource = false; + transposeRightSource = false; + transposeDest = !transposeDest; + } + + SrcMatrix left (leftSourceAddress, leftSourceStride, + leftSourceWidth, leftSourceHeight, leftElements, transposeLeftSource); + SrcMatrix right (rightSourceAddress, leftSourceStride, + rightSourceWidth, rightSourceHeight, rightElements, transposeRightSource); + DstMatrix dest (destAddress, destStride, + right.width, left.height, left.elements * right.elements, transposeDest); + + dest.configureBuffer(left, right); + + float * leftRecord, * rightRecord, * destRecord; + + // check out discussions envolving ordering + + + left.rewind(); + for (int i = 0; i < leftElements; i++) + { + leftRecord = left.nextRecord(); + + right.rewind(); + for (int j = 0; j < rightElements; j++) + { + rightRecord = right.nextRecord(); + destRecord = dest.nextRecord(); + + memset(destRecord, 0, dest.width * dest.height * sizeof(jfloat)); + + for (int rightCol = 0; rightCol < right.width; rightCol++) + { + for (int leftIndex = 0; leftIndex < left.width*left.height; leftIndex++) + { + destRecord[i % dest.height] += leftRecord[i] * rightRecord[i / leftSourceHeight]; + } + + rightRecord = &rightRecord[right.height]; + destRecord = &destRecord[dest.height]; + + } + dest.writeRecord(); + } + } + +} Index: org_lwjgl_Math_MatrixOpMultiply_MatrixOpSafe.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpMultiply_MatrixOpSafe.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpMultiply_MatrixOpSafe.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- org_lwjgl_Math_MatrixOpMultiply_MatrixOpSafe.cpp 24 Aug 2002 21:16:53 -0000 1.1 +++ org_lwjgl_Math_MatrixOpMultiply_MatrixOpSafe.cpp 28 Aug 2002 16:45:24 -0000 1.2 @@ -41,6 +41,9 @@ #include <windows.h> #include "org_lwjgl_Math_MatrixOpMultiply_MatrixOpSafe.h" +#include "MatrixOpCommon.h" +#include <cstring> + /* * Class: org_lwjgl_Math_MatrixOpMultiply_MatrixOpSafe * Method: execute @@ -67,9 +70,54 @@ jboolean transposeDest ) { - float * leftSource = (float *) leftSourceAddress; - float * rightSource = (float *) rightSourceAddress; - float * dest = (float *) destAddress; + if (transposeLeftSource && transposeRightSource) + { + transposeLeftSource = false; + transposeRightSource = false; + transposeDest = !transposeDest; + } + + + SrcMatrix left (leftSourceAddress, leftSourceStride, + leftSourceWidth, leftSourceHeight, leftElements, transposeLeftSource); + SrcMatrix right (rightSourceAddress, leftSourceStride, + rightSourceWidth, rightSourceHeight, rightElements, transposeRightSource); + DstMatrix dest (destAddress, destStride, + right.width, left.height, left.elements * right.elements, transposeDest); + + float * leftRecord, * rightRecord, * destRecord; + + // check out discussions envolving ordering + + + left.rewind(); + for (int i = 0; i < leftElements; i++) + { + leftRecord = left.nextRecord(); + + right.rewind(); + for (int j = 0; j < rightElements; j++) + { + rightRecord = right.nextRecord(); + destRecord = dest.nextRecord(); + + memset(destRecord, 0, dest.width * dest.height * sizeof(jfloat)); + + for (int rightCol = 0; rightCol < right.width; rightCol++) + { + for (int leftIndex = 0; leftIndex < left.width*left.height; leftIndex++) + { + destRecord[i % dest.height] += leftRecord[i] * rightRecord[i / leftSourceHeight]; + } + + rightRecord = &rightRecord[right.height]; + destRecord = &destRecord[dest.height]; + + } + dest.writeRecord(); + } + } + } Index: org_lwjgl_Math_MatrixOpNegate_MatrixOpDirect.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpNegate_MatrixOpDirect.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpNegate_MatrixOpDirect.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- org_lwjgl_Math_MatrixOpNegate_MatrixOpDirect.cpp 24 Aug 2002 21:16:53 -0000 1.1 +++ org_lwjgl_Math_MatrixOpNegate_MatrixOpDirect.cpp 28 Aug 2002 16:45:24 -0000 1.2 @@ -41,6 +41,7 @@ #include <windows.h> #include "org_lwjgl_Math_MatrixOpNegate_MatrixOpDirect.h" +#include "MatrixOpCommon.h" /* * Class: org_lwjgl_Math_MatrixOpNegate_MatrixOpDirect * Method: execute @@ -61,6 +62,25 @@ jboolean transposeDest ) { - float * source = (float *) sourceAddress; - float * dest = (float *) destAddress; + SrcMatrix source (sourceAddress, sourceStride, sourceWidth, sourceHeight, numElements, transposeSource); + DstMatrix dest (destAddress, destStride, source.width, source.height, numElements, transposeDest); + + dest.configureBuffer(source); + + int * sourceRecord, * destRecord; + + for (int i = 0; i < source.elements; i++) + { + sourceRecord = (int *) source.nextRecord(); + destRecord = (int *) dest.nextRecord(); + + // we can cheat and use the less expensive xor + // to switch the sign bit of the float + // single precision format 1 - sign 8 - exponent (excess 127) 23 - mantisa + + for (int j = 0; j < sourceWidth*sourceHeight; j++) + destRecord[j] = sourceRecord[j] ^ 0x80000000; + + dest.writeRecord(); + } } Index: org_lwjgl_Math_MatrixOpNegate_MatrixOpSafe.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpNegate_MatrixOpSafe.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpNegate_MatrixOpSafe.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- org_lwjgl_Math_MatrixOpNegate_MatrixOpSafe.cpp 24 Aug 2002 21:16:53 -0000 1.1 +++ org_lwjgl_Math_MatrixOpNegate_MatrixOpSafe.cpp 28 Aug 2002 16:45:24 -0000 1.2 @@ -41,6 +41,7 @@ #include <windows.h> #include "org_lwjgl_Math_MatrixOpNegate_MatrixOpSafe.h" +#include "MatrixOpCommon.h" /* * Class: org_lwjgl_Math_MatrixOpNegate_MatrixOpSafe * Method: execute @@ -61,6 +62,23 @@ jboolean transposeDest ) { - float * source = (float *) sourceAddress; - float * dest = (float *) destAddress; + SrcMatrix source (sourceAddress, sourceStride, sourceWidth, sourceHeight, numElements, transposeSource); + DstMatrix dest (destAddress, destStride, source.width, source.height, numElements, transposeDest); + + int * sourceRecord, * destRecord; + + for (int i = 0; i < source.elements; i++) + { + sourceRecord = (int *) source.nextRecord(); + destRecord = (int *) dest.nextRecord(); + + // we can cheat and use the less expensive xor + // to switch the sign bit of the float + // single precision format 1 - sign 8 - exponent (excess 127) 23 - mantisa + + for (int j = 0; j < sourceWidth*sourceHeight; j++) + destRecord[j] = sourceRecord[j] ^ 0x80000000; + + dest.writeRecord(); + } } Index: org_lwjgl_Math_MatrixOpNormalise_MatrixOpDirect.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpNormalise_MatrixOpDirect.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpNormalise_MatrixOpDirect.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- org_lwjgl_Math_MatrixOpNormalise_MatrixOpDirect.cpp 24 Aug 2002 21:16:53 -0000 1.1 +++ org_lwjgl_Math_MatrixOpNormalise_MatrixOpDirect.cpp 28 Aug 2002 16:45:24 -0000 1.2 @@ -41,6 +41,11 @@ #include <windows.h> #include "org_lwjgl_Math_MatrixOpNormalise_MatrixOpDirect.h" +#include "MatrixOpCommon.h" +#include <cmath> + +using namespace std; + /* * Class: org_lwjgl_Math_MatrixOpNormalise_MatrixOpDirect * Method: execute @@ -61,6 +66,32 @@ jboolean transposeDest ) { - float * source = (float *) sourceAddress; - float * dest = (float *) destAddress; + SrcMatrix source (sourceAddress, sourceStride, sourceWidth, sourceHeight, numElements, transposeSource); + DstMatrix dest (destAddress, destStride, source.width, source.height, source.elements, transposeDest); + + dest.configureBuffer(source); + + float * sourceRecord, * destRecord; + float magnitude, magnitude_squared; + + int i; + register int j; + + for (i = 0; i < source.elements; i++) + { + + magnitude_squared = 0; + sourceRecord = source.nextRecord(); + destRecord = dest.nextRecord(); + + for (j = 0 ; j < sourceWidth*sourceHeight; i++) + magnitude_squared += sourceRecord[j] * sourceRecord[j]; + + magnitude = (float) sqrt((double) magnitude_squared); + + for (j = 0; j < sourceWidth*sourceHeight; i++) + destRecord[j] = sourceRecord[j] / magnitude; + + dest.writeRecord(); + } } Index: org_lwjgl_Math_MatrixOpNormalise_MatrixOpSafe.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpNormalise_MatrixOpSafe.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpNormalise_MatrixOpSafe.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- org_lwjgl_Math_MatrixOpNormalise_MatrixOpSafe.cpp 24 Aug 2002 21:16:53 -0000 1.1 +++ org_lwjgl_Math_MatrixOpNormalise_MatrixOpSafe.cpp 28 Aug 2002 16:45:24 -0000 1.2 @@ -41,6 +41,11 @@ #include <windows.h> #include "org_lwjgl_Math_MatrixOpSubtract_MatrixOpSafe.h" +#include "MatrixOpCommon.h" +#include <cmath> + +using namespace std; + /* * Class: org_lwjgl_Math_MatrixOpNormalise_MatrixOpSafe * Method: execute @@ -61,6 +66,30 @@ jboolean transposeDest ) { - float * source = (float *) sourceAddress; - float * dest = (float *) destAddress; + SrcMatrix source (sourceAddress, sourceStride, sourceWidth, sourceHeight, numElements, transposeSource); + DstMatrix dest (destAddress, destStride, source.width, source.height, source.elements, transposeDest); + + float * sourceRecord, * destRecord; + float magnitude, magnitude_squared; + + int i; + register int j; + + for (i = 0; i < source.elements; i++) + { + + magnitude_squared = 0; + sourceRecord = source.nextRecord(); + destRecord = dest.nextRecord(); + + for (j = 0 ; j < sourceWidth*sourceHeight; i++) + magnitude_squared += sourceRecord[j] * sourceRecord[j]; + + magnitude = (float) sqrt((double) magnitude_squared); + + for (j = 0; j < sourceWidth*sourceHeight; i++) + destRecord[j] = sourceRecord[j] / magnitude; + + dest.writeRecord(); + } } Index: org_lwjgl_Math_MatrixOpSubtract_MatrixOpDirect.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpSubtract_MatrixOpDirect.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpSubtract_MatrixOpDirect.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- org_lwjgl_Math_MatrixOpSubtract_MatrixOpDirect.cpp 24 Aug 2002 21:16:53 -0000 1.1 +++ org_lwjgl_Math_MatrixOpSubtract_MatrixOpDirect.cpp 28 Aug 2002 16:45:24 -0000 1.2 @@ -41,6 +41,7 @@ #include <windows.h> #include "org_lwjgl_Math_MatrixOpSubtract_MatrixOpDirect.h" +#include "MatrixOpCommon.h" /* * Class: org_lwjgl_Math_MatrixOpSubtract_MatrixOpDirect * Method: execute @@ -67,9 +68,41 @@ jboolean transposeDest ) { - float * leftSource = (float *) leftSourceAddress; - float * rightSource = (float *) rightSourceAddress; - float * dest = (float *) destAddress; + if (transposeLeftSource && transposeRightSource) + { + transposeLeftSource = false; + transposeRightSource = false; + transposeDest = !transposeDest; + } + + SrcMatrix left (leftSourceAddress, leftSourceStride, + leftSourceWidth, leftSourceHeight, leftElements, transposeLeftSource); + SrcMatrix right (rightSourceAddress, leftSourceStride, + rightSourceWidth, rightSourceHeight, rightElements, transposeRightSource); + DstMatrix dest (destAddress, destStride, + left.width, left.height, left.elements * right.elements, transposeDest); + + dest.configureBuffer(left, right); + + float * leftRecord, * rightRecord, * destRecord; + + left.rewind(); + for (int i = 0; i < left.elements; i++) + { + leftRecord = left.nextRecord(); + + right.rewind(); + for (int j = 0; j < right.elements; j++) + { + rightRecord = right.nextRecord(); + destRecord = dest.nextRecord(); + + for (int k = (left.width * left.height) - 1; k >= 0; k--) + destRecord[k] = leftRecord[k] - rightRecord[k]; + + dest.writeRecord(); + } + } } Index: org_lwjgl_Math_MatrixOpSubtract_MatrixOpSafe.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpSubtract_MatrixOpSafe.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math_MatrixOpSubtract_MatrixOpSafe.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- org_lwjgl_Math_MatrixOpSubtract_MatrixOpSafe.cpp 24 Aug 2002 21:16:53 -0000 1.1 +++ org_lwjgl_Math_MatrixOpSubtract_MatrixOpSafe.cpp 28 Aug 2002 16:45:24 -0000 1.2 @@ -41,6 +41,8 @@ #include <windows.h> #include "org_lwjgl_Math_MatrixOpSubtract_MatrixOpSafe.h" +#include "MatrixOpCommon.h" + /* * Class: org_lwjgl_Math_MatrixOpSubtract_MatrixOpSafe * Method: execute @@ -67,9 +69,40 @@ jboolean transposeDest ) { - float * leftSource = (float *) leftSourceAddress; - float * rightSource = (float *) rightSourceAddress; - float * dest = (float *) destAddress; + if (transposeLeftSource && transposeRightSource) + { + transposeLeftSource = false; + transposeRightSource = false; + transposeDest = !transposeDest; + } + + SrcMatrix left (leftSourceAddress, leftSourceStride, + leftSourceWidth, leftSourceHeight, leftElements, transposeLeftSource); + SrcMatrix right (rightSourceAddress, leftSourceStride, + rightSourceWidth, rightSourceHeight, rightElements, transposeRightSource); + DstMatrix dest (destAddress, destStride, + left.width, left.height, left.elements * right.elements, transposeDest); + + float * leftRecord, * rightRecord, * destRecord; + + left.rewind(); + for (int i = 0; i < left.elements; i++) + { + leftRecord = left.nextRecord(); + + right.rewind(); + for (int j = 0; j < right.elements; j++) + { + rightRecord = right.nextRecord(); + destRecord = dest.nextRecord(); + + for (int k = (left.width * left.height) - 1; k >= 0; k--) + destRecord[k] = leftRecord[k] - rightRecord[k]; + + dest.writeRecord(); + } + } } + |
From: Brian M. <ma...@us...> - 2002-08-28 14:17:10
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test In directory usw-pr-cvs1:/tmp/cvs-serv22616/org/lwjgl/openal/test Modified Files: ALTest.java Log Message: add: more tests Index: ALTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test/ALTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test/ALTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ALTest.java 28 Aug 2002 01:19:59 -0000 1.1 +++ ALTest.java 28 Aug 2002 14:17:06 -0000 1.2 @@ -504,18 +504,18 @@ do { System.out.print("\n\n\nAutomated Test Series:\n\n"); - System.out.print("A) Run Fully Automated Tests\n"); - System.out.print("B) Run Semi-Automated Tests\n"); + System.out.print("*A) Run Fully Automated Tests\n"); + System.out.print("*B) Run Semi-Automated Tests\n"); System.out.print("\nInteractive Tests:\n\n"); System.out.print("1 Position Test\n"); System.out.print("2 Looping Test\n"); - System.out.print("3 EAX 2.0 Test\n"); [...1085 lines suppressed...] + if ((error = al.getError()) != AL.NO_ERROR) + displayALError("alSourcePlay : ", error); + + // Delay a little + delay_ms(100); + } + break; + case '2': + al.sourceStopv(numSources, Sources); + if ((error = al.getError()) != AL.NO_ERROR) + displayALError("alSourceStopv : ", error); + break; + } + } while (ch != 'Q'); + + // Delete the Sources + al.deleteSources(numSources, Sources); } /** |
From: Brian M. <ma...@us...> - 2002-08-28 12:57:00
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal In directory usw-pr-cvs1:/tmp/cvs-serv12139/org/lwjgl/openal Added Files: OpenALException.java Log Message: initial import --- NEW FILE: OpenALException.java --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/OpenALException.java /* * Copyright (c) 2002 Light Weight Java Game Library Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Light Weight Java Game Library' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.openal; /** * $Id: OpenALException.java,v 1.1 2002/08/28 12:56:55 matzon Exp $ * * Thrown by the debug build library of the LWJGL if any OpenAL operation * causes an error. * * @author Brian Matzon <br...@ma...> * @version $Revision: 1.1 $ */ public class OpenALException extends RuntimeException { /** * Constructor for OpenALException. */ public OpenALException() { super(); } /** * Constructor for OpenALException. * @param message */ public OpenALException(String message) { super(message); } /** * Constructor for OpenALException. * @param message * @param cause */ public OpenALException(String message, Throwable cause) { super(message, cause); } /** * Constructor for OpenALException. * @param cause */ public OpenALException(Throwable cause) { super(cause); } } |
From: Brian M. <ma...@us...> - 2002-08-28 01:20:04
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test In directory usw-pr-cvs1:/tmp/cvs-serv11094/org/lwjgl/openal/test Added Files: ALTest.java Log Message: initial import of ALTest - conversion of altest.c - work in progress --- NEW FILE: ALTest.java --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test/ALTest.java /* * Copyright (c) 2002 Light Weight Java Game Library Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Light Weight Java Game Library' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.openal.test; import org.lwjgl.openal.AL; import org.lwjgl.openal.ALC; import org.lwjgl.openal.ALCcontext; import org.lwjgl.openal.ALCdevice; import org.lwjgl.openal.ALUT; import org.lwjgl.openal.ALUTLoadWAVData; import org.lwjgl.Sys; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.io.IOException; /** * $Id: ALTest.java,v 1.1 2002/08/28 01:19:59 matzon Exp $ * * This class tests al functionality, much like altest.c * * @author Brian Matzon <br...@ma...> * @version $Revision: 1.1 $ */ public class ALTest extends BasicTest { /** number of buffers used */ public static final int NUM_BUFFERS = 7; /** buffers used */ protected int[] buffers = new int[NUM_BUFFERS]; /** enumerations string */ protected String[] enumerationString = new String[]{ "AL_INVALID", "AL_INVALID", "ALC_INVALID", "AL_NONE", "AL_FALSE", "ALC_FALSE", "AL_TRUE", "ALC_TRUE", "AL_SOURCE_RELATIVE", "AL_CONE_INNER_ANGLE", "AL_CONE_OUTER_ANGLE", "AL_PITCH", "AL_POSITION", "AL_DIRECTION", "AL_VELOCITY", "AL_LOOPING", "AL_BUFFER", "AL_GAIN", "AL_MIN_GAIN", "AL_MAX_GAIN", "AL_ORIENTATION", "AL_REFERENCE_DISTANCE", "AL_ROLLOFF_FACTOR", "AL_CONE_OUTER_GAIN", "AL_MAX_DISTANCE", "AL_SOURCE_STATE", "AL_INITIAL", "AL_PLAYING", "AL_PAUSED", "AL_STOPPED", "AL_BUFFERS_QUEUED", "AL_BUFFERS_PROCESSED", "AL_FORMAT_MONO8", "AL_FORMAT_MONO16", "AL_FORMAT_STEREO8", "AL_FORMAT_STEREO16", "AL_FREQUENCY", "AL_SIZE", "AL_UNUSED", "AL_PENDING", "AL_PROCESSED", "ALC_MAJOR_VERSION", "ALC_MINOR_VERSION", "ALC_ATTRIBUTES_SIZE", "ALC_ALL_ATTRIBUTES", "ALC_DEFAULT_DEVICE_SPECIFIER", "ALC_DEVICE_SPECIFIER", "ALC_EXTENSIONS", "ALC_FREQUENCY", "ALC_REFRESH", "ALC_SYNC", "AL_NO_ERROR", "AL_INVALID_NAME", "AL_INVALID_ENUM", "AL_INVALID_VALUE", "AL_INVALID_OPERATION", "AL_OUT_OF_MEMORY", "ALC_NO_ERROR", "ALC_INVALID_DEVICE", "ALC_INVALID_CONTEXT", "ALC_INVALID_ENUM", "ALC_INVALID_VALUE", "ALC_OUT_OF_MEMORY", "AL_VENDOR", "AL_VERSION", "AL_RENDERER", "AL_EXTENSIONS", "AL_DOPPLER_FACTOR", "AL_DOPPLER_VELOCITY", "AL_DISTANCE_MODEL", "AL_INVERSE_DISTANCE", "AL_INVERSE_DISTANCE_CLAMPED" }; /** enumerations string */ protected int[] enumeration = new int[]{ AL.INVALID, AL.INVALID, ALC.INVALID, AL.NONE, AL.FALSE, ALC.FALSE, AL.TRUE, ALC.TRUE, AL.SOURCE_RELATIVE, AL.CONE_INNER_ANGLE, AL.CONE_OUTER_ANGLE, AL.PITCH, AL.POSITION, AL.DIRECTION, AL.VELOCITY, AL.LOOPING, AL.BUFFER, AL.GAIN, AL.MIN_GAIN, AL.MAX_GAIN, AL.ORIENTATION, AL.REFERENCE_DISTANCE, AL.ROLLOFF_FACTOR, AL.CONE_OUTER_GAIN, AL.MAX_DISTANCE, AL.SOURCE_STATE, AL.INITIAL, AL.PLAYING, AL.PAUSED, AL.STOPPED, AL.BUFFERS_QUEUED, AL.BUFFERS_PROCESSED, AL.FORMAT_MONO8, AL.FORMAT_MONO16, AL.FORMAT_STEREO8, AL.FORMAT_STEREO16, AL.FREQUENCY, AL.SIZE, AL.UNUSED, AL.PENDING, AL.PROCESSED, ALC.MAJOR_VERSION, ALC.MINOR_VERSION, ALC.ATTRIBUTES_SIZE, ALC.ALL_ATTRIBUTES, ALC.DEFAULT_DEVICE_SPECIFIER, ALC.DEVICE_SPECIFIER, ALC.EXTENSIONS, ALC.FREQUENCY, ALC.REFRESH, ALC.SYNC, AL.NO_ERROR, AL.INVALID_NAME, AL.INVALID_ENUM, AL.INVALID_VALUE, AL.INVALID_OPERATION, AL.OUT_OF_MEMORY, ALC.NO_ERROR, ALC.INVALID_DEVICE, ALC.INVALID_CONTEXT, ALC.INVALID_ENUM, ALC.INVALID_VALUE, ALC.OUT_OF_MEMORY, AL.VENDOR, AL.VERSION, AL.RENDERER, AL.EXTENSIONS, AL.DOPPLER_FACTOR, AL.DOPPLER_VELOCITY, AL.DISTANCE_MODEL, AL.INVERSE_DISTANCE, AL.INVERSE_DISTANCE_CLAMPED }; /** * Creates an instance of ALTest */ public ALTest() { super(); } /** * Sleeeeeep */ protected void delay_ms(long ms) { try { Thread.sleep(ms); } catch (InterruptedException inte) { inte.printStackTrace(); } } /** * Display error */ protected void displayALError(String text, int errorcode) { System.out.println(text + " - " + al.getString(errorcode)); } /** * Runs the actual test, using supplied arguments */ protected void execute(String[] args) { String szEAX = "EAX"; String szFnName; int ch = -1; int error; ALCcontext context; ALCdevice device; ByteBuffer listenerPos = ByteBuffer.allocateDirect(12); listenerPos.order(ByteOrder.nativeOrder()); listenerPos.putFloat(0.0f); listenerPos.putFloat(0.0f); listenerPos.putFloat(0.0f); ByteBuffer listenerVel = ByteBuffer.allocateDirect(12); listenerVel.order(ByteOrder.nativeOrder()); listenerVel.putFloat(0.0f); listenerVel.putFloat(0.0f); listenerVel.putFloat(0.0f); ByteBuffer listenerOri = ByteBuffer.allocateDirect(24); listenerOri.order(ByteOrder.nativeOrder()); listenerOri.putFloat(0.0f); listenerOri.putFloat(0.0f); listenerOri.putFloat(-1.0f); listenerOri.putFloat(0.0f); listenerOri.putFloat(1.0f); listenerOri.putFloat(0.0f); System.out.print("OpenAL Test Application (Java!)\n"); System.out.print("=======================\n\n"); // Initialize Open AL manually //Open device device = alc.openDevice("DirectSound3D"); //Create context(s) context = alc.createContext(device, 0); //Set active context alc.makeContextCurrent(context); // Clear Error Code al.getError(); // Set Listener attributes // Position ... al.listenerfv(AL.POSITION, Sys.getDirectBufferAddress(listenerPos)); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alListenerfv POSITION : ", error); System.exit(-1); } // Velocity ... al.listenerfv(AL.VELOCITY, Sys.getDirectBufferAddress(listenerVel)); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alListenerfv VELOCITY : ", error); System.exit(-1); } // Orientation ... al.listenerfv(AL.ORIENTATION, Sys.getDirectBufferAddress(listenerOri)); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alListenerfv ORIENTATION : ", error); System.exit(-1); } // Generate Buffers al.genBuffers(NUM_BUFFERS, buffers); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alGenBuffers :", error); System.exit(-1); } // Load in samples to be used by Test functions // Load footsteps.wav ALUTLoadWAVData data = alut.loadWAVFile("footsteps.wav"); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alutLoadWAVFile footsteps.wav : ", error); // Delete Buffers al.deleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } // Copy footsteps.wav data into AL Buffer 0 al.bufferData(buffers[0], data.format, data.data, data.size, data.freq); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alBufferData buffer 0 : ", error); // Delete buffers al.deleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } // Unload footsteps.wav alut.unloadWAV(data.format, data.data, data.size, data.freq); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alutUnloadWAV : ", error); // Delete buffers al.deleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } // Load ding.wav data = alut.loadWAVFile("ding.wav"); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alutLoadWAVFile ding.wav : ", error); // Delete Buffers al.deleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } // Copy ding.wav data into AL Buffer 1 al.bufferData(buffers[1], data.format, data.data, data.size, data.freq); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alBufferData buffer 1 : ", error); // Delete buffers al.deleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } // Unload footsteps.wav alut.unloadWAV(data.format, data.data, data.size, data.freq); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alutUnloadWAV : ", error); // Delete buffers al.deleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } // Load wave1.wav data = alut.loadWAVFile("wave1.wav"); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alutLoadWAVFile wave1.wav : ", error); // Delete Buffers al.deleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } // Copy wave1.wav data into AL Buffer 2 al.bufferData(buffers[2], data.format, data.data, data.size, data.freq); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alBufferData buffer 2 : ", error); // Delete buffers al.deleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } // Unload wave1.wav alut.unloadWAV(data.format, data.data, data.size, data.freq); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alutUnloadWAV : ", error); // Delete buffers al.deleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } // Load Wave2.wav data = alut.loadWAVFile("Wave2.wav"); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alutLoadWAVFile Wave2.wav : ", error); // Delete Buffers al.deleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } // Copy Wave2.wav data into AL Buffer 3 al.bufferData(buffers[3], data.format, data.data, data.size, data.freq); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alBufferData buffer 3 : ", error); // Delete buffers al.deleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } // Unload Wave2.wav alut.unloadWAV(data.format, data.data, data.size, data.freq); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alutUnloadWAV : ", error); // Delete buffers al.deleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } // Load wave3.wav data = alut.loadWAVFile("wave3.wav"); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alutLoadWAVFile wave3.wav : ", error); // Delete Buffers al.deleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } // Copy wave3.wav data into AL Buffer 4 al.bufferData(buffers[4], data.format, data.data, data.size, data.freq); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alBufferData buffer 4 : ", error); // Delete buffers al.deleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } // Unload wave3.wav alut.unloadWAV(data.format, data.data, data.size, data.freq); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alutUnloadWAV : ", error); // Delete buffers al.deleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } // Load wave4.wav data = alut.loadWAVFile("wave4.wav"); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alutLoadWAVFile wave4.wav : ", error); // Delete Buffers al.deleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } // Copy wave4.wav data into AL Buffer 5 al.bufferData(buffers[5], data.format, data.data, data.size, data.freq); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alBufferData buffer 5 : ", error); // Delete buffers al.deleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } // Unload wave4.wav alut.unloadWAV(data.format, data.data, data.size, data.freq); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alutUnloadWAV : ", error); // Delete buffers al.deleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } // Load stereo.wav data = alut.loadWAVFile("stereo.wav"); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alutLoadWAVFile stereo.wav : ", error); // Delete Buffers al.deleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } // Copy stereo.wav data into AL Buffer 6 al.bufferData(buffers[6], data.format, data.data, data.size, data.freq); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alBufferData buffer 6 : ", error); // Delete buffers al.deleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } // Unload stereo.wav alut.unloadWAV(data.format, data.data, data.size, data.freq); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alutUnloadWAV : ", error); // Delete buffers al.deleteBuffers(NUM_BUFFERS, buffers); System.exit(-1); } do { System.out.print("\n\n\nAutomated Test Series:\n\n"); System.out.print("A) Run Fully Automated Tests\n"); System.out.print("B) Run Semi-Automated Tests\n"); System.out.print("\nInteractive Tests:\n\n"); System.out.print("1 Position Test\n"); System.out.print("2 Looping Test\n"); System.out.print("3 EAX 2.0 Test\n"); System.out.print("4 Queue Test\n"); System.out.print("5 Buffer Test\n"); System.out.print("6 Frequency Test\n"); System.out.print("7 Stereo Test\n"); System.out.print("8 Gain Test\n"); System.out.print("9 Streaming Test\n"); System.out.print("0 Multiple Sources Test\n"); System.out.print("\nQ to quit\n\n\n"); try { ch = System.in.read(); } catch (IOException ioe) { } switch (ch) { case 'A': fullAutoTests(); break; case 'B': semiAutoTests(); break; case '1': i_PositionTest(); break; case '2': i_LoopingTest(); break; case '3': i_EAXTest(); break; case '4': i_QueueTest(); break; case '5': i_BufferTest(); break; case '6': i_FreqTest(); break; case '7': i_StereoTest(); break; case '8': i_GainTest(); break; case '9': i_StreamingTest(); break; case '0': i_MultipleSourcesTest(); break; default: break; } } while (ch != 'Q'); } protected void fullAutoTests() { System.out.println("fullAutoTests"); delay_ms(3000); } protected void semiAutoTests() { System.out.println("semiAutoTests"); delay_ms(3000); } protected void i_PositionTest() { int error; int[] source = new int[2]; int ch = -1; ByteBuffer source0Pos = ByteBuffer.allocateDirect(12); source0Pos.order(ByteOrder.nativeOrder()); source0Pos.putFloat(-2.0f); source0Pos.putFloat(0.0f); source0Pos.putFloat(2.0f); ByteBuffer source0Vel = ByteBuffer.allocateDirect(12); source0Vel.order(ByteOrder.nativeOrder()); source0Vel.putFloat(0.0f); source0Vel.putFloat(0.0f); source0Vel.putFloat(0.0f); ByteBuffer source1Pos = ByteBuffer.allocateDirect(12); source1Pos.order(ByteOrder.nativeOrder()); source1Pos.putFloat(2.0f); source1Pos.putFloat(0.0f); source1Pos.putFloat(-2.0f); ByteBuffer source1Vel = ByteBuffer.allocateDirect(12); source1Vel.order(ByteOrder.nativeOrder()); source1Vel.putFloat(0.0f); source1Vel.putFloat(0.0f); source1Vel.putFloat(0.0f); al.genSources(2, source); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alGenSources 2 : ", error); return; } al.sourcef(source[0],AL.PITCH,1.0f); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alSourcef 0 AL_PITCH : \n", error); } al.sourcef(source[0],AL.GAIN,1.0f); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alSourcef 0 AL_GAIN : \n", error); } al.sourcefv(source[0],AL.POSITION,Sys.getDirectBufferAddress(source0Pos)); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alSourcefv 0 AL_POSITION : \n", error); } al.sourcefv(source[0],AL.VELOCITY,Sys.getDirectBufferAddress(source0Vel)); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alSourcefv 0 AL_VELOCITY : \n", error); } al.sourcei(source[0],AL.BUFFER, buffers[1]); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alSourcei 0 AL_BUFFER buffer 0 : \n", error); } al.sourcei(source[0],AL.LOOPING,AL.TRUE); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alSourcei 0 AL_LOOPING true: \n", error); } al.sourcef(source[1],AL.PITCH,1.0f); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alSourcef 1 AL_PITCH : \n", error); } al.sourcef(source[1],AL.GAIN,1.0f); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alSourcef 1 AL_GAIN : \n", error); } al.sourcefv(source[1],AL.POSITION,Sys.getDirectBufferAddress(source1Pos)); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alSourcefv 1 AL_POSITION : \n", error); } al.sourcefv(source[1],AL.VELOCITY,Sys.getDirectBufferAddress(source1Vel)); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alSourcefv 1 AL_VELOCITY : \n", error); } al.sourcei(source[1],AL.BUFFER, buffers[1]); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alSourcei 1 AL_BUFFER buffer 1 : \n", error); } al.sourcei(source[1],AL.LOOPING,AL.FALSE); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alSourcei 1 AL_LOOPING false: \n", error); } System.out.print("Position Test\n"); System.out.print("Press '1' to play source 0 (looping) rear left of listener\n"); System.out.print("Press '2' to play source 1 once (single shot) front right of listener\n"); System.out.print("Press '3' to stop source 0\n"); System.out.print("Press '4' to stop source 1\n"); System.out.print("Press 'Q' to quit\n"); do { try { ch = System.in.read(); } catch (IOException ioe) { } switch (ch) { case '1': al.sourcePlay(source[0]); if ((error = al.getError()) != AL.NO_ERROR) displayALError("alSourcePlay source 0 : ", error); break; case '2': al.sourcePlay(source[1]); if ((error = al.getError()) != AL.NO_ERROR) displayALError("alSourcePlay source 1 : ", error); break; case '3': al.sourceStop(source[0]); if ((error = al.getError()) != AL.NO_ERROR) displayALError("alSourceStop source 0 : ", error); break; case '4': al.sourceStop(source[1]); if ((error = al.getError()) != AL.NO_ERROR) displayALError("alSourceStop source 1 : ", error); break; } } while (ch != 'Q'); // Release resources al.sourceStopv(2, source); if ((error = al.getError()) != AL.NO_ERROR) displayALError("alSourceStopv 2 : ", error); al.deleteSources(2, source); if ((error = al.getError()) != AL.NO_ERROR) displayALError("alDeleteSources 2 : ", error); return; } protected void i_LoopingTest() { int error; int[] source = new int[2]; int ch = -1; int bLooping0 = AL.FALSE; int bLooping1 = AL.FALSE; ByteBuffer source0Pos = ByteBuffer.allocateDirect(12); source0Pos.order(ByteOrder.nativeOrder()); source0Pos.putFloat(-2.0f); source0Pos.putFloat(0.0f); source0Pos.putFloat(-2.0f); ByteBuffer source0Vel = ByteBuffer.allocateDirect(12); source0Vel.order(ByteOrder.nativeOrder()); source0Vel.putFloat(0.0f); source0Vel.putFloat(0.0f); source0Vel.putFloat(0.0f); ByteBuffer source1Pos = ByteBuffer.allocateDirect(12); source1Pos.order(ByteOrder.nativeOrder()); source1Pos.putFloat(2.0f); source1Pos.putFloat(0.0f); source1Pos.putFloat(-2.0f); ByteBuffer source1Vel = ByteBuffer.allocateDirect(12); source1Vel.order(ByteOrder.nativeOrder()); source1Vel.putFloat(0.0f); source1Vel.putFloat(0.0f); source1Vel.putFloat(0.0f); // Clear Error Code al.getError(); al.genSources(2,source); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alGenSources 1 : ", error); return; } al.sourcef(source[0],AL.PITCH,1.0f); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alSourcef 0 AL_PITCH : \n", error); } al.sourcef(source[0],AL.GAIN,1.0f); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alSourcef 0 AL_GAIN : \n", error); } al.sourcefv(source[0],AL.POSITION,Sys.getDirectBufferAddress(source0Pos)); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alSourcefv 0 AL_POSITION : \n", error); } al.sourcefv(source[0],AL.VELOCITY,Sys.getDirectBufferAddress(source0Vel)); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alSourcefv 0 AL_VELOCITY : \n", error); } al.sourcei(source[0],AL.BUFFER, buffers[0]); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alSourcei 0 AL_BUFFER buffer 0 : \n", error); } al.sourcei(source[0],AL.LOOPING,AL.FALSE); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alSourcei 0 AL_LOOPING false : \n", error); } al.sourcef(source[1],AL.PITCH,1.0f); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alSourcef 1 AL_PITCH : \n", error); } al.sourcef(source[1],AL.GAIN,1.0f); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alSourcef 1 AL_GAIN : \n", error); } al.sourcefv(source[1],AL.POSITION,Sys.getDirectBufferAddress(source1Pos)); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alSourcefv 1 AL_POSITION : \n", error); } al.sourcefv(source[1],AL.VELOCITY,Sys.getDirectBufferAddress(source1Vel)); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alSourcefv 1 AL_VELOCITY : \n", error); } al.sourcei(source[1],AL.BUFFER, buffers[1]); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alSourcei 1 AL_BUFFER buffer 1 : \n", error); } al.sourcei(source[1],AL.LOOPING,AL.FALSE); if ((error = al.getError()) != AL.NO_ERROR) { displayALError("alSourcei 1 AL_LOOPING false: \n", error); } System.out.print("Looping Test\n"); System.out.print("Press '1' to play source 0 once (single shot)\n"); System.out.print("Press '2' to toggle looping on source 0\n"); System.out.print("Press '3' to play source 1 once (single shot)\n"); System.out.print("Press '4' to toggle looping on source 1\n"); System.out.print("Press 'Q' to quit\n"); System.out.print("\nSource 0 : Not looping Source 1 : Not looping\n"); do { try { ch = System.in.read(); } catch (IOException ioe) { } switch (ch) { case '1': al.sourcePlay(source[0]); if ((error = al.getError()) != AL.NO_ERROR) displayALError("alSourcePlay source 0 : ", error); break; case '2': if (bLooping0 == AL.FALSE) { bLooping0 = AL.TRUE; if (bLooping1 == AL.TRUE) System.out.print("Source 0 : Looping Source 1 : Looping \n"); else System.out.print("Source 0 : Looping Source 1 : Not looping\n"); } else { bLooping0 = AL.FALSE; if (bLooping1 == AL.TRUE) System.out.print("Source 0 : Not looping Source 1 : Looping \n"); else System.out.print("Source 0 : Not looping Source 1 : Not looping\n"); } al.sourcei(source[0], AL.LOOPING, bLooping0); break; case '3': al.sourcePlay(source[1]); if ((error = al.getError()) != AL.NO_ERROR) displayALError("alSourcePlay source 1 : ", error); break; case '4': if (bLooping1 == AL.FALSE) { bLooping1 = AL.TRUE; if (bLooping0 == AL.TRUE) System.out.print("Source 0 : Looping Source 1 : Looping \n"); else System.out.print("Source 0 : Not looping Source 1 : Looping \n"); } else { bLooping1 = AL.FALSE; if (bLooping0 == AL.TRUE) System.out.print("Source 0 : Looping Source 1 : Not looping\n"); else System.out.print("Source 0 : Not looping Source 1 : Not looping\n"); } al.sourcei(source[1], AL.LOOPING, bLooping1); break; } } while (ch != 'Q'); System.out.print("\n"); // Release resources al.sourceStop(source[0]); if ((error = al.getError()) != AL.NO_ERROR) displayALError("alSourceStop source 1 : ", error); al.deleteSources(2, source); if ((error = al.getError()) != AL.NO_ERROR) displayALError("alDeleteSources 1 : ", error); return; } protected void i_EAXTest() { System.out.println("i_EAXTest"); delay_ms(3000); } protected void i_QueueTest() { System.out.println("i_QueueTest"); delay_ms(3000); } protected void i_BufferTest() { System.out.println("i_BufferTest"); delay_ms(3000); } protected void i_FreqTest() { System.out.println("i_FreqTest"); delay_ms(3000); } protected void i_StereoTest() { System.out.println("i_StereoTest"); delay_ms(3000); } protected void i_GainTest() { System.out.println("i_GainTest"); delay_ms(3000); } protected void i_StreamingTest() { System.out.println("i_StreamingTest"); delay_ms(3000); } protected void i_MultipleSourcesTest() { System.out.println("i_MultipleSourcesTest"); delay_ms(3000); } /** * main entry point * * @param args String array containing arguments */ public static void main(String[] args) { ALTest alTest = new ALTest(); alTest.execute(args); } } |
From: Caspian Rychlik-P. <ci...@us...> - 2002-08-28 00:06:04
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/vector In directory usw-pr-cvs1:/tmp/cvs-serv15688/src/java/org/lwjgl/vector Modified Files: Matrix2f.java Vector3f.java Matrix4f.java Vector2f.java Vector.java Matrix.java Matrix3f.java Log Message: Fixes Index: Matrix2f.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Matrix2f.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Matrix2f.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Matrix2f.java 26 Aug 2002 20:24:29 -0000 1.7 +++ Matrix2f.java 28 Aug 2002 00:05:45 -0000 1.8 @@ -84,8 +84,8 @@ public Matrix load(FloatBuffer buf) { m00 = buf.get(); - m10 = buf.get(); m01 = buf.get(); + m10 = buf.get(); m11 = buf.get(); return this; @@ -101,8 +101,8 @@ public Matrix loadTranspose(FloatBuffer buf) { m00 = buf.get(); - m01 = buf.get(); m10 = buf.get(); + m01 = buf.get(); m11 = buf.get(); return this; @@ -115,8 +115,8 @@ */ public Matrix store(FloatBuffer buf) { buf.put(m00); - buf.put(m10); buf.put(m01); + buf.put(m10); buf.put(m11); return this; } @@ -128,8 +128,8 @@ */ public Matrix storeTranspose(FloatBuffer buf) { buf.put(m00); - buf.put(m01); buf.put(m10); + buf.put(m01); buf.put(m11); return this; } @@ -293,6 +293,7 @@ * @return this */ public Matrix invert() { + assert false : "Not implemented yet!"; return this; } @@ -356,6 +357,7 @@ * @see org.lwjgl.vector.Matrix#determinant() */ public float determinant() { + assert false : "Not implemented yet!"; return 0; } Index: Vector3f.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Vector3f.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Vector3f.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Vector3f.java 26 Aug 2002 20:24:29 -0000 1.5 +++ Vector3f.java 28 Aug 2002 00:05:45 -0000 1.6 @@ -143,6 +143,32 @@ return dest.set(left.x - right.x, left.y - right.y, left.z - right.z); } } + + /** + * The cross product of two vectors. + * + * @param left The LHS vector + * @param right The RHS vector + * @param dest The destination result, or null if a new vector is to be created + * @return left cross right + */ + public static Vector3f cross( + Vector3f left, + Vector3f right, + Vector3f dest) + { + + if (dest == null) + dest = new Vector3f(); + + dest.set( + left.y * right.z - left.z * right.y, + right.x * left.z - right.z * left.x, + left.x * right.y - left.y * right.x + ); + + return dest; + } Index: Matrix4f.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Matrix4f.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Matrix4f.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- Matrix4f.java 26 Aug 2002 20:24:29 -0000 1.8 +++ Matrix4f.java 28 Aug 2002 00:05:45 -0000 1.9 @@ -39,6 +39,16 @@ * @author foo */ public class Matrix4f extends Matrix { + + public float m00 = 1.0f, m01, m02, m03, m10, m11 = 1.0f, m12, m13, m20, m21, m22 = 1.0f, m23, m30, m31, m32, m33 = 1.0f; + + /** + * Construct a Matrix4f + */ + public Matrix4f() { + super(); + } + /** * Set this matrix to be the identity matrix. * @return this @@ -91,15 +101,6 @@ } - - public float m00 = 1.0f, m01, m02, m03, m10, m11 = 1.0f, m12, m13, m20, m21, m22 = 1.0f, m23, m30, m31, m32, m33 = 1.0f; - - /** - * Construct a Matrix4f - */ - public Matrix4f() { - super(); - } /** * Load from another matrix4f * @param src The source matrix @@ -137,20 +138,20 @@ public Matrix load(FloatBuffer buf) { m00 = buf.get(); - m10 = buf.get(); - m20 = buf.get(); - m30 = buf.get(); m01 = buf.get(); - m11 = buf.get(); - m21 = buf.get(); - m31 = buf.get(); m02 = buf.get(); - m12 = buf.get(); - m22 = buf.get(); - m32 = buf.get(); m03 = buf.get(); + m10 = buf.get(); + m11 = buf.get(); + m12 = buf.get(); m13 = buf.get(); + m20 = buf.get(); + m21 = buf.get(); + m22 = buf.get(); m23 = buf.get(); + m30 = buf.get(); + m31 = buf.get(); + m32 = buf.get(); m33 = buf.get(); return this; @@ -166,20 +167,20 @@ public Matrix loadTranspose(FloatBuffer buf) { m00 = buf.get(); - m01 = buf.get(); - m02 = buf.get(); - m03 = buf.get(); m10 = buf.get(); - m11 = buf.get(); - m12 = buf.get(); - m13 = buf.get(); m20 = buf.get(); - m21 = buf.get(); - m22 = buf.get(); - m23 = buf.get(); m30 = buf.get(); + m01 = buf.get(); + m11 = buf.get(); + m21 = buf.get(); m31 = buf.get(); + m02 = buf.get(); + m12 = buf.get(); + m22 = buf.get(); m32 = buf.get(); + m03 = buf.get(); + m13 = buf.get(); + m23 = buf.get(); m33 = buf.get(); return this; @@ -192,20 +193,20 @@ */ public Matrix store(FloatBuffer buf) { buf.put(m00); - buf.put(m10); - buf.put(m20); - buf.put(m30); buf.put(m01); - buf.put(m11); - buf.put(m21); - buf.put(m31); buf.put(m02); - buf.put(m12); - buf.put(m22); - buf.put(m32); buf.put(m03); + buf.put(m10); + buf.put(m11); + buf.put(m12); buf.put(m13); + buf.put(m20); + buf.put(m21); + buf.put(m22); buf.put(m23); + buf.put(m30); + buf.put(m31); + buf.put(m32); buf.put(m33); return this; } @@ -217,20 +218,20 @@ */ public Matrix storeTranspose(FloatBuffer buf) { buf.put(m00); - buf.put(m01); - buf.put(m02); - buf.put(m03); buf.put(m10); - buf.put(m11); - buf.put(m12); - buf.put(m13); buf.put(m20); - buf.put(m21); - buf.put(m22); - buf.put(m23); buf.put(m30); + buf.put(m01); + buf.put(m11); + buf.put(m21); buf.put(m31); + buf.put(m02); + buf.put(m12); + buf.put(m22); buf.put(m32); + buf.put(m03); + buf.put(m13); + buf.put(m23); buf.put(m33); return this; } @@ -425,6 +426,76 @@ } /** + * Translate this matrix + * @param vec The vector to translate by + * @return this + */ + public Matrix4f translate(Vector2f vec) { + m30 += m00 * vec.x + m10 * vec.y; + m31 += m01 * vec.x + m11 * vec.y; + m32 += m02 * vec.x + m12 * vec.y; + m33 += m03 * vec.x + m13 * vec.y; + return this; + } + + /** + * Translate this matrix + * @param vec The vector to translate by + * @return this + */ + public Matrix4f translate(Vector3f vec) { + m30 += m00 * vec.x + m10 * vec.y + m20 * vec.z; + m31 += m01 * vec.x + m11 * vec.y + m21 * vec.z; + m32 += m02 * vec.x + m12 * vec.y + m22 * vec.z; + m33 += m03 * vec.x + m13 * vec.y + m23 * vec.z; + return this; + } + + + + /** + * Translate this matrix and stash the result in another matrix + * @param vec The vector to translate by + * @param dest The destination matrix or null if a new matrix is to be created + * @return the translated matrix + */ + public Matrix4f translate(Vector3f vec, Matrix4f dest) { + if (dest == null) + dest = new Matrix4f(); + else if (dest == this) + return translate(vec); + + dest.m30 += m00 * vec.x + m10 * vec.y + m20 * vec.z; + dest.m31 += m01 * vec.x + m11 * vec.y + m21 * vec.z; + dest.m32 += m02 * vec.x + m12 * vec.y + m22 * vec.z; + dest.m33 += m03 * vec.x + m13 * vec.y + m23 * vec.z; + + return dest; + } + + /** + * Translate this matrix and stash the result in another matrix + * @param vec The vector to translate by + * @param dest The destination matrix or null if a new matrix is to be created + * @return the translated matrix + */ + public Matrix4f translate(Vector2f vec, Matrix4f dest) { + if (dest == null) + dest = new Matrix4f(); + else if (dest == this) + return translate(vec); + + dest.m30 += m00 * vec.x + m10 * vec.y; + dest.m31 += m01 * vec.x + m11 * vec.y; + dest.m32 += m02 * vec.x + m12 * vec.y; + dest.m33 += m03 * vec.x + m13 * vec.y; + + return dest; + } + + + + /** * Transpose this matrix and place the result in another matrix * @param dest The destination matrix or null if a new matrix is to be created * @return the transposed matrix @@ -488,6 +559,7 @@ * @return this */ public Matrix invert() { + assert false : "Not implemented yet!"; return this; } Index: Vector2f.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Vector2f.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Vector2f.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Vector2f.java 26 Aug 2002 20:24:29 -0000 1.5 +++ Vector2f.java 28 Aug 2002 00:05:45 -0000 1.6 @@ -151,7 +151,7 @@ /** * The dot product of two vectors is calculated as - * v1.x * v2.x + v1.y * v2.y + * v1.x * v2.x + v1.y * v2.y + v1.z * v2.z * @param left The LHS vector * @param right The RHS vector * @return left dot right @@ -159,6 +159,8 @@ public static float dot(Vector2f left, Vector2f right) { return left.x * right.x + left.y * right.y; } + + /** * Calculate the angle between two vectors, in degrees Index: Vector.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Vector.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Vector.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Vector.java 26 Aug 2002 20:24:29 -0000 1.2 +++ Vector.java 28 Aug 2002 00:05:45 -0000 1.3 @@ -83,7 +83,7 @@ * Normalise this vector * @return this */ - public final Vector normalise() { + public final Vector normalize() { float l = 1.0f / length(); return scale(l); } Index: Matrix.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Matrix.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Matrix.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Matrix.java 26 Aug 2002 20:24:29 -0000 1.3 +++ Matrix.java 28 Aug 2002 00:05:45 -0000 1.4 @@ -36,7 +36,8 @@ /** * $Id$ * - * Base class for matrices. + * Base class for matrices. When a matrix is constructed it will be the identity + * matrix unless otherwise stated. * * @author cix_foo <ci...@us...> * @version $Revision$ Index: Matrix3f.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Matrix3f.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Matrix3f.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- Matrix3f.java 26 Aug 2002 20:24:29 -0000 1.8 +++ Matrix3f.java 28 Aug 2002 00:05:45 -0000 1.9 @@ -90,13 +90,13 @@ public Matrix load(FloatBuffer buf) { m00 = buf.get(); - m10 = buf.get(); - m20 = buf.get(); m01 = buf.get(); - m11 = buf.get(); - m21 = buf.get(); m02 = buf.get(); + m10 = buf.get(); + m11 = buf.get(); m12 = buf.get(); + m20 = buf.get(); + m21 = buf.get(); m22 = buf.get(); return this; @@ -112,13 +112,13 @@ public Matrix loadTranspose(FloatBuffer buf) { m00 = buf.get(); - m01 = buf.get(); - m02 = buf.get(); m10 = buf.get(); - m11 = buf.get(); - m12 = buf.get(); m20 = buf.get(); + m01 = buf.get(); + m11 = buf.get(); m21 = buf.get(); + m02 = buf.get(); + m12 = buf.get(); m22 = buf.get(); return this; @@ -131,13 +131,13 @@ */ public Matrix store(FloatBuffer buf) { buf.put(m00); - buf.put(m10); - buf.put(m20); buf.put(m01); - buf.put(m11); - buf.put(m21); buf.put(m02); + buf.put(m10); + buf.put(m11); buf.put(m12); + buf.put(m20); + buf.put(m21); buf.put(m22); return this; } @@ -149,13 +149,13 @@ */ public Matrix storeTranspose(FloatBuffer buf) { buf.put(m00); - buf.put(m01); - buf.put(m02); buf.put(m10); - buf.put(m11); - buf.put(m12); buf.put(m20); + buf.put(m01); + buf.put(m11); buf.put(m21); + buf.put(m02); + buf.put(m12); buf.put(m22); return this; } @@ -366,6 +366,7 @@ * @return this */ public Matrix invert() { + assert false : "Not implemented yet!"; return this; } |
From: Brian M. <ma...@us...> - 2002-08-27 23:30:24
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test In directory usw-pr-cvs1:/tmp/cvs-serv2247/org/lwjgl/openal/test Added Files: ALUTTest.java Log Message: initial import of ALUTTest - basically PlayTest, using ALUT for initialization and deinitialization --- NEW FILE: ALUTTest.java --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test/ALUTTest.java /* * Copyright (c) 2002 Light Weight Java Game Library Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Light Weight Java Game Library' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.openal.test; import org.lwjgl.openal.AL; import org.lwjgl.openal.ALC; import org.lwjgl.openal.ALCcontext; import org.lwjgl.openal.ALCdevice; import org.lwjgl.openal.ALUT; import org.lwjgl.openal.ALUTLoadWAVData; import java.io.*; import java.net.*; /** * $Id: ALUTTest.java,v 1.1 2002/08/27 23:30:21 matzon Exp $ * * This is a basic play test using ALUT * Yes, over zealous use of getError ;) * * @author Brian Matzon <br...@ma...> * @version $Revision: 1.1 $ */ public class ALUTTest extends BasicTest { /** * Creates an instance of ALUTTest */ public ALUTTest() { super(); } /** * Runs the actual test, using supplied arguments */ protected void execute(String[] args) { if(args.length < 1) { System.out.println("please specify filename to play"); return; } int lastError; //initialize AL, using ALUT alut.init(args); //create 1 buffer and 1 source int[] buffers = new int[1]; int[] sources = new int[1]; // al generate buffers and sources al.genBuffers(1, buffers); if((lastError = al.getError()) != AL.NO_ERROR) { exit(lastError); } al.genSources(1, sources); if((lastError = al.getError()) != AL.NO_ERROR) { exit(lastError); } //load wave data ALUTLoadWAVData file = alut.loadWAVFile(args[0]); if((lastError = al.getError()) != AL.NO_ERROR) { exit(lastError); } //copy to buffers al.bufferData(buffers[0], file.format, file.data, file.size, file.freq); if((lastError = al.getError()) != AL.NO_ERROR) { exit(lastError); } //unload file again alut.unloadWAV(file.format, file.data, file.size, file.freq); if((lastError = al.getError()) != AL.NO_ERROR) { exit(lastError); } //set up source input al.sourcei(sources[0], AL.BUFFER, buffers[0]); if((lastError = al.getError()) != AL.NO_ERROR) { exit(lastError); } //lets loop the sound al.sourcei(sources[0], AL.LOOPING, AL.TRUE); if((lastError = al.getError()) != AL.NO_ERROR) { exit(lastError); } //play source 0 al.sourcePlay(sources[0]); if((lastError = al.getError()) != AL.NO_ERROR) { exit(lastError); } //wait 5 secs try { System.out.println("Waiting 5 seconds for sound to complete"); Thread.sleep(5000); } catch (InterruptedException inte) { } //stop source 0 al.sourceStop(sources[0]); if((lastError = al.getError()) != AL.NO_ERROR) { exit(lastError); } //delete buffers and sources al.deleteSources(1, sources); if((lastError = al.getError()) != AL.NO_ERROR) { exit(lastError); } al.deleteBuffers(1, buffers); if((lastError = al.getError()) != AL.NO_ERROR) { exit(lastError); } //shutdown using ALUT alut.exit(); } /** * main entry point * * @param args String array containing arguments */ public static void main(String[] args) { ALUTTest alutTest = new ALUTTest(); alutTest.execute(args); } } |
From: Brian M. <ma...@us...> - 2002-08-27 23:28:54
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test In directory usw-pr-cvs1:/tmp/cvs-serv1564/org/lwjgl/openal/test Modified Files: PlayTest.java Log Message: add: mo javadoc Index: PlayTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test/PlayTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test/PlayTest.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- PlayTest.java 27 Aug 2002 17:48:30 -0000 1.4 +++ PlayTest.java 27 Aug 2002 23:28:52 -0000 1.5 @@ -57,7 +57,10 @@ public PlayTest() { super(); } - + + /** + * Runs the actual test, using supplied arguments + */ protected void execute(String[] args) { if(args.length < 1) { System.out.println("please specify filename to play"); |
From: Brian M. <ma...@us...> - 2002-08-27 23:21:07
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test In directory usw-pr-cvs1:/tmp/cvs-serv31220/org/lwjgl/openal/test Modified Files: ALCTest.java Log Message: add: last test added. ALCTest complete sans some stuff that doesn't work on win32 - awaiting fix from OpenAL people Index: ALCTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test/ALCTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test/ALCTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ALCTest.java 27 Aug 2002 17:49:53 -0000 1.1 +++ ALCTest.java 27 Aug 2002 23:21:03 -0000 1.2 @@ -35,8 +35,10 @@ import org.lwjgl.openal.ALC; import org.lwjgl.openal.ALCcontext; import org.lwjgl.openal.ALCdevice; +import org.lwjgl.Sys; import java.nio.ByteBuffer; +import java.nio.ByteOrder; /** * $Id$ * @@ -69,17 +71,18 @@ } //create attribute list for context creation - ByteBuffer buffer = ByteBuffer.allocate(28); + ByteBuffer buffer = ByteBuffer.allocateDirect(28); + buffer.order(ByteOrder.nativeOrder()); buffer.putInt(ALC.FREQUENCY); buffer.putInt(44100); - buffer.putInt(ALC.SYNC); - buffer.putInt(ALC.FALSE); buffer.putInt(ALC.REFRESH); buffer.putInt(15); + buffer.putInt(ALC.SYNC); + buffer.putInt(ALC.FALSE); buffer.putInt(0); //terminating int - //create a context - context = alc.createContext(device, org.lwjgl.Sys.getDirectBufferAddress(buffer)); + //create a context, using above attributes + context = alc.createContext(device, Sys.getDirectBufferAddress(buffer)); if(context == null) { System.out.println("Unable to create context"); System.exit(-1); @@ -94,31 +97,27 @@ alc.makeContextCurrent(context); //process - //NOTE - weird bug exposed! - //calling alcProcessContext on a non suspended context hangs - //this is a OpenAL specific bug - not our code - //alc.processContext(context); + alc.processContext(context); //suspend alc.suspendContext(context); - //process again - alc.processContext(context); - //query System.out.println("DEFAULT_DEVICE_SPECIFIER: " + alc.getString(device, ALC.DEFAULT_DEVICE_SPECIFIER)); System.out.println("DEVICE_SPECIFIER: " + alc.getString(device, ALC.DEVICE_SPECIFIER)); System.out.println("EXTENSIONS: " + alc.getString(device, ALC.EXTENSIONS)); - //mo query - hmmmmm don't get alcGetIntegerv - /*buffer.rewind(); - alc.getIntegerv(device, ALC.MAJOR_VERSION, 32, org.lwjgl.Sys.getDirectBufferAddress(buffer)); + //mo query + buffer.rewind(); + alc.getIntegerv(device, ALC.MAJOR_VERSION, 4, Sys.getDirectBufferAddress(buffer)); + alc.getIntegerv(device, ALC.MINOR_VERSION, 4, Sys.getDirectBufferAddress(buffer)+4); + System.out.println("ALC_MAJOR_VERSION: " + buffer.getInt()); - - alc.getIntegerv(device, ALC.MINOR_VERSION, 4, org.lwjgl.Sys.getDirectBufferAddress(buffer)); System.out.println("ALC_MINOR_VERSION: " + buffer.getInt()); - */ + //no check for ALC_ALL_ATTRIBUTES / ALC_ATTRIBUTES_SIZE since it + //is buggy on win32 - my dev platform + //check current context ALCcontext currentContext = alc.getCurrentContext(); if(context.context != currentContext.context) { @@ -131,7 +130,10 @@ if(device.device != currentDevice.device) { System.out.println("Serious error! - device copy != current contexts device"); System.exit(-1); - } + } + + //get an enumerstion value + System.out.println("Value of ALC_MAJOR_VERSION: " + alc.getEnumValue(device, "ALC_MAJOR_VERSION")); //close context again alc.destroyContext(context); |
From: Brian M. <ma...@us...> - 2002-08-27 20:44:23
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory usw-pr-cvs1:/tmp/cvs-serv32316 Modified Files: checkALerror.h Log Message: fix: empty defines for !debug builds Index: checkALerror.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/checkALerror.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/checkALerror.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- checkALerror.h 26 Aug 2002 18:22:50 -0000 1.1 +++ checkALerror.h 27 Aug 2002 20:44:19 -0000 1.2 @@ -37,7 +37,8 @@ #else -#define CHECK_GL_ERROR +#define CHECK_AL_ERROR +#define CHECK_ALC_ERROR #endif /* _DEBUG */ |
From: Brian M. <ma...@us...> - 2002-08-27 20:42:51
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory usw-pr-cvs1:/tmp/cvs-serv31501 Modified Files: org_lwjgl_input_Keyboard.cpp Log Message: fix: made compile Index: org_lwjgl_input_Keyboard.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Keyboard.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Keyboard.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- org_lwjgl_input_Keyboard.cpp 17 Aug 2002 14:13:11 -0000 1.3 +++ org_lwjgl_input_Keyboard.cpp 27 Aug 2002 20:42:47 -0000 1.4 @@ -41,6 +41,8 @@ #define WIN32_LEAN_AND_MEAN #include <windows.h> +#undef DIRECTINPUT_VERSION +#define DIRECTINPUT_VERSION 0x0300 #include <dinput.h> #include "org_lwjgl_input_Keyboard.h" |
From: Brian M. <ma...@us...> - 2002-08-27 17:49:56
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test In directory usw-pr-cvs1:/tmp/cvs-serv20498/org/lwjgl/openal/test Added Files: ALCTest.java Log Message: first stab at ALC testing - Work In Progress --- NEW FILE: ALCTest.java --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test/ALCTest.java /* * Copyright (c) 2002 Light Weight Java Game Library Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Light Weight Java Game Library' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.openal.test; import org.lwjgl.openal.AL; import org.lwjgl.openal.ALC; import org.lwjgl.openal.ALCcontext; import org.lwjgl.openal.ALCdevice; import java.nio.ByteBuffer; /** * $Id: ALCTest.java,v 1.1 2002/08/27 17:49:53 matzon Exp $ * * This is a test for the ALC part of OpenAL * * @author Brian Matzon <br...@ma...> * @version $Revision: 1.1 $ */ public class ALCTest extends BasicTest { /** * Creates an instance of ALCTest */ public ALCTest() { super(); } /** * Runs the actual test, using supplied arguments */ protected void execute(String[] args) { //error stuff int lastError = ALC.NO_ERROR; //create a device device = alc.openDevice(null); if(device == null) { System.out.println("Unable to create device"); System.exit(-1); } //create attribute list for context creation ByteBuffer buffer = ByteBuffer.allocate(28); buffer.putInt(ALC.FREQUENCY); buffer.putInt(44100); buffer.putInt(ALC.SYNC); buffer.putInt(ALC.FALSE); buffer.putInt(ALC.REFRESH); buffer.putInt(15); buffer.putInt(0); //terminating int //create a context context = alc.createContext(device, org.lwjgl.Sys.getDirectBufferAddress(buffer)); if(context == null) { System.out.println("Unable to create context"); System.exit(-1); } if((lastError = alc.getError(device)) != ALC.NO_ERROR) { System.out.println("ALC Error: " + alc.getString(device, lastError)); System.exit(-1); } //make current alc.makeContextCurrent(context); //process //NOTE - weird bug exposed! //calling alcProcessContext on a non suspended context hangs //this is a OpenAL specific bug - not our code //alc.processContext(context); //suspend alc.suspendContext(context); //process again alc.processContext(context); //query System.out.println("DEFAULT_DEVICE_SPECIFIER: " + alc.getString(device, ALC.DEFAULT_DEVICE_SPECIFIER)); System.out.println("DEVICE_SPECIFIER: " + alc.getString(device, ALC.DEVICE_SPECIFIER)); System.out.println("EXTENSIONS: " + alc.getString(device, ALC.EXTENSIONS)); //mo query - hmmmmm don't get alcGetIntegerv /*buffer.rewind(); alc.getIntegerv(device, ALC.MAJOR_VERSION, 32, org.lwjgl.Sys.getDirectBufferAddress(buffer)); System.out.println("ALC_MAJOR_VERSION: " + buffer.getInt()); alc.getIntegerv(device, ALC.MINOR_VERSION, 4, org.lwjgl.Sys.getDirectBufferAddress(buffer)); System.out.println("ALC_MINOR_VERSION: " + buffer.getInt()); */ //check current context ALCcontext currentContext = alc.getCurrentContext(); if(context.context != currentContext.context) { System.out.println("Serious error! - context copy != current context"); System.exit(-1); } //check contexts device ALCdevice currentDevice = alc.getContextsDevice(context); if(device.device != currentDevice.device) { System.out.println("Serious error! - device copy != current contexts device"); System.exit(-1); } //close context again alc.destroyContext(context); //close it alc.closeDevice(device); } /** * main entry point * * @param args String array containing arguments */ public static void main(String[] args) { ALCTest alcTest = new ALCTest(); alcTest.execute(args); } } |
From: Brian M. <ma...@us...> - 2002-08-27 17:48:33
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test In directory usw-pr-cvs1:/tmp/cvs-serv19735/org/lwjgl/openal/test Modified Files: PlayTest.java Log Message: fix: update to spec recommendation (alcMakeContextCurrent before destroy) Index: PlayTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test/PlayTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test/PlayTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- PlayTest.java 26 Aug 2002 21:10:08 -0000 1.3 +++ PlayTest.java 27 Aug 2002 17:48:30 -0000 1.4 @@ -147,6 +147,7 @@ //no errorchecking from now on, since our context is gone. //shutdown + alc.makeContextCurrent(null); alc.destroyContext(context); alc.closeDevice(device); } |
From: Brian M. <ma...@us...> - 2002-08-27 17:45:44
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory usw-pr-cvs1:/tmp/cvs-serv18212 Modified Files: org_lwjgl_openal_ALC.cpp Log Message: fix: support alcMakeContextCurrent - as recommended in specs! Index: org_lwjgl_openal_ALC.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_openal_ALC.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_openal_ALC.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- org_lwjgl_openal_ALC.cpp 26 Aug 2002 22:16:25 -0000 1.6 +++ org_lwjgl_openal_ALC.cpp 27 Aug 2002 17:45:40 -0000 1.7 @@ -182,6 +182,10 @@ * ALCboolean alcMakeContextCurrent(ALCcontext *context); */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_ALC_makeContextCurrent (JNIEnv *env, jobject obj, jobject context) { + if(context == NULL) { + return alcMakeContextCurrent(NULL); + } + /* get context address */ jclass context_class = env->GetObjectClass(context); jfieldID context_field = env->GetFieldID(context_class, "context", "I"); |
From: Caspian Rychlik-P. <ci...@us...> - 2002-08-26 22:24:01
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl In directory usw-pr-cvs1:/tmp/cvs-serv15124/src/java/org/lwjgl Modified Files: Math.java Log Message: Fixed more stuff Index: Math.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/Math.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/Math.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Math.java 26 Aug 2002 20:39:28 -0000 1.7 +++ Math.java 26 Aug 2002 22:23:59 -0000 1.8 @@ -81,7 +81,7 @@ protected MatrixOpClassification unsafe() { return this; } protected MatrixOpClassification safe() { return this; } protected MatrixOpClassification direct() { return this; } - protected MatrixOpClassification offset() { return this; } + boolean isSafe() { return false; } void execute( int leftSourceAddress, @@ -136,6 +136,7 @@ protected MatrixOpClassification unsafe() { return MATRIXOP_UNSAFE; } protected MatrixOpClassification safe() { return MATRIXOP_SAFE; } protected MatrixOpClassification direct() { return MATRIXOP_DIRECT; } + boolean isSafe() { return false; } }; /** @@ -146,6 +147,7 @@ protected MatrixOpClassification unsafe() { return MATRIXOP_UNSAFE; } protected MatrixOpClassification safe() { return this; } protected MatrixOpClassification direct() { return this; } + boolean isSafe() { return false; } native void execute( int sourceAddress, int sourceStride, @@ -167,6 +169,7 @@ protected MatrixOpClassification unsafe() { return MATRIXOP_UNSAFE; } protected MatrixOpClassification safe() { return MATRIXOP_SAFE; } protected MatrixOpClassification direct() { return MATRIXOP_DIRECT; } + boolean isSafe() { return true; } native void execute( int sourceAddress, int sourceStride, @@ -200,6 +203,7 @@ protected MatrixOpClassification unsafe() { return MATRIXOP_UNSAFE; } protected MatrixOpClassification safe() { return MATRIXOP_SAFE; } protected MatrixOpClassification direct() { return MATRIXOP_DIRECT; } + boolean isSafe() { return false; } }; /** @@ -210,6 +214,7 @@ protected MatrixOpClassification unsafe() { return MATRIXOP_UNSAFE; } protected MatrixOpClassification safe() { return this; } protected MatrixOpClassification direct() { return this; } + boolean isSafe() { return false; } native void execute( int sourceAddress, int sourceStride, @@ -231,6 +236,7 @@ protected MatrixOpClassification unsafe() { return MATRIXOP_UNSAFE; } protected MatrixOpClassification safe() { return MATRIXOP_SAFE; } protected MatrixOpClassification direct() { return MATRIXOP_DIRECT; } + boolean isSafe() { return true; } native void execute( int sourceAddress, int sourceStride, @@ -264,6 +270,7 @@ protected MatrixOpClassification unsafe() { return MATRIXOP_UNSAFE; } protected MatrixOpClassification safe() { return MATRIXOP_SAFE; } protected MatrixOpClassification direct() { return MATRIXOP_DIRECT; } + boolean isSafe() { return true; } }; /** @@ -274,6 +281,7 @@ protected MatrixOpClassification unsafe() { return MATRIXOP_UNSAFE; } protected MatrixOpClassification safe() { return this; } protected MatrixOpClassification direct() { return this; } + boolean isSafe() { return false; } native void execute( int sourceAddress, int sourceStride, @@ -295,6 +303,7 @@ protected MatrixOpClassification unsafe() { return MATRIXOP_UNSAFE; } protected MatrixOpClassification safe() { return MATRIXOP_SAFE; } protected MatrixOpClassification direct() { return MATRIXOP_DIRECT; } + boolean isSafe() { return true; } native void execute( int sourceAddress, int sourceStride, @@ -328,6 +337,7 @@ protected MatrixOpClassification unsafe() { return MATRIXOP_UNSAFE; } protected MatrixOpClassification safe() { return MATRIXOP_SAFE; } protected MatrixOpClassification direct() { return MATRIXOP_DIRECT; } + boolean isSafe() { return false; } }; /** @@ -338,6 +348,7 @@ protected MatrixOpClassification unsafe() { return MATRIXOP_UNSAFE; } protected MatrixOpClassification safe() { return this; } protected MatrixOpClassification direct() { return this; } + boolean isSafe() { return false; } native void execute( int sourceAddress, int sourceStride, @@ -359,6 +370,7 @@ protected MatrixOpClassification unsafe() { return MATRIXOP_UNSAFE; } protected MatrixOpClassification safe() { return MATRIXOP_SAFE; } protected MatrixOpClassification direct() { return MATRIXOP_DIRECT; } + boolean isSafe() { return true; } native void execute( int sourceAddress, int sourceStride, @@ -448,6 +460,7 @@ protected MatrixOpClassification unsafe() { return MATRIXOP_UNSAFE; } protected MatrixOpClassification safe() { return MATRIXOP_SAFE; } protected MatrixOpClassification direct() { return MATRIXOP_DIRECT; } + boolean isSafe() { return false; } }; /** @@ -458,6 +471,7 @@ protected MatrixOpClassification unsafe() { return MATRIXOP_UNSAFE; } protected MatrixOpClassification safe() { return this; } protected MatrixOpClassification direct() { return this; } + boolean isSafe() { return false; } native void execute( int leftSourceAddress, int leftSourceStride, @@ -486,6 +500,7 @@ protected MatrixOpClassification unsafe() { return MATRIXOP_UNSAFE; } protected MatrixOpClassification safe() { return MATRIXOP_SAFE; } protected MatrixOpClassification direct() { return MATRIXOP_DIRECT; } + boolean isSafe() { return true; } native void execute( int leftSourceAddress, int leftSourceStride, @@ -546,6 +561,7 @@ protected MatrixOpClassification unsafe() { return MATRIXOP_UNSAFE; } protected MatrixOpClassification safe() { return MATRIXOP_SAFE; } protected MatrixOpClassification direct() { return MATRIXOP_DIRECT; } + boolean isSafe() { return false; } }; /** @@ -556,6 +572,7 @@ protected MatrixOpClassification unsafe() { return MATRIXOP_UNSAFE; } protected MatrixOpClassification safe() { return this; } protected MatrixOpClassification direct() { return this; } + boolean isSafe() { return false; } native void execute( int leftSourceAddress, int leftSourceStride, @@ -584,6 +601,7 @@ protected MatrixOpClassification unsafe() { return MATRIXOP_UNSAFE; } protected MatrixOpClassification safe() { return MATRIXOP_SAFE; } protected MatrixOpClassification direct() { return MATRIXOP_DIRECT; } + boolean isSafe() { return true; } native void execute( int leftSourceAddress, int leftSourceStride, @@ -643,6 +661,7 @@ protected MatrixOpClassification unsafe() { return MATRIXOP_UNSAFE; } protected MatrixOpClassification safe() { return MATRIXOP_SAFE; } protected MatrixOpClassification direct() { return MATRIXOP_DIRECT; } + boolean isSafe() { return false; } }; /** @@ -653,6 +672,7 @@ protected MatrixOpClassification unsafe() { return MATRIXOP_UNSAFE; } protected MatrixOpClassification safe() { return this; } protected MatrixOpClassification direct() { return this; } + boolean isSafe() { return false; } native void execute( int leftSourceAddress, int leftSourceStride, @@ -681,6 +701,7 @@ protected MatrixOpClassification unsafe() { return MATRIXOP_UNSAFE; } protected MatrixOpClassification safe() { return MATRIXOP_SAFE; } protected MatrixOpClassification direct() { return MATRIXOP_DIRECT; } + boolean isSafe() { return true; } native void execute( int leftSourceAddress, int leftSourceStride, @@ -830,14 +851,42 @@ * be safe; otherwise if is direct, then the side where n > 1 must be * the destination. */ - abstract MatrixOpClassification checkBinaryOp( + MatrixOpClassification checkBinaryOp( int leftSourceElements, int rightSourceElements, int leftSourceAddress, int rightSourceAddress, int destinationAddress - ); + ) { + + if (leftSourceElements > 1 && rightSourceElements > 1) { + if (isSafe()) + return this; + else + return MATRIXOP_UNSAFE; + } else if (leftSourceElements == 1 && rightSourceElements > 1) { + if (isSafe()) + return this; + else if (destinationAddress == rightSourceAddress) + return this; + else + return MATRIXOP_UNSAFE; + } else if (rightSourceElements == 1 && leftSourceElements > 1) { + if (isSafe()) + return this; + else if (destinationAddress == leftSourceAddress) + return this; + else + return MATRIXOP_UNSAFE; + } else { + return MATRIXOP_UNSAFE; + } + } + /** + * @return true if this is a safe classification + */ + abstract boolean isSafe(); public final MatrixOpClassification check( int sourceAddress, |
From: Brian M. <ma...@us...> - 2002-08-26 22:16:30
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory usw-pr-cvs1:/tmp/cvs-serv12880 Modified Files: org_lwjgl_openal_ALC.cpp Log Message: fix: NULL check in getString fix: wrong object being used when retrieving fields Index: org_lwjgl_openal_ALC.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_openal_ALC.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_openal_ALC.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- org_lwjgl_openal_ALC.cpp 26 Aug 2002 21:28:30 -0000 1.5 +++ org_lwjgl_openal_ALC.cpp 26 Aug 2002 22:16:25 -0000 1.6 @@ -53,9 +53,14 @@ JNIEXPORT jstring JNICALL Java_org_lwjgl_openal_ALC_getString (JNIEnv *env, jobject obj, jobject device, jint token) { jclass class_device = env->GetObjectClass(device); jfieldID field_device = env->GetFieldID(class_device, "device", "I"); - jint deviceaddress = env->GetIntField(obj, field_device); + jint deviceaddress = env->GetIntField(device, field_device); - jstring string = env->NewStringUTF((const char*) alcGetString((ALCdevice*) deviceaddress, (ALenum) token)); + const char* alcString = (const char*) alcGetString((ALCdevice*) deviceaddress, (ALenum) token); + if(alcString == NULL) { + return NULL; + } + + jstring string = env->NewStringUTF(alcString); CHECK_ALC_ERROR return string; @@ -70,7 +75,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_getIntegerv (JNIEnv *env, jobject obj, jobject device, jint token, jint size, jint dest) { jclass device_class = env->GetObjectClass(device); jfieldID device_field = env->GetFieldID(device_class, "device", "I"); - jint deviceaddress = env->GetIntField(obj, device_field); + jint deviceaddress = env->GetIntField(device, device_field); alcGetIntegerv((ALCdevice*) deviceaddress, (ALenum) token, (ALsizei) size, (ALint*) dest); CHECK_ALC_ERROR |
From: Brian M. <ma...@us...> - 2002-08-26 21:28:37
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory usw-pr-cvs1:/tmp/cvs-serv29317 Modified Files: org_lwjgl_openal_ALC.cpp Log Message: fix: allow null to be passed to openDevice Index: org_lwjgl_openal_ALC.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_openal_ALC.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_openal_ALC.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- org_lwjgl_openal_ALC.cpp 26 Aug 2002 18:23:10 -0000 1.4 +++ org_lwjgl_openal_ALC.cpp 26 Aug 2002 21:28:30 -0000 1.5 @@ -83,14 +83,22 @@ * ALCdevice *alcOpenDevice( const ALubyte *tokstr ); */ JNIEXPORT jobject JNICALL Java_org_lwjgl_openal_ALC_openDevice (JNIEnv *env, jobject obj, jstring tokstr) { - ALubyte* tokenstring = (ALubyte*) (env->GetStringUTFChars(tokstr, 0)); + ALubyte* tokenstring; + + if(tokstr != NULL) { + tokenstring = (ALubyte*) (env->GetStringUTFChars(tokstr, 0)); + } else { + tokenstring = NULL; + } /* get device */ ALCdevice* device = alcOpenDevice(tokenstring); /* if error - cleanup and get out */ if(device == NULL) { - env->ReleaseStringUTFChars((jstring)tokenstring, 0); + if(tokenstring != NULL) { + env->ReleaseStringUTFChars((jstring)tokenstring, 0); + } return NULL; } |
From: Caspian Rychlik-P. <ci...@us...> - 2002-08-26 21:17:57
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory usw-pr-cvs1:/tmp/cvs-serv25836/src/java/org/lwjgl/opengl Modified Files: GL.java GLUConstants.java Log Message: *** keyword substitution change *** Index: GL.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/GL.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/GL.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 Index: GLUConstants.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/GLUConstants.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/GLUConstants.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 |
From: Brian M. <ma...@us...> - 2002-08-26 21:10:12
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test In directory usw-pr-cvs1:/tmp/cvs-serv23306/org/lwjgl/openal/test Modified Files: PlayTest.java Added Files: BasicTest.java Log Message: add: new basic test class to make testing easier mod: PlayTest now inherits from BasicTest --- NEW FILE: BasicTest.java --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test/BasicTest.java /* * Copyright (c) 2002 Light Weight Java Game Library Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Light Weight Java Game Library' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.openal.test; import org.lwjgl.openal.AL; import org.lwjgl.openal.ALC; import org.lwjgl.openal.ALCcontext; import org.lwjgl.openal.ALCdevice; import org.lwjgl.openal.ALUT; /** * $Id: BasicTest.java,v 1.1 2002/08/26 21:10:08 matzon Exp $ * * This is a basic test, which contains the most used stuff * * @author Brian Matzon <br...@ma...> * @version $Revision: 1.1 $ */ public abstract class BasicTest { /** OpenAL instance */ protected AL al; /** OpenAL Context instance */ protected ALC alc; /** OpenAL Util library instance */ protected ALUT alut; /** OpenAL context */ protected ALCcontext context; /** OpenAL device */ protected ALCdevice device; /** * Creates an instance of PlayTest */ public BasicTest() { al = new AL(); alc = new ALC(); alut = new ALUT(); } /** * Initializes OpenAL */ protected void alInitialize() { //get default device device = alc.openDevice(""); if(device == null) { throw new RuntimeException("Error creating device"); } //create context (no attributes specified) context = alc.createContext(device, 0); if(context == null) { throw new RuntimeException("Error creating context"); } //make context current alc.makeContextCurrent(context); if(alc.getError(device) != ALC.NO_ERROR) { throw new RuntimeException("An error occurred while making context current"); } } /** * Exits the test NOW, printing errorcode to stdout * * @param error Error code causing exit */ protected void exit(int error) { System.out.println("OpenAL Error: " + al.getString(error)); alut.exit(); System.exit(-1); } } Index: PlayTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test/PlayTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test/PlayTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- PlayTest.java 26 Aug 2002 20:17:55 -0000 1.2 +++ PlayTest.java 26 Aug 2002 21:10:08 -0000 1.3 @@ -49,30 +49,13 @@ * @author Brian Matzon <br...@ma...> * @version $Revision$ */ -public class PlayTest { - - /** OpenAL instance */ - protected AL al; - - /** OpenAL Context instance */ - protected ALC alc; - - /** OpenAL Util library instance */ - protected ALUT alut; - - /** OpenAL context */ - protected ALCcontext context; - - /** OpenAL device */ - protected ALCdevice device; +public class PlayTest extends BasicTest { /** * Creates an instance of PlayTest */ public PlayTest() { - al = new AL(); - alc = new ALC(); - alut = new ALUT(); + super(); } protected void execute(String[] args) { @@ -166,36 +149,6 @@ //shutdown alc.destroyContext(context); alc.closeDevice(device); - } - - /** - * Initializes OpenAL - */ - protected void alInitialize() { - - //get default device - device = alc.openDevice(""); - if(device == null) { - throw new RuntimeException("Error creating device"); - } - - //create context (no attributes specified) - context = alc.createContext(device, 0); - if(context == null) { - throw new RuntimeException("Error creating context"); - } - - //make context current - alc.makeContextCurrent(context); - if(alc.getError(device) != ALC.NO_ERROR) { - throw new RuntimeException("An error occurred while making context current"); - } - } - - protected void exit(int error) { - System.out.println("OpenAL Error: " + al.getString(error)); - alut.exit(); - System.exit(-1); } /** |
From: Caspian Rychlik-P. <ci...@us...> - 2002-08-26 21:05:23
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input In directory usw-pr-cvs1:/tmp/cvs-serv20858/src/java/org/lwjgl/input Modified Files: GamePad.java Joystick.java Mouse.java Keyboard.java Log Message: *** keyword substitution change *** Index: GamePad.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/input/GamePad.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input/GamePad.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 Index: Joystick.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/input/Joystick.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input/Joystick.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 Index: Mouse.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/input/Mouse.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input/Mouse.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 Index: Keyboard.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/input/Keyboard.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input/Keyboard.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 |
From: Brian M. <ma...@us...> - 2002-08-26 20:57:21
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory usw-pr-cvs1:/tmp/cvs-serv17475 Modified Files: GLUConstants.java Log Message: fix: removed double ; Index: GLUConstants.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/GLUConstants.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/GLUConstants.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- GLUConstants.java 15 Aug 2002 16:18:12 -0000 1.5 +++ GLUConstants.java 26 Aug 2002 20:57:18 -0000 1.6 @@ -74,7 +74,7 @@ public static final int INSIDE = 100021; /* Callback types: */ - /* ERROR = 100103 */; + /* ERROR = 100103 */ /**** Tesselation constants ****/ @@ -158,12 +158,12 @@ public static final int MAP1_TRIM_3 = 100211; /* NurbsDisplay */ - /* FILL = 100012 */; + /* FILL = 100012 */ public static final int OUTLINE_POLYGON = 100240; public static final int OUTLINE_PATCH = 100241; /* NurbsCallback */ - /* ERROR = 100103 */; + /* ERROR = 100103 */ /* NurbsErrors */ public static final int NURBS_ERROR1 = 100251; |
From: Brian M. <ma...@us...> - 2002-08-26 20:56:47
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory usw-pr-cvs1:/tmp/cvs-serv17297 Modified Files: GL.java Log Message: fix: removed double ; Index: GL.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/GL.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/GL.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- GL.java 24 Aug 2002 21:15:03 -0000 1.7 +++ GL.java 26 Aug 2002 20:56:42 -0000 1.8 @@ -1490,7 +1490,7 @@ public boolean ATI_fragment_shader; public boolean ATI_pn_triangles; public boolean ATI_texture_mirror_once; - public boolean ATI_vertex_array_object;; + public boolean ATI_vertex_array_object; public boolean ATI_vertex_streams; public boolean ATIX_point_sprites; public boolean ATIX_texture_env_route; |
From: Caspian Rychlik-P. <ci...@us...> - 2002-08-26 20:39:31
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl In directory usw-pr-cvs1:/tmp/cvs-serv11804/src/java/org/lwjgl Modified Files: Math.java Log Message: This n that Index: Math.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/Math.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/Math.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Math.java 23 Aug 2002 16:14:21 -0000 1.6 +++ Math.java 26 Aug 2002 20:39:28 -0000 1.7 @@ -405,6 +405,8 @@ boolean transposeRightSource, boolean transposeDest); + + abstract MatrixOpClassification classify(); } @@ -822,6 +824,21 @@ boolean transposeDest) { } + /** + * Check a binary operation to make sure that when dealing with n x n + * result sets that when both n's are greater than 1 the operation must + * be safe; otherwise if is direct, then the side where n > 1 must be + * the destination. + */ + abstract MatrixOpClassification checkBinaryOp( + int leftSourceElements, + int rightSourceElements, + int leftSourceAddress, + int rightSourceAddress, + int destinationAddress + ); + + public final MatrixOpClassification check( int sourceAddress, int sourceStride, @@ -1014,6 +1031,7 @@ // Check unary matrix operation type MatrixOpClassification op = operation.classify().check(leftSourceAddress, leftSourceStride, leftElements, destAddress, destStride); op = op.check(rightSourceAddress, rightSourceStride, rightElements, destAddress, destStride); + op = op.checkBinaryOp(leftElements, rightElements, leftSourceAddress, rightSourceAddress, destAddress); op.execute( leftSourceAddress, leftSourceStride, |
From: Caspian Rychlik-P. <ci...@us...> - 2002-08-26 20:24:32
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/vector In directory usw-pr-cvs1:/tmp/cvs-serv6851/src/java/org/lwjgl/vector Modified Files: Vector3f.java Matrix2f.java Matrix4f.java Vector2f.java Vector.java Vector4f.java Matrix3f.java Matrix.java Log Message: *** keyword substitution change *** Index: Vector3f.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Vector3f.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Vector3f.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 Index: Matrix2f.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Matrix2f.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Matrix2f.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 Index: Matrix4f.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Matrix4f.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Matrix4f.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 Index: Vector2f.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Vector2f.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Vector2f.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 Index: Vector.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Vector.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Vector.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 Index: Vector4f.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Vector4f.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Vector4f.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 Index: Matrix3f.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Matrix3f.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Matrix3f.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 Index: Matrix.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Matrix.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Matrix.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 |
From: Brian M. <ma...@us...> - 2002-08-26 20:18:00
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test In directory usw-pr-cvs1:/tmp/cvs-serv4563/org/lwjgl/openal/test Modified Files: PlayTest.java Log Message: add: javadoc comment on getError Index: PlayTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test/PlayTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test/PlayTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- PlayTest.java 26 Aug 2002 19:53:21 -0000 1.1 +++ PlayTest.java 26 Aug 2002 20:17:55 -0000 1.2 @@ -44,6 +44,7 @@ * $Id$ * * This is a basic play test + * Yes, over zealous use of getError ;) * * @author Brian Matzon <br...@ma...> * @version $Revision$ |
From: Brian M. <ma...@us...> - 2002-08-26 19:53:26
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test In directory usw-pr-cvs1:/tmp/cvs-serv27549 Added Files: PlayTest.java Log Message: initial import of first basic test (wee) --- NEW FILE: PlayTest.java --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test/PlayTest.java /* * Copyright (c) 2002 Light Weight Java Game Library Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Light Weight Java Game Library' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.lwjgl.openal.test; import org.lwjgl.openal.AL; import org.lwjgl.openal.ALC; import org.lwjgl.openal.ALCcontext; import org.lwjgl.openal.ALCdevice; import org.lwjgl.openal.ALUT; import org.lwjgl.openal.ALUTLoadWAVData; import java.io.*; import java.net.*; /** * $Id: PlayTest.java,v 1.1 2002/08/26 19:53:21 matzon Exp $ * * This is a basic play test * * @author Brian Matzon <br...@ma...> * @version $Revision: 1.1 $ */ public class PlayTest { /** OpenAL instance */ protected AL al; /** OpenAL Context instance */ protected ALC alc; /** OpenAL Util library instance */ protected ALUT alut; /** OpenAL context */ protected ALCcontext context; /** OpenAL device */ protected ALCdevice device; /** * Creates an instance of PlayTest */ public PlayTest() { al = new AL(); alc = new ALC(); alut = new ALUT(); } protected void execute(String[] args) { if(args.length < 1) { System.out.println("please specify filename to play"); return; } int lastError; //initialize AL, using ALC alInitialize(); //create 1 buffer and 1 source int[] buffers = new int[1]; int[] sources = new int[1]; // al generate buffers and sources al.genBuffers(1, buffers); if((lastError = al.getError()) != AL.NO_ERROR) { exit(lastError); } al.genSources(1, sources); if((lastError = al.getError()) != AL.NO_ERROR) { exit(lastError); } //load wave data ALUTLoadWAVData file = alut.loadWAVFile(args[0]); if((lastError = al.getError()) != AL.NO_ERROR) { exit(lastError); } //copy to buffers al.bufferData(buffers[0], file.format, file.data, file.size, file.freq); if((lastError = al.getError()) != AL.NO_ERROR) { exit(lastError); } //unload file again alut.unloadWAV(file.format, file.data, file.size, file.freq); if((lastError = al.getError()) != AL.NO_ERROR) { exit(lastError); } //set up source input al.sourcei(sources[0], AL.BUFFER, buffers[0]); if((lastError = al.getError()) != AL.NO_ERROR) { exit(lastError); } //lets loop the sound al.sourcei(sources[0], AL.LOOPING, AL.TRUE); if((lastError = al.getError()) != AL.NO_ERROR) { exit(lastError); } //play source 0 al.sourcePlay(sources[0]); if((lastError = al.getError()) != AL.NO_ERROR) { exit(lastError); } //wait 5 secs try { System.out.println("Waiting 5 seconds for sound to complete"); Thread.sleep(5000); } catch (InterruptedException inte) { } //stop source 0 al.sourceStop(sources[0]); if((lastError = al.getError()) != AL.NO_ERROR) { exit(lastError); } //delete buffers and sources al.deleteSources(1, sources); if((lastError = al.getError()) != AL.NO_ERROR) { exit(lastError); } al.deleteBuffers(1, buffers); if((lastError = al.getError()) != AL.NO_ERROR) { exit(lastError); } //no errorchecking from now on, since our context is gone. //shutdown alc.destroyContext(context); alc.closeDevice(device); } /** * Initializes OpenAL */ protected void alInitialize() { //get default device device = alc.openDevice(""); if(device == null) { throw new RuntimeException("Error creating device"); } //create context (no attributes specified) context = alc.createContext(device, 0); if(context == null) { throw new RuntimeException("Error creating context"); } //make context current alc.makeContextCurrent(context); if(alc.getError(device) != ALC.NO_ERROR) { throw new RuntimeException("An error occurred while making context current"); } } protected void exit(int error) { System.out.println("OpenAL Error: " + al.getString(error)); alut.exit(); System.exit(-1); } /** * main entry point * * @param args String array containing arguments */ public static void main(String[] args) { PlayTest playTest = new PlayTest(); playTest.execute(args); } } |