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
|
From: Brian M. <ma...@us...> - 2002-08-26 18:29:11
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test In directory usw-pr-cvs1:/tmp/cvs-serv32479/test Log Message: Directory /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/test added to the repository |
From: Brian M. <ma...@us...> - 2002-08-26 18:23:14
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory usw-pr-cvs1:/tmp/cvs-serv30337 Modified Files: org_lwjgl_openal_ALC.cpp org_lwjgl_openal_ALUT.cpp org_lwjgl_openal_CoreAL.cpp Log Message: add: macro AL error checking 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.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- org_lwjgl_openal_ALC.cpp 26 Aug 2002 15:07:31 -0000 1.3 +++ org_lwjgl_openal_ALC.cpp 26 Aug 2002 18:23:10 -0000 1.4 @@ -39,6 +39,7 @@ * @version $Revision$ */ #include "org_lwjgl_openal_ALC.h" +#include "checkALerror.h" /* OpenAL includes */ #include <alc.h> @@ -54,7 +55,10 @@ jfieldID field_device = env->GetFieldID(class_device, "device", "I"); jint deviceaddress = env->GetIntField(obj, field_device); - return env->NewStringUTF((const char*) alcGetString((ALCdevice*) deviceaddress, (ALenum) token)); + jstring string = env->NewStringUTF((const char*) alcGetString((ALCdevice*) deviceaddress, (ALenum) token)); + + CHECK_ALC_ERROR + return string; } /** @@ -69,6 +73,7 @@ jint deviceaddress = env->GetIntField(obj, device_field); alcGetIntegerv((ALCdevice*) deviceaddress, (ALenum) token, (ALsizei) size, (ALint*) dest); + CHECK_ALC_ERROR } /** @@ -119,6 +124,7 @@ jint deviceaddress = env->GetIntField(device, device_field); alcCloseDevice((ALCdevice*) deviceaddress); + CHECK_ALC_ERROR } /** @@ -152,6 +158,7 @@ /* create instance */ alcContext_object = env->NewObject(alcContext_class, alcContext_method, (int) context); + CHECK_ALC_ERROR return alcContext_object; } @@ -288,7 +295,9 @@ jfieldID device_field = env->GetFieldID(device_class, "device", "I"); jint deviceaddress = env->GetIntField(device, device_field); - return (jint) alcGetError((ALCdevice*) deviceaddress); + jint result = alcGetError((ALCdevice*) deviceaddress); + CHECK_ALC_ERROR + return result; } /** @@ -310,6 +319,7 @@ env->ReleaseStringUTFChars((jstring)functionname, 0); + CHECK_ALC_ERROR return result; } @@ -332,6 +342,7 @@ env->ReleaseStringUTFChars((jstring)functionname, 0); + CHECK_ALC_ERROR return result; } @@ -354,5 +365,6 @@ env->ReleaseStringUTFChars((jstring)enumerationname, 0); + CHECK_ALC_ERROR return result; } Index: org_lwjgl_openal_ALUT.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_openal_ALUT.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_openal_ALUT.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- org_lwjgl_openal_ALUT.cpp 18 Aug 2002 13:56:29 -0000 1.4 +++ org_lwjgl_openal_ALUT.cpp 26 Aug 2002 18:23:11 -0000 1.5 @@ -40,6 +40,7 @@ * @version $Revision$ */ #include "org_lwjgl_openal_ALUT.h" +#include "checkALerror.h" /* OpenAL includes */ #include <alut.h> @@ -79,6 +80,7 @@ /* call the actual implementation */ alutInit((ALint*) &argc,(char**) argv); + CHECK_AL_ERROR } /* * This function loads a WAV file into memory from a file. @@ -128,6 +130,7 @@ /* release chars */ env->ReleaseStringUTFChars((jstring)filename, 0); + CHECK_AL_ERROR return alutLoadWAVFile_object; } @@ -179,6 +182,7 @@ /* release bytearray again */ env->ReleaseByteArrayElements(buffer, (jbyte*) bufferlocation, 0); + CHECK_AL_ERROR return alutLoadWAVFile_object; } @@ -191,6 +195,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALUT_unloadWAV (JNIEnv *env, jobject obj, jint format, jint data, jint size, jint freq) { alutUnloadWAV(format, (void**) data, size, freq); + CHECK_AL_ERROR } /** @@ -201,4 +206,5 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALUT_exit (JNIEnv *env, jobject obj) { alutExit(); + CHECK_AL_ERROR } Index: org_lwjgl_openal_CoreAL.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_openal_CoreAL.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_openal_CoreAL.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- org_lwjgl_openal_CoreAL.cpp 19 Aug 2002 13:54:34 -0000 1.2 +++ org_lwjgl_openal_CoreAL.cpp 26 Aug 2002 18:23:11 -0000 1.3 @@ -40,6 +40,7 @@ * @version $Revision$ */ #include "org_lwjgl_openal_CoreAL.h" +#include "checkALerror.h" /* OpenAL includes */ #include <al.h> @@ -52,6 +53,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_enable (JNIEnv *env, jobject obj, jint capability) { alEnable((ALenum) capability); + CHECK_AL_ERROR } /** @@ -62,6 +64,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_disable (JNIEnv *env, jobject obj, jint capability) { alDisable((ALenum) capability); + CHECK_AL_ERROR } /** @@ -71,7 +74,10 @@ * Alboolean alIsEnabled(ALenum capability); */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_CoreAL_isEnabled (JNIEnv *env, jobject obj, jint capability) { - return (jboolean) alIsEnabled((ALenum) capability); + jboolean result = (jboolean) alIsEnabled((ALenum) capability); + + CHECK_AL_ERROR + return result; } /** @@ -94,7 +100,10 @@ * Alboolean alGetBoolean(ALenum pname); */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_CoreAL_getBoolean (JNIEnv *env, jobject obj, jint pname) { - return (jboolean) alGetBoolean((ALenum) pname); + jboolean result = (jboolean) alGetBoolean((ALenum) pname); + + CHECK_AL_ERROR + return result; } /** @@ -104,7 +113,10 @@ * Alint alGetInteger(ALenum pname); */ JNIEXPORT jint JNICALL Java_org_lwjgl_openal_CoreAL_getInteger (JNIEnv *env, jobject obj, jint pname) { - return (jint) alGetInteger((ALenum) pname); + jint result = (jint) alGetInteger((ALenum) pname); + + CHECK_AL_ERROR + return result; } /** @@ -114,7 +126,10 @@ * ALfloat alGetFloat(ALenum pname); */ JNIEXPORT jfloat JNICALL Java_org_lwjgl_openal_CoreAL_getFloat (JNIEnv *env, jobject obj, jint pname) { - return (jfloat) alGetFloat((ALenum) pname); + jfloat result = (jfloat) alGetFloat((ALenum) pname); + + CHECK_AL_ERROR + return result; } /** @@ -124,7 +139,10 @@ * Aldouble alGetDouble(ALenum pname); */ JNIEXPORT jdouble JNICALL Java_org_lwjgl_openal_CoreAL_getDouble (JNIEnv *env, jobject obj, jint pname) { - return (jdouble) alGetDouble((ALenum) pname); + jdouble result = (jdouble) alGetDouble((ALenum) pname); + + CHECK_AL_ERROR + return result; } /** @@ -135,6 +153,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_getBooleanv (JNIEnv *env, jobject obj, jint pname, jint data) { alGetBooleanv((ALenum) pname, (ALboolean*) data); + CHECK_AL_ERROR } /** @@ -145,6 +164,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_getIntegerv (JNIEnv *env, jobject obj, jint pname, jint data) { alGetIntegerv((ALenum) pname, (ALint*) data); + CHECK_AL_ERROR } /** @@ -155,6 +175,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_getFloatv (JNIEnv *env, jobject obj, jint pname, jint data) { alGetFloatv((ALenum) pname, (ALfloat*) data); + CHECK_AL_ERROR } /** @@ -165,6 +186,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_getDoublev (JNIEnv *env, jobject obj, jint pname, jint data) { alGetDoublev((ALenum) pname, (ALdouble*) data); + CHECK_AL_ERROR } /** @@ -174,7 +196,10 @@ * ALubyte * alGetString(ALenum pname); */ JNIEXPORT jstring JNICALL Java_org_lwjgl_openal_CoreAL_getString (JNIEnv *env, jobject obj, jint param) { - return env->NewStringUTF((const char*) alGetString((ALenum)param)); + jstring string = (jstring) env->NewStringUTF((const char*) alGetString((ALenum)param)); + + CHECK_AL_ERROR + return string; } /** @@ -184,7 +209,10 @@ * ALenum alGetError(ALvoid); */ JNIEXPORT jint JNICALL Java_org_lwjgl_openal_CoreAL_getError (JNIEnv *env, jobject obj) { - return (jint) alGetError(); + jint result = (jint) alGetError(); + + CHECK_AL_ERROR + return result; } /** @@ -198,6 +226,7 @@ jboolean result = (jboolean) alIsExtensionPresent(functionname); env->ReleaseStringUTFChars((jstring)functionname, 0); + CHECK_AL_ERROR return result; } @@ -212,6 +241,7 @@ jint result = (jint) alGetProcAddress(functionname); env->ReleaseStringUTFChars((jstring)functionname, 0); + CHECK_AL_ERROR return result; } @@ -226,6 +256,7 @@ jint result = (jint) alGetEnumValue(functionname); env->ReleaseStringUTFChars((jstring)functionname, 0); + CHECK_AL_ERROR return result; } @@ -237,6 +268,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_listeneri (JNIEnv *env, jobject obj, jint pname, jint value) { alListeneri((ALenum) pname, (ALint) value); + CHECK_AL_ERROR } /** @@ -247,6 +279,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_listenerf (JNIEnv *env, jobject obj, jint pname, jfloat value) { alListenerf((ALenum) pname, (ALfloat) value); + CHECK_AL_ERROR } /** @@ -257,6 +290,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_listener3f (JNIEnv *env, jobject obj, jint pname, jfloat v1, jfloat v2, jfloat v3) { alListener3f((ALenum) pname, (ALfloat) v1, (ALfloat) v2, (ALfloat) v3); + CHECK_AL_ERROR } /** @@ -267,6 +301,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_listenerfv (JNIEnv *env, jobject obj, jint pname, jint values) { alListenerfv((ALenum) pname, (ALfloat*) values); + CHECK_AL_ERROR } /** @@ -277,6 +312,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_getListeneri (JNIEnv *env, jobject obj, jint pname, jint value) { alGetListeneri((ALenum) pname, (ALint*) value); + CHECK_AL_ERROR } /** @@ -287,6 +323,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_getListenerf (JNIEnv *env, jobject obj, jint pname, jint value) { alGetListenerf((ALenum) pname, (ALfloat*) value); + CHECK_AL_ERROR } /** @@ -297,6 +334,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_getListener3f (JNIEnv *env, jobject obj, jint pname, jint v1, jint v2, jint v3) { alGetListener3f((ALenum) pname, (ALfloat*) v1, (ALfloat*) v2, (ALfloat*) v3); + CHECK_AL_ERROR } /** @@ -307,6 +345,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_getListenerfv (JNIEnv *env, jobject obj, jint pname, jint values) { alGetListenerfv((ALenum) pname, (ALfloat*) values); + CHECK_AL_ERROR } /** @@ -319,6 +358,7 @@ int* array = (int*) env->GetIntArrayElements(sources, 0); alGenSources(n, (ALuint*) array); env->ReleaseIntArrayElements(sources, (jint*) array, 0); + CHECK_AL_ERROR } /** @@ -331,6 +371,7 @@ int* array = (int*) env->GetIntArrayElements(source, 0); alDeleteSources(n, (ALuint*) array); env->ReleaseIntArrayElements(source, (jint*) array, 0); + CHECK_AL_ERROR } /** @@ -340,7 +381,10 @@ * Alboolean alIsSource(ALuint source); */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_CoreAL_isSource (JNIEnv *env, jobject obj, jint source) { - return (jboolean) alIsSource((ALuint) source); + jboolean result = (jboolean) alIsSource((ALuint) source); + + CHECK_AL_ERROR + return result; } /** @@ -351,6 +395,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_sourcei (JNIEnv *env, jobject obj, jint source, jint pname, jint value) { alSourcei((ALuint) source, (ALenum) pname, (ALint) value); + CHECK_AL_ERROR } /** @@ -361,6 +406,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_sourcef (JNIEnv *env, jobject obj, jint source, jint pname, jfloat value) { alSourcef((ALuint) source, (ALenum) pname, (ALfloat) value); + CHECK_AL_ERROR } /** @@ -370,6 +416,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_source3f (JNIEnv *env, jobject obj, jint source, jint pname, jfloat v1, jfloat v2, jfloat v3) { alSource3f((ALuint) source, (ALenum) pname, (ALfloat) v1, (ALfloat) v2, (ALfloat) v3); + CHECK_AL_ERROR } /** @@ -380,6 +427,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_sourcefv (JNIEnv *env, jobject obj, jint source, jint pname, jint values) { alSourcefv((ALuint) source, (ALenum) pname, (ALfloat*) values); + CHECK_AL_ERROR } /** @@ -389,6 +437,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_getSourcei (JNIEnv *env, jobject obj, jint source, jint pname, jint value) { alGetSourcei((ALuint) source, (ALenum) pname, (ALint*) value); + CHECK_AL_ERROR } /** @@ -399,6 +448,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_getSourcef (JNIEnv *env, jobject obj, jint source, jint pname, jint value) { alGetSourcef((ALuint) source, (ALenum) pname, (ALfloat*) value); + CHECK_AL_ERROR } /* @@ -409,6 +459,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_getSource3f (JNIEnv *env, jobject obj, jint source, jint pname, jint v1, jint v2, jint v3) { alGetSource3f((ALuint) source, (ALenum) pname, (ALfloat*) v1, (ALfloat*) v2, (ALfloat*) v3); + CHECK_AL_ERROR } /** @@ -419,6 +470,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_getSourcefv (JNIEnv *env, jobject obj, jint source, jint pname, jint values) { alGetSourcefv((ALuint) source, (ALenum) pname, (ALfloat*) values); + CHECK_AL_ERROR } /** @@ -431,6 +483,7 @@ int* array = (int*) env->GetIntArrayElements(sources, 0); alSourcePlayv(n, (ALuint*) array); env->ReleaseIntArrayElements(sources, (jint*) array, 0); + CHECK_AL_ERROR } /** @@ -443,6 +496,7 @@ int* array = (int*) env->GetIntArrayElements(sources, 0); alSourcePausev(n, (ALuint*) array); env->ReleaseIntArrayElements(sources, (jint*) array, 0); + CHECK_AL_ERROR } /** @@ -455,6 +509,7 @@ int* array = (int*) env->GetIntArrayElements(sources, 0); alSourceStopv(n, (ALuint*) array); env->ReleaseIntArrayElements(sources, (jint*) array, 0); + CHECK_AL_ERROR } /** @@ -467,6 +522,7 @@ int* array = (int*) env->GetIntArrayElements(sources, 0); alSourceRewindv(n, (ALuint*) array); env->ReleaseIntArrayElements(sources, (jint*) array, 0); + CHECK_AL_ERROR } /** @@ -477,6 +533,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_sourcePlay (JNIEnv *env, jobject obj, jint source) { alSourcePlay((ALuint) source); + CHECK_AL_ERROR } /* @@ -487,6 +544,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_sourcePause (JNIEnv *env, jobject obj, jint source) { alSourcePause((ALuint) source); + CHECK_AL_ERROR } /** @@ -497,6 +555,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_sourceStop (JNIEnv *env, jobject obj, jint source) { alSourceStop((ALuint) source); + CHECK_AL_ERROR } /** @@ -507,6 +566,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_sourceRewind (JNIEnv *env, jobject obj, jint source) { alSourceRewind((ALuint) source); + CHECK_AL_ERROR } /** @@ -519,6 +579,7 @@ int* array = (int*) env->GetIntArrayElements(buffers, 0); alGenBuffers(n, (ALuint*) array); env->ReleaseIntArrayElements(buffers, (jint*) array, 0); + CHECK_AL_ERROR } /** @@ -531,6 +592,7 @@ int* array = (int*) env->GetIntArrayElements(buffer, 0); alDeleteBuffers(n, (ALuint*) array); env->ReleaseIntArrayElements(buffer, (jint*) array, 0); + CHECK_AL_ERROR } /** @@ -540,7 +602,10 @@ * Alboolean alIsBuffer(ALuint buffer); */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_CoreAL_isBuffer (JNIEnv *env, jobject obj, jint buffer) { - return (jboolean) alIsBuffer((ALuint) buffer); + jboolean result = (jboolean) alIsBuffer((ALuint) buffer); + + CHECK_AL_ERROR + return result; } /** @@ -551,6 +616,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_bufferData (JNIEnv *env, jobject obj, jint buffer, jint format, jint data, jint size, jint freq) { alBufferData(buffer, format, (void**) data, size, freq); + CHECK_AL_ERROR } /** @@ -561,6 +627,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_getBufferi (JNIEnv *env, jobject obj, jint buffer, jint pname, jint value) { alGetBufferi((ALuint) buffer, (ALenum) pname, (ALint*) value); + CHECK_AL_ERROR } /** @@ -571,6 +638,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_getBufferf (JNIEnv *env, jobject obj, jint buffer, jint pname, jint value) { alGetBufferf((ALuint) buffer, (ALenum) pname, (ALfloat*) value); + CHECK_AL_ERROR } /** @@ -583,6 +651,7 @@ int* array = (int*) env->GetIntArrayElements(buffers, 0); alSourceQueueBuffers((ALuint) source, (ALsizei) n, (ALuint*) array); env->ReleaseIntArrayElements(buffers, (jint*) array, 0); + CHECK_AL_ERROR } /** @@ -595,6 +664,7 @@ int* array = (int*) env->GetIntArrayElements(buffers, 0); alSourceUnqueueBuffers((ALuint) source, (ALsizei) n, (ALuint*) array); env->ReleaseIntArrayElements(buffers, (jint*) array, 0); + CHECK_AL_ERROR } /** @@ -606,6 +676,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_distanceModel (JNIEnv *env, jobject obj, jint value) { alDistanceModel((ALenum) value); + CHECK_AL_ERROR } /** @@ -616,6 +687,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_dopplerFactor (JNIEnv *env, jobject obj, jfloat value) { alDopplerFactor((ALfloat) value); + CHECK_AL_ERROR } /** @@ -626,8 +698,5 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_CoreAL_dopplerVelocity (JNIEnv *env, jobject obj, jfloat value) { alDopplerVelocity((ALfloat) value); -} - - - - + CHECK_AL_ERROR +} \ No newline at end of file |
From: Brian M. <ma...@us...> - 2002-08-26 18:22:54
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory usw-pr-cvs1:/tmp/cvs-serv30229 Added Files: checkALerror.h Log Message: add: macro AL error checking --- NEW FILE: checkALerror.h --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/checkALerror.h /* checkGLerror.h Author: C. Prince Created: 8 November 2001 Error checking for OpenGL bindings */ #ifndef _CHECKGLERROR_H_INCLUDED_ #define _CHECKGLERROR_H_INCLUDED_ #ifdef _DEBUG #include <jni.h> #include <al.h> #define CHECK_AL_ERROR \ { \ int err = alGetError(); \ if (err != AL_NO_ERROR) { \ jclass cls = env->FindClass("org/lwjgl/openal/OpenALException"); \ env->ThrowNew(cls, (const char*) alGetString(err)); \ env->DeleteLocalRef(cls); \ } \ } /* only available if deviceaddress is specified in method */ #define CHECK_ALC_ERROR \ { \ int err = alcGetError((ALCdevice*) deviceaddress); \ if (err != AL_NO_ERROR) { \ jclass cls = env->FindClass("org/lwjgl/openal/OpenALException"); \ env->ThrowNew(cls, (const char*) alcGetString((ALCdevice*) deviceaddress, err)); \ env->DeleteLocalRef(cls); \ } \ } #else #define CHECK_GL_ERROR #endif /* _DEBUG */ #endif /* _CHECKGLERROR_H_INCLUDED_ */ |
From: Brian M. <ma...@us...> - 2002-08-26 18:14:25
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory usw-pr-cvs1:/tmp/cvs-serv27345 Modified Files: org_lwjgl_Display.cpp Log Message: fix: dx version defined, so that compile errors are removed Index: org_lwjgl_Display.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Display.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Display.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- org_lwjgl_Display.cpp 24 Aug 2002 21:16:53 -0000 1.5 +++ org_lwjgl_Display.cpp 26 Aug 2002 18:14:22 -0000 1.6 @@ -42,7 +42,8 @@ #include <windows.h> #include "org_lwjgl_Display.h" -//#define DIRECTINPUT_VERSION 0x0700 +#undef DIRECTINPUT_VERSION +#define DIRECTINPUT_VERSION 0x0300 #include <dinput.h> |
From: Brian M. <ma...@us...> - 2002-08-26 18:12:25
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory usw-pr-cvs1:/tmp/cvs-serv26635 Modified Files: org_lwjgl_Math.cpp Log Message: rem: don't include math file, which isn't there Index: org_lwjgl_Math.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- org_lwjgl_Math.cpp 24 Aug 2002 21:16:53 -0000 1.3 +++ org_lwjgl_Math.cpp 26 Aug 2002 18:12:22 -0000 1.4 @@ -40,6 +40,6 @@ */ #include <windows.h> -#include "org_lwjgl_Math.h" +//#include "org_lwjgl_Math.h" #include "math.h" |
From: Caspian Rychlik-P. <ci...@us...> - 2002-08-26 15:53:39
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/vector In directory usw-pr-cvs1:/tmp/cvs-serv3892/src/java/org/lwjgl/vector Modified Files: Matrix2f.java Matrix4f.java Matrix3f.java Matrix.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.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Matrix2f.java 26 Aug 2002 15:46:39 -0000 1.5 +++ Matrix2f.java 26 Aug 2002 15:53:36 -0000 1.6 @@ -332,7 +332,7 @@ * Set this matrix to be the identity matrix. * @return this */ - public Matrix identity() { + public Matrix setIdentity() { m00 = 1.0f; m01 = 0.0f; m10 = 0.0f; @@ -344,7 +344,7 @@ * Set this matrix to 0. * @return this */ - public Matrix zero() { + public Matrix setZero() { m00 = 0.0f; m01 = 0.0f; m10 = 0.0f; 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.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Matrix4f.java 26 Aug 2002 15:46:39 -0000 1.6 +++ Matrix4f.java 26 Aug 2002 15:53:36 -0000 1.7 @@ -43,7 +43,7 @@ * Set this matrix to be the identity matrix. * @return this */ - public Matrix4f setIdentity() { + public Matrix setIdentity() { m00 = 1.0f; m01 = 0.0f; m02 = 0.0f; @@ -69,7 +69,7 @@ * Set this matrix to 0. * @return this */ - public Matrix4f setZero() { + public Matrix setZero() { m00 = 0.0f; m01 = 0.0f; m02 = 0.0f; @@ -134,7 +134,7 @@ * @param buf A float buffer to read from * @return this */ - public Matrix4f load(FloatBuffer buf) { + public Matrix load(FloatBuffer buf) { m00 = buf.get(); m10 = buf.get(); @@ -163,7 +163,7 @@ * @param buf A float buffer to read from * @return this */ - public Matrix4f loadTranspose(FloatBuffer buf) { + public Matrix loadTranspose(FloatBuffer buf) { m00 = buf.get(); m01 = buf.get(); @@ -190,7 +190,7 @@ * major (openGL) order. * @param buf The buffer to store this matrix in */ - public void store(FloatBuffer buf) { + public Matrix store(FloatBuffer buf) { buf.put(m00); buf.put(m10); buf.put(m20); @@ -207,6 +207,7 @@ buf.put(m13); buf.put(m23); buf.put(m33); + return this; } /** @@ -214,7 +215,7 @@ * major (maths) order. * @param buf The buffer to store this matrix in */ - public void storeTranspose(FloatBuffer buf) { + public Matrix storeTranspose(FloatBuffer buf) { buf.put(m00); buf.put(m01); buf.put(m02); @@ -231,6 +232,7 @@ buf.put(m31); buf.put(m32); buf.put(m33); + return this; } @@ -398,7 +400,7 @@ * Transpose this matrix * @return this */ - public Matrix4f transpose() { + public Matrix transpose() { float f = m10; m10 = m01; @@ -485,7 +487,7 @@ * Invert this matrix * @return this */ - public Matrix4f invert() { + public Matrix invert() { return this; } @@ -493,7 +495,7 @@ * Negate this matrix * @return this */ - public Matrix4f negate() { + public Matrix negate() { m00 = -m00; m01 = -m01; m02 = -m02; 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.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Matrix3f.java 26 Aug 2002 15:46:39 -0000 1.6 +++ Matrix3f.java 26 Aug 2002 15:53:36 -0000 1.7 @@ -411,7 +411,7 @@ * Set this matrix to be the identity matrix. * @return this */ - public Matrix3f setIdentity() { + public Matrix setIdentity() { m00 = 1.0f; m01 = 0.0f; m02 = 0.0f; @@ -428,7 +428,7 @@ * Set this matrix to 0. * @return this */ - public Matrix3f setZero() { + public Matrix setZero() { m00 = 0.0f; m01 = 0.0f; m02 = 0.0f; 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.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Matrix.java 26 Aug 2002 15:46:39 -0000 1.1 +++ Matrix.java 26 Aug 2002 15:53:36 -0000 1.2 @@ -54,7 +54,7 @@ * Set this matrix to be the identity matrix. * @return this */ - public abstract Matrix identity(); + public abstract Matrix setIdentity(); /** @@ -120,7 +120,7 @@ * Set this matrix to 0. * @return this */ - public abstract Matrix zero(); + public abstract Matrix setZero(); /** |
From: Caspian Rychlik-P. <ci...@us...> - 2002-08-26 15:46:46
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/vector In directory usw-pr-cvs1:/tmp/cvs-serv1733/src/java/org/lwjgl/vector Modified Files: Matrix2f.java Vector3f.java Matrix4f.java Vector2f.java Vector4f.java Matrix3f.java Added Files: Vector.java Matrix.java Log Message: New base classes Vector and Matrix --- NEW FILE: Vector.java --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Vector.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.vector; import java.nio.FloatBuffer; import org.lwjgl.Math; /** * $Id$ * * Base class for vectors. * * @author cix_foo <ci...@us...> * @version $Revision$ */ public abstract class Vector { /** * Constructor for Vector. */ public Vector() { super(); } /** * @return the length of the vector */ public final float length() { return Math.sqrt(lengthSquared()); } /** * @return the length squared of the vector */ public abstract float lengthSquared(); /** * Load this vector from a FloatBuffer * @param buf The buffer to load it from, at the current position * @return this */ public abstract Vector load(FloatBuffer buf); /** * Negate a vector * @return this */ public abstract Vector negate(); /** * Normalise this vector * @return this */ public final Vector normalise() { float l = 1.0f / length(); return scale(l); } /** * Store this vector in a FloatBuffer * @param buf The buffer to store it in, at the current position * @return this */ public abstract Vector store(FloatBuffer buf); /** * Scale this vector * @param scale The scale factor * @return this */ public abstract Vector scale(float scale); } --- NEW FILE: Matrix.java --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/vector/Matrix.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.vector; import java.nio.FloatBuffer; /** * $Id$ * * Base class for matrices. * * @author cix_foo <ci...@us...> * @version $Revision$ */ public abstract class Matrix { /** * Constructor for Matrix. */ public Matrix() { super(); } /** * Set this matrix to be the identity matrix. * @return this */ public abstract Matrix identity(); /** * Invert this matrix * @return this */ public abstract Matrix invert(); /** * Load from a float buffer. The buffer stores the matrix in column major * (OpenGL) order. * * @param buf A float buffer to read from * @return this */ public abstract Matrix load(FloatBuffer buf); /** * Load from a float buffer. The buffer stores the matrix in row major * (mathematical) order. * * @param buf A float buffer to read from * @return this */ public abstract Matrix loadTranspose(FloatBuffer buf); /** * Negate this matrix * @return this */ public abstract Matrix negate(); /** * Store this matrix in a float buffer. The matrix is stored in column * major (openGL) order. * @param buf The buffer to store this matrix in * @return this */ public abstract Matrix store(FloatBuffer buf); /** * Store this matrix in a float buffer. The matrix is stored in row * major (maths) order. * @param buf The buffer to store this matrix in * @return this */ public abstract Matrix storeTranspose(FloatBuffer buf); /** * Transpose this matrix * @return this */ public abstract Matrix transpose(); /** * Set this matrix to 0. * @return this */ public abstract Matrix zero(); /** * @return the determinant of the matrix */ public abstract float determinant(); } 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.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Matrix2f.java 24 Aug 2002 21:26:47 -0000 1.4 +++ Matrix2f.java 26 Aug 2002 15:46:39 -0000 1.5 @@ -42,7 +42,7 @@ * @version $Revision$ */ -public class Matrix2f { +public class Matrix2f extends Matrix { public float m00 = 1.0f, m01, m10, m11 = 1.0f; @@ -81,7 +81,7 @@ * @param buf A float buffer to read from * @return this */ - public Matrix2f load(FloatBuffer buf) { + public Matrix load(FloatBuffer buf) { m00 = buf.get(); m10 = buf.get(); @@ -92,17 +92,48 @@ } /** + * Load from a float buffer. The buffer stores the matrix in row major + * (mathematical) order. + * + * @param buf A float buffer to read from + * @return this + */ + public Matrix loadTranspose(FloatBuffer buf) { + + m00 = buf.get(); + m01 = buf.get(); + m10 = buf.get(); + m11 = buf.get(); + + return this; + } + + /** * Store this matrix in a float buffer. The matrix is stored in column * major (openGL) order. * @param buf The buffer to store this matrix in */ - public void store(FloatBuffer buf) { + public Matrix store(FloatBuffer buf) { buf.put(m00); buf.put(m10); buf.put(m01); buf.put(m11); + return this; } + /** + * Store this matrix in a float buffer. The matrix is stored in row + * major (maths) order. + * @param buf The buffer to store this matrix in + */ + public Matrix storeTranspose(FloatBuffer buf) { + buf.put(m00); + buf.put(m01); + buf.put(m10); + buf.put(m11); + return this; + } + /** @@ -228,7 +259,7 @@ * Transpose this matrix * @return this */ - public Matrix2f transpose() { + public Matrix transpose() { float temp; temp = m01; @@ -261,7 +292,7 @@ * Invert this matrix * @return this */ - public Matrix2f invert() { + public Matrix invert() { return this; } @@ -269,7 +300,7 @@ * Negate this matrix * @return this */ - public Matrix2f negate() { + public Matrix negate() { m00 = -m00; m01 = -m01; @@ -301,7 +332,7 @@ * Set this matrix to be the identity matrix. * @return this */ - public Matrix2f identity() { + public Matrix identity() { m00 = 1.0f; m01 = 0.0f; m10 = 0.0f; @@ -313,7 +344,7 @@ * Set this matrix to 0. * @return this */ - public Matrix2f zero() { + public Matrix zero() { m00 = 0.0f; m01 = 0.0f; m10 = 0.0f; @@ -321,4 +352,11 @@ return this; } + /* (non-Javadoc) + * @see org.lwjgl.vector.Matrix#determinant() + */ + public float determinant() { + 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.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Vector3f.java 24 Aug 2002 21:12:31 -0000 1.3 +++ Vector3f.java 26 Aug 2002 15:46:39 -0000 1.4 @@ -31,6 +31,8 @@ */ package org.lwjgl.vector; +import java.nio.FloatBuffer; + import org.lwjgl.Math; /** @@ -42,7 +44,7 @@ * @version $Revision$ */ -public class Vector3f { +public class Vector3f extends Vector { public float x, y, z; @@ -91,13 +93,6 @@ } /** - * @return the length of the vector - */ - public float length() { - return Math.sqrt(lengthSquared()); - } - - /** * @return the length squared of the vector */ public float lengthSquared() { @@ -117,11 +112,45 @@ return this; } + /** + * Add a vector to another vector and place the result in a destination + * vector. + * @param left The LHS vector + * @param right The RHS vector + * @param dest The destination vector, or null if a new vector is to be created + * @return the sum of left and right in dest + */ + public static Vector3f add(Vector3f left, Vector3f right, Vector3f dest) { + if (dest == null) + return new Vector3f(left.x + right.x, left.y + right.y, left.z + right.z); + else { + return dest.set(left.x + right.x, left.y + right.y, left.z + right.z); + } + } + + /** + * Subtract a vector from another vector and place the result in a destination + * vector. + * @param left The LHS vector + * @param right The RHS vector + * @param dest The destination vector, or null if a new vector is to be created + * @return left minus right in dest + */ + public static Vector3f sub(Vector3f left, Vector3f right, Vector3f dest) { + if (dest == null) + return new Vector3f(left.x - right.x, left.y - right.y, left.z - right.z); + else { + return dest.set(left.x - right.x, left.y - right.y, left.z - right.z); + } + } + + + /** * Negate a vector * @return this */ - public Vector3f negate() { + public Vector negate() { x = -x; y = -y; z = -z; @@ -129,17 +158,20 @@ } /** - * Normalise this vector - * @return this + * Negate a vector and place the result in a destination vector. + * @param dest The destination vector or null if a new vector is to be created + * @return the negated vector */ - public Vector3f normalise() { - float l = 1.0f / length(); - x *= l; - y *= l; - z *= l; - return this; + public Vector3f negate(Vector3f dest) { + if (dest == null) + dest = new Vector3f(); + dest.x = -x; + dest.y = -y; + dest.z = -z; + return dest; } + /** * Normalise this vector and place the result in another vector. * @param dest The destination vector, or null if a new vector is to be created @@ -182,4 +214,36 @@ return Math.acos(dls); } + /* (non-Javadoc) + * @see org.lwjgl.vector.Vector#load(FloatBuffer) + */ + public Vector load(FloatBuffer buf) { + return null; + } + + /* (non-Javadoc) + * @see org.lwjgl.vector.Vector#scale(float) + */ + public Vector scale(float scale) { + + x *= scale; + y *= scale; + z *= scale; + + return this; + + } + + /* (non-Javadoc) + * @see org.lwjgl.vector.Vector#store(FloatBuffer) + */ + public Vector store(FloatBuffer buf) { + + buf.put(x); + buf.put(y); + buf.put(z); + + return this; + } + } 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.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Matrix4f.java 24 Aug 2002 21:35:20 -0000 1.5 +++ Matrix4f.java 26 Aug 2002 15:46:39 -0000 1.6 @@ -38,7 +38,7 @@ * * @author foo */ -public class Matrix4f { +public class Matrix4f extends Matrix { /** * Set this matrix to be the identity matrix. * @return this @@ -157,6 +157,35 @@ } /** + * Load from a float buffer. The buffer stores the matrix in row major + * (maths) order. + * + * @param buf A float buffer to read from + * @return this + */ + public Matrix4f 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(); + m31 = buf.get(); + m32 = buf.get(); + m33 = buf.get(); + + return this; + } + + /** * Store this matrix in a float buffer. The matrix is stored in column * major (openGL) order. * @param buf The buffer to store this matrix in @@ -179,6 +208,30 @@ buf.put(m23); buf.put(m33); } + + /** + * Store this matrix in a float buffer. The matrix is stored in row + * major (maths) order. + * @param buf The buffer to store this matrix in + */ + public void 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(m31); + buf.put(m32); + buf.put(m33); + } /** 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.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Vector2f.java 24 Aug 2002 21:12:31 -0000 1.3 +++ Vector2f.java 26 Aug 2002 15:46:39 -0000 1.4 @@ -31,6 +31,8 @@ */ package org.lwjgl.vector; +import java.nio.FloatBuffer; + import org.lwjgl.Math; /** @@ -42,7 +44,7 @@ * @version $Revision$ */ -public class Vector2f { +public class Vector2f extends Vector { public float x, y; @@ -89,13 +91,6 @@ } /** - * @return the length of the vector - */ - public float length() { - return Math.sqrt(lengthSquared()); - } - - /** * @return the length squared of the vector */ public float lengthSquared() { @@ -118,23 +113,26 @@ * Negate a vector * @return this */ - public Vector2f negate() { + public Vector negate() { x = -x; y = -y; return this; } /** - * Normalise this vector - * @return this + * Negate a vector and place the result in a destination vector. + * @param dest The destination vector or null if a new vector is to be created + * @return the negated vector */ - public Vector2f normalise() { - float l = 1.0f / length(); - x *= l; - y *= l; - return this; + public Vector2f negate(Vector2f dest) { + if (dest == null) + dest = new Vector2f(); + dest.x = -x; + dest.y = -y; + return dest; } + /** * Normalise this vector and place the result in another vector. * @param dest The destination vector, or null if a new vector is to be created @@ -176,5 +174,70 @@ dls = 1.0f; return Math.acos(dls); } + + /** + * Add a vector to another vector and place the result in a destination + * vector. + * @param left The LHS vector + * @param right The RHS vector + * @param dest The destination vector, or null if a new vector is to be created + * @return the sum of left and right in dest + */ + public static Vector2f add(Vector2f left, Vector2f right, Vector2f dest) { + if (dest == null) + return new Vector2f(left.x + right.x, left.y + right.y); + else { + return dest.set(left.x + right.x, left.y + right.y); + } + } + + /** + * Subtract a vector from another vector and place the result in a destination + * vector. + * @param left The LHS vector + * @param right The RHS vector + * @param dest The destination vector, or null if a new vector is to be created + * @return left minus right in dest + */ + public static Vector2f sub(Vector2f left, Vector2f right, Vector2f dest) { + if (dest == null) + return new Vector2f(left.x - right.x, left.y - right.y); + else { + return dest.set(left.x - right.x, left.y - right.y); + } + } + + /** + * Store this vector in a FloatBuffer + * @param buf The buffer to store it in, at the current position + * @return this + */ + public Vector store(FloatBuffer buf) { + buf.put(x); + buf.put(y); + return this; + } + + /** + * Load this vector from a FloatBuffer + * @param buf The buffer to load it from, at the current position + * @return this + */ + public Vector load(FloatBuffer buf) { + x = buf.get(); + y = buf.get(); + return this; + } + /* (non-Javadoc) + * @see org.lwjgl.vector.Vector#scale(float) + */ + public Vector scale(float scale) { + + x *= scale; + y *= scale; + + return this; + } + } 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.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Vector4f.java 24 Aug 2002 21:12:31 -0000 1.3 +++ Vector4f.java 26 Aug 2002 15:46:39 -0000 1.4 @@ -31,6 +31,8 @@ */ package org.lwjgl.vector; +import java.nio.FloatBuffer; + import org.lwjgl.Math; /** @@ -42,7 +44,7 @@ * @version $Revision$ */ -public class Vector4f { +public class Vector4f extends Vector { public float x, y, z, w; @@ -93,13 +95,6 @@ } /** - * @return the length of the vector - */ - public float length() { - return Math.sqrt(lengthSquared()); - } - - /** * @return the length squared of the vector */ public float lengthSquared() { @@ -120,11 +115,44 @@ return this; } + /** + * Add a vector to another vector and place the result in a destination + * vector. + * @param left The LHS vector + * @param right The RHS vector + * @param dest The destination vector, or null if a new vector is to be created + * @return the sum of left and right in dest + */ + public static Vector4f add(Vector4f left, Vector4f right, Vector4f dest) { + if (dest == null) + return new Vector4f(left.x + right.x, left.y + right.y, left.z + right.z, left.w + right.w); + else { + return dest.set(left.x + right.x, left.y + right.y, left.z + right.z, left.w + right.w); + } + } + + /** + * Subtract a vector from another vector and place the result in a destination + * vector. + * @param left The LHS vector + * @param right The RHS vector + * @param dest The destination vector, or null if a new vector is to be created + * @return left minus right in dest + */ + public static Vector4f sub(Vector4f left, Vector4f right, Vector4f dest) { + if (dest == null) + return new Vector4f(left.x - right.x, left.y - right.y, left.z - right.z, left.w - right.w); + else { + return dest.set(left.x - right.x, left.y - right.y, left.z - right.z, left.w - right.w); + } + } + + /** * Negate a vector * @return this */ - public Vector4f negate() { + public Vector negate() { x = -x; y = -y; z = -z; @@ -133,18 +161,21 @@ } /** - * Normalise this vector - * @return this + * Negate a vector and place the result in a destination vector. + * @param dest The destination vector or null if a new vector is to be created + * @return the negated vector */ - public Vector4f normalise() { - float l = 1.0f / length(); - x *= l; - y *= l; - z *= l; - w *= l; - return this; + public Vector4f negate(Vector4f dest) { + if (dest == null) + dest = new Vector4f(); + dest.x = -x; + dest.y = -y; + dest.z = -z; + dest.w = -w; + return dest; } + /** * Normalise this vector and place the result in another vector. * @param dest The destination vector, or null if a new vector is to be created @@ -187,4 +218,35 @@ return Math.acos(dls); } + /* (non-Javadoc) + * @see org.lwjgl.vector.Vector#load(FloatBuffer) + */ + public Vector load(FloatBuffer buf) { + return null; + } + + /* (non-Javadoc) + * @see org.lwjgl.vector.Vector#scale(float) + */ + public Vector scale(float scale) { + x *= scale; + y *= scale; + z *= scale; + w *= scale; + return this; + } + + /* (non-Javadoc) + * @see org.lwjgl.vector.Vector#store(FloatBuffer) + */ + public Vector store(FloatBuffer buf) { + + buf.put(x); + buf.put(y); + buf.put(z); + buf.put(w); + + return this; + } + } 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.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Matrix3f.java 24 Aug 2002 21:35:20 -0000 1.5 +++ Matrix3f.java 26 Aug 2002 15:46:39 -0000 1.6 @@ -42,7 +42,7 @@ * @version $Revision$ */ -public class Matrix3f { +public class Matrix3f extends Matrix { public float m00 = 1.0f, m01, @@ -87,7 +87,7 @@ * @param buf A float buffer to read from * @return this */ - public Matrix3f load(FloatBuffer buf) { + public Matrix load(FloatBuffer buf) { m00 = buf.get(); m10 = buf.get(); @@ -103,11 +103,33 @@ } /** + * Load from a float buffer. The buffer stores the matrix in row major + * (maths) order. + * + * @param buf A float buffer to read from + * @return this + */ + 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(); + m21 = buf.get(); + m22 = buf.get(); + + return this; + } + + /** * Store this matrix in a float buffer. The matrix is stored in column * major (openGL) order. * @param buf The buffer to store this matrix in */ - public void store(FloatBuffer buf) { + public Matrix store(FloatBuffer buf) { buf.put(m00); buf.put(m10); buf.put(m20); @@ -117,8 +139,27 @@ buf.put(m02); buf.put(m12); buf.put(m22); + return this; } + /** + * Store this matrix in a float buffer. The matrix is stored in row + * major (maths) order. + * @param buf The buffer to store this matrix in + */ + 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(m21); + buf.put(m22); + return this; + } + /** @@ -269,7 +310,7 @@ * Transpose this matrix * @return this */ - public Matrix3f transpose() { + public Matrix transpose() { float f = m10; m10 = m01; m01 = f; @@ -324,7 +365,7 @@ * Invert this matrix * @return this */ - public Matrix3f invert() { + public Matrix invert() { return this; } @@ -332,7 +373,7 @@ * Negate this matrix * @return this */ - public Matrix3f negate() { + public Matrix negate() { m00 = -m00; m01 = -m02; m02 = -m01; |
From: Brian M. <ma...@us...> - 2002-08-26 15:30:24
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal In directory usw-pr-cvs1:/tmp/cvs-serv27706/org/lwjgl/openal Modified Files: ALC.java Log Message: rem: removed debug fix: cleanup Index: ALC.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/ALC.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/ALC.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ALC.java 26 Aug 2002 15:28:01 -0000 1.2 +++ ALC.java 26 Aug 2002 15:30:19 -0000 1.3 @@ -94,7 +94,6 @@ static { try { - System.out.println("using " + org.lwjgl.Sys.getLibraryName()); System.loadLibrary(org.lwjgl.Sys.getLibraryName()); } catch (UnsatisfiedLinkError ule) { System.out.println("Failed to load OpenAL library: " + org.lwjgl.Sys.getLibraryName()); @@ -105,6 +104,7 @@ /** Creates a new instance of ALC */ public ALC() { } + /** * Returns strings related to the context. * |
From: Brian M. <ma...@us...> - 2002-08-26 15:28:08
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal In directory usw-pr-cvs1:/tmp/cvs-serv26742/org/lwjgl/openal Modified Files: ALC.java Log Message: add: ALC constants added Index: ALC.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/ALC.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/ALC.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ALC.java 20 Aug 2002 14:44:35 -0000 1.1 +++ ALC.java 26 Aug 2002 15:28:01 -0000 1.2 @@ -1,35 +1,35 @@ -/* +/* * 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 + * modification, are permitted provided that the following conditions are * met: - * - * * Redistributions of source code must retain the above copyright + * + * * 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 + * * 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 + * 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 + * 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; +package org.lwjgl.openal; /** * $Id$ @@ -42,8 +42,59 @@ */ public class ALC { + /** Bad value */ + public static final int INVALID = -1; + + /** Boolean False */ + public static final int FALSE = 0; + + /** Boolean True */ + public static final int TRUE = 1; + + /** Errors: No Error */ + public static final int NO_ERROR = FALSE; + + public static final int MAJOR_VERSION = 0x1000; + public static final int MINOR_VERSION = 0x1001; + public static final int ATTRIBUTES_SIZE = 0x1002; + public static final int ALL_ATTRIBUTES = 0x1003; + + public static final int DEFAULT_DEVICE_SPECIFIER = 0x1004; + public static final int DEVICE_SPECIFIER = 0x1005; + public static final int EXTENSIONS = 0x1006; + + public static final int FREQUENCY = 0x1007; + public static final int REFRESH = 0x1008; + public static final int SYNC = 0x1009; + + /** The device argument does not name a valid device */ + public static final int INVALID_DEVICE = 0xA001; + + /** The context argument does not name a valid context */ + public static final int INVALID_CONTEXT = 0xA002; + + /** + * A function was called at inappropriate time, or in an inappropriate way, + * causing an illegal state. This can be an incompatible ALenum, object ID, + * and/or function. + */ + public static final int INVALID_ENUM = 0xA003; + + /** + * Illegal value passed as an argument to an AL call. + * Applies to parameter values, but not to enumerations. + */ + public static final int INVALID_VALUE = 0xA004; + + /** + * A function could not be completed, because there is not enough + * memory available. + */ + public static final int OUT_OF_MEMORY = 0xA005; + static { try { + System.out.println("using " + org.lwjgl.Sys.getLibraryName()); System.loadLibrary(org.lwjgl.Sys.getLibraryName()); } catch (UnsatisfiedLinkError ule) { System.out.println("Failed to load OpenAL library: " + org.lwjgl.Sys.getLibraryName()); @@ -62,7 +113,7 @@ * @return String property from device */ public native String getString(ALCdevice device, int pname); - + /** * Returns integers related to the context. * @@ -74,7 +125,7 @@ public native void getIntegerv(ALCdevice device, int pname, int size, int integerdata); /** - * Opens the named device. If null is specied, the implementation will + * Opens the named device. If null is specied, the implementation will * provide an implementation specic default. * * @param devicename name of device to open @@ -103,9 +154,9 @@ * * @param context ALCcontext to make current * @return true if successfull, false if not - */ + */ public native boolean makeContextCurrent(ALCcontext context); - + /** * Tells a context to begin processing. * @@ -119,7 +170,7 @@ * @return Current ALCcontext */ public native ALCcontext getCurrentContext(); - + /** * Retrives the device associated with the supplied context * @@ -127,7 +178,7 @@ * @param ALCdevice associated with context */ public native ALCdevice getContextsDevice(ALCcontext context); - + /** * Suspends processing on supplied context * @@ -141,7 +192,7 @@ * @param context ALCcontext to Destroy */ public native void destroyContext(ALCcontext context); - + /** * Retrieves the current context error state. * @@ -170,10 +221,10 @@ /** * retrieves the enum value for a specified enumeration name. - * + * * @param device Device to query * @param enumName name of enum to find * @return value of enumeration */ - public native int getEnumValue(ALCdevice device, String enumName); + public native int getEnumValue(ALCdevice device, String enumName); } |
From: Brian M. <ma...@us...> - 2002-08-26 15:07:44
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory usw-pr-cvs1:/tmp/cvs-serv18691 Modified Files: org_lwjgl_openal_ALC.cpp Log Message: fix: wrong header file being included (DOH!) fix: using wrong object to retrieve field values from 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.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- org_lwjgl_openal_ALC.cpp 25 Aug 2002 11:02:21 -0000 1.2 +++ org_lwjgl_openal_ALC.cpp 26 Aug 2002 15:07:31 -0000 1.3 @@ -38,7 +38,7 @@ * @author Brian Matzon <br...@ma...> * @version $Revision$ */ -#include "org_lwjgl_openal_ALUT.h" +#include "org_lwjgl_openal_ALC.h" /* OpenAL includes */ #include <alc.h> @@ -116,7 +116,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_closeDevice (JNIEnv *env, jobject obj, jobject device) { 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); alcCloseDevice((ALCdevice*) deviceaddress); } @@ -131,9 +131,10 @@ /* get device address */ 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); ALCcontext* context = alcCreateContext((ALCdevice*) deviceaddress, (ALint*) attrlist); + /* if error - get out */ if(context == NULL) { return NULL; @@ -164,7 +165,7 @@ /* get context address */ jclass context_class = env->GetObjectClass(context); jfieldID context_field = env->GetFieldID(context_class, "context", "I"); - jint contextaddress = env->GetIntField(obj, context_field); + jint contextaddress = env->GetIntField(context, context_field); return alcMakeContextCurrent((ALCcontext*) contextaddress); } @@ -179,7 +180,7 @@ /* get context address */ jclass context_class = env->GetObjectClass(context); jfieldID context_field = env->GetFieldID(context_class, "context", "I"); - jint contextaddress = env->GetIntField(obj, context_field); + jint contextaddress = env->GetIntField(context, context_field); alcProcessContext((ALCcontext*) contextaddress); } @@ -223,7 +224,7 @@ /* get context address */ jclass context_class = env->GetObjectClass(context); jfieldID context_field = env->GetFieldID(context_class, "context", "I"); - jint contextaddress = env->GetIntField(obj, context_field); + jint contextaddress = env->GetIntField(context, context_field); ALCdevice* device = alcGetContextsDevice((ALCcontext*) contextaddress); if(device == NULL) { @@ -255,7 +256,7 @@ /* get context address */ jclass context_class = env->GetObjectClass(context); jfieldID context_field = env->GetFieldID(context_class, "context", "I"); - jint contextaddress = env->GetIntField(obj, context_field); + jint contextaddress = env->GetIntField(context, context_field); alcSuspendContext((ALCcontext*) contextaddress); } @@ -270,7 +271,7 @@ /* get context address */ jclass context_class = env->GetObjectClass(context); jfieldID context_field = env->GetFieldID(context_class, "context", "I"); - jint contextaddress = env->GetIntField(obj, context_field); + jint contextaddress = env->GetIntField(context, context_field); alcDestroyContext((ALCcontext*) contextaddress); } @@ -285,7 +286,7 @@ /* get device address */ 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); return (jint) alcGetError((ALCdevice*) deviceaddress); } @@ -300,7 +301,7 @@ /* get device address */ 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); /* get extension */ ALubyte* functionname = (ALubyte*) (env->GetStringUTFChars(extName, 0)); @@ -322,7 +323,7 @@ /* get device address */ 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); /* get extension */ ALubyte* functionname = (ALubyte*) (env->GetStringUTFChars(funcName, 0)); @@ -344,7 +345,7 @@ /* get device address */ 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); /* get extension */ ALubyte* enumerationname = (ALubyte*) (env->GetStringUTFChars(enumName, 0)); |
From: Brian M. <ma...@us...> - 2002-08-25 11:02:28
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory usw-pr-cvs1:/tmp/cvs-serv10494 Modified Files: org_lwjgl_openal_ALC.cpp Log Message: fix: made java impl. behave like C counterpart, by returning NULL 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.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- org_lwjgl_openal_ALC.cpp 20 Aug 2002 14:46:04 -0000 1.1 +++ org_lwjgl_openal_ALC.cpp 25 Aug 2002 11:02:21 -0000 1.2 @@ -83,6 +83,12 @@ /* get device */ ALCdevice* device = alcOpenDevice(tokenstring); + /* if error - cleanup and get out */ + if(device == NULL) { + env->ReleaseStringUTFChars((jstring)tokenstring, 0); + return NULL; + } + /* get ready to create ALCdevice instance */ jobject alcDevice_object = NULL; jclass alcDevice_class = NULL; @@ -128,6 +134,10 @@ jint deviceaddress = env->GetIntField(obj, device_field); ALCcontext* context = alcCreateContext((ALCdevice*) deviceaddress, (ALint*) attrlist); + /* if error - get out */ + if(context == NULL) { + return NULL; + } /* get ready to create ALCcontext instance */ jobject alcContext_object = NULL; @@ -182,7 +192,10 @@ */ JNIEXPORT jobject JNICALL Java_org_lwjgl_openal_ALC_getCurrentContext (JNIEnv *env, jobject obj) { - ALCcontext* context = alcGetCurrentContext(); + ALCcontext* context = alcGetCurrentContext(); + if(context == NULL) { + return NULL; + } /* get ready to create ALCcontext instance */ jobject alcContext_object = NULL; @@ -213,8 +226,11 @@ jint contextaddress = env->GetIntField(obj, context_field); ALCdevice* device = alcGetContextsDevice((ALCcontext*) contextaddress); + if(device == NULL) { + return NULL; + } - /* get ready to create ALCdevice instance */ + /* get ready to create ALCdevice instance */ jobject alcDevice_object = NULL; jclass alcDevice_class = NULL; jmethodID alcDevice_method = NULL; |
From: Caspian Rychlik-P. <ci...@us...> - 2002-08-25 10:04:13
|
Update of /cvsroot/java-game-lib/LWJGL/doc/tutorial In directory usw-pr-cvs1:/tmp/cvs-serv4176/doc/tutorial Modified Files: skeleton_code.html Log Message: Tweaks Index: skeleton_code.html CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/doc/tutorial/skeleton_code.html =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/doc/tutorial/skeleton_code.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- skeleton_code.html 24 Aug 2002 16:34:40 -0000 1.1 +++ skeleton_code.html 25 Aug 2002 10:04:09 -0000 1.2 @@ -144,134 +144,129 @@ write a fullscreen Java game using LWJGL. Because we're games programmers, we don't want to do a Hello World as we'd probably rather shoot it. But before we can make bullets we must pay homage to the <i>rotating square!</i></p> -<p style="background-color: #FFFFCC; border-style: solid; border-width: 1; padding: 3"><code>public +<p style="background-color: #FFFFCC; border-style: solid; border-width: 1; padding: 3"><code>import +org.lwjgl.*;<br> +import org.lwjgl.opengl.*;<br> +import org.lwjgl.input.*;<br> +<br> +<br> +public final class Game {<br> -static {<br> -try {<br> -DisplayMode[] modes = Display.getAvailableDisplayModes();<br> -System.out.println("Available display modes:");<br> -for (int i = 0; i < modes.length; i ++)<br> + static {<br> + try {<br> + DisplayMode[] modes = Display.getAvailableDisplayModes();<br> + System.out.println("Available display modes:");<br> + for (int i = 0; i < modes.length; i ++)<br> + System.out.println(modes[i]);<br> -// For now let's just pick a mode we're certain to have<br> -Display.create(new DisplayMode(640, 480, 16, 60), true);<br> -System.out.println("Created display.");<br> -} catch (Exception e) {<br> -System.err.println("Failed to create display due to "+e);<br> -System.exit(1);<br> -}<br> -}<br> -public static final GL gl = new GL(16, 0, 16, 8);<br> -static {<br> -try {<br> -gl.create();<br> -System.out.println("Created OpenGL.");<br> -} catch (Exception e) {<br> -System.err.println("Failed to create OpenGL due to "+e);<br> -System.exit(1);<br> -}<br> -}<br> -/** A handy number formatter for use displaying FPS and the like */<br> -public static NumberFormat fmt = new DecimalFormat();<br> -static {<br> -fmt.setMaximumFractionDigits(1);<br> -fmt.setMinimumFractionDigits(1);<br> -fmt.setGroupingUsed(false);<br> -}<br> -/** Is the game finished? */<br> -private static boolean finished;<br> -/** A rotating square! */<br> -private static float angle;<br> -/**<br> -* No construction allowed<br> -*/<br> -private Game() {<br> -}<br> -public static void main(String[] arguments) {<br> -try {<br> -init();<br> -int frames = 0;<br> -float fps = 0.0f;<br> -Timer timer = new Timer();<br> -timer.reset();<br> -timer.resume();<br> -while (!finished) {<br> -AbsMouse.poll();<br> + // For now let's just pick a mode we're certain to have<br> + Display.create(new DisplayMode(640, 480, 16, 60), true);<br> + System.out.println("Created display.");<br> + } catch (Exception e) {<br> + System.err.println("Failed to create display due to "+e);<br> + System.exit(1);<br> + }<br> + }<br> +<br> + public static final GL gl = new GL(16, 0, 16, 8);<br> + static {<br> + try {<br> + gl.create();<br> + System.out.println("Created OpenGL.");<br> + } catch (Exception e) {<br> + System.err.println("Failed to create OpenGL due to "+e);<br> + System.exit(1);<br> + }<br> + }<br> +<br> + /** Is the game finished? */<br> + private static boolean finished;<br> +<br> + /** A rotating square! */<br> + private static float angle;<br> +<br> + /**<br> + * No construction allowed<br> + */<br> + private Game() {<br> + }<br> +<br> + public static void main(String[] arguments) {<br> + try {<br> + init();<br> + while (!finished) {<br> + Keyboard.poll();<br> -Keyboard.read();<br> -gl.clear(GL.COLOR_BUFFER_BIT);<br> + mainLoop();<br> + render();<br> + gl.swapBuffers();<br> -// Count the frames per second. Do with this what you will..<br> -frames++;<br> -float time = timer.getTime();<br> -if (time >= 1.0f) {<br> -fps = (int) (frames / time);<br> -timer.reset();<br> -frames = 0;<br> -}<br> -}<br> -} catch (Throwable t) {<br> + }</code> <code><br> + } catch (Throwable t) {<br> + t.printStackTrace();<br> -} finally {<br> -cleanup();<br> -}<br> -}<br> + } finally {<br> + cleanup();<br> + }<br> + }<br> <br> -/**<br> -* All calculations are done in here<br> -*/<br> -private static void mainLoop() {<br> -angle += 1f;<br> -if (angle > 360.0f)<br> -angle = 0.0f;<br> + /**<br> + * All calculations are done in here<br> + */<br> + private static void mainLoop() {<br> + angle += 1f;<br> + if (angle > 360.0f)<br> + angle = 0.0f;<br> <br> -if (Keyboard.isKeyDown(Keyboard.KEY_ESCAPE))<br> -finished = true;<br> -}<br> + Keyboard.poll(); <br> -/**<br> -* All rendering is done in here<br> -*/<br> -private static void render() {<br> + if (Keyboard.isKeyDown(Keyboard.KEY_ESCAPE))<br> + finished = true;<br> + }<br> <br> -gl.pushMatrix();<br> -gl.translatef(Display.getWidth() / 2, Display.getHeight() / 2, 0.0f);<br> -gl.rotatef(angle, 0, 0, 1.0f);<br> -gl.begin(GL.QUADS);<br> -gl.vertex2i(-50, -50);<br> -gl.vertex2i(50, -50);<br> -gl.vertex2i(50, 50);<br> -gl.vertex2i(-50, 50);<br> -gl.end();<br> -gl.popMatrix();<br> -}<br> -/**<br> -* Initialize<br> -*/<br> -private static void init() throws Exception {<br> -Keyboard.create();<br> -Keyboard.enableBuffer();<br> -Mouse.create();<br> -// Go into orthographic projection mode.<br> -gl.matrixMode(GL.PROJECTION);<br> -gl.loadIdentity();<br> -gl.glu.ortho2D(0, Display.getWidth(), 0, Display.getHeight());<br> -gl.matrixMode(GL.MODELVIEW);<br> -gl.loadIdentity();<br> -gl.viewport(0, 0, Display.getWidth(), Display.getHeight());<br> -// Fix the refresh rate to the display frequency.<br> -gl.wglSwapIntervalEXT(1);<br> -}<br> -/**<br> -* Cleanup<br> -*/<br> -private static void cleanup() {<br> -Keyboard.destroy();<br> -Mouse.destroy();<br> -gl.destroy();<br> -Display.destroy();<br> -}<br> + /**<br> + * All rendering is done in here<br> + */<br> + private static void render() {<br> + gl.clear(GL.COLOR_BUFFER_BIT);<br> + gl.pushMatrix();<br> + gl.translatef(Display.getWidth() / 2, Display.getHeight() / 2, 0.0f);<br> + gl.rotatef(angle, 0, 0, 1.0f);<br> + gl.begin(GL.QUADS);<br> + gl.vertex2i(-50, -50);<br> + gl.vertex2i(50, -50);<br> + gl.vertex2i(50, 50);<br> + gl.vertex2i(-50, 50);<br> + gl.end();<br> + gl.popMatrix();<br> + }<br> +<br> + /**<br> + * Initialize<br> + */<br> + private static void init() throws Exception {<br> + Keyboard.create();<br> + // Go into orthographic projection mode.<br> + gl.matrixMode(GL.PROJECTION);<br> + gl.loadIdentity();<br> + glu.ortho2D(0, Display.getWidth(), 0, Display.getHeight());<br> + gl.matrixMode(GL.MODELVIEW);<br> + gl.loadIdentity();<br> + gl.viewport(0, 0, Display.getWidth(), Display.getHeight());<br> + // Fix the refresh rate to the display frequency.<br> + gl.wglSwapIntervalEXT(1);<br> + }<br> +<br> + /**<br> + * Cleanup<br> + */<br> + private static void cleanup() {<br> + Keyboard.destroy();<br> + </code> <code>gl.destroy();<br> + Display.destroy();<br> + }<br> }</code></p> </body> |
From: Brian M. <ma...@us...> - 2002-08-25 08:41:06
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal In directory usw-pr-cvs1:/tmp/cvs-serv18950/src/java/org/lwjgl/openal Removed Files: OpenALTest.java Log Message: removing from openal package --- OpenALTest.java DELETED --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/OpenALTest.java |
From: Caspian Rychlik-P. <ci...@us...> - 2002-08-24 21:35:23
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/vector In directory usw-pr-cvs1:/tmp/cvs-serv14858/src/java/org/lwjgl/vector Modified Files: Matrix4f.java Matrix3f.java Log Message: Determinants 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.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Matrix4f.java 24 Aug 2002 21:26:47 -0000 1.4 +++ Matrix4f.java 24 Aug 2002 21:35:20 -0000 1.5 @@ -395,8 +395,36 @@ m33 = dest.m33; } else transpose(); - + return dest; + } + + /** + * @return the determinant of the matrix + */ + public float determinant() { + float f = + m00 + * ((m11 * m22 * m33 + m12 * m23 * m31 + m13 * m21 * m32) + - m13 * m22 * m31 + - m11 * m23 * m32 + - m12 * m21 * m33); + f -= m01 + * ((m10 * m22 * m33 + m12 * m23 * m30 + m13 * m20 * m32) + - m13 * m22 * m30 + - m10 * m23 * m32 + - m12 * m20 * m33); + f += m02 + * ((m10 * m21 * m33 + m11 * m23 * m30 + m13 * m20 * m31) + - m13 * m21 * m30 + - m10 * m23 * m31 + - m11 * m20 * m33); + f -= m03 + * ((m10 * m21 * m32 + m11 * m22 * m30 + m12 * m20 * m31) + - m12 * m21 * m30 + - m10 * m22 * m31 + - m11 * m20 * m32); + return f; } 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.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Matrix3f.java 24 Aug 2002 21:26:47 -0000 1.4 +++ Matrix3f.java 24 Aug 2002 21:35:20 -0000 1.5 @@ -288,10 +288,10 @@ * @return the transposed matrix */ public Matrix3f transpose(Matrix3f dest) { - + if (dest == null) dest = new Matrix3f(); - + if (this != dest) { m00 = dest.m00; m01 = dest.m10; @@ -304,9 +304,20 @@ m22 = dest.m22; } else transpose(); - + return this; - + + } + + /** + * @return the determinant of the matrix + */ + public float determinant() { + float f = + m00 * (m11 * m22 - m12 * m21) + + m01 * (m12 * m20 - m10 * m22) + + m02 * (m10 * m21 - m11 * m20); + return f; } /** |
From: Caspian Rychlik-P. <ci...@us...> - 2002-08-24 21:26:50
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/vector In directory usw-pr-cvs1:/tmp/cvs-serv12723/src/java/org/lwjgl/vector Modified Files: Matrix2f.java Matrix4f.java Matrix3f.java Log Message: Load & store into FloatBuffers 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.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Matrix2f.java 24 Aug 2002 21:12:31 -0000 1.3 +++ Matrix2f.java 24 Aug 2002 21:26:47 -0000 1.4 @@ -75,6 +75,37 @@ } /** + * Load from a float buffer. The buffer stores the matrix in column major + * (OpenGL) order. + * + * @param buf A float buffer to read from + * @return this + */ + public Matrix2f load(FloatBuffer buf) { + + m00 = buf.get(); + m10 = buf.get(); + m01 = buf.get(); + m11 = buf.get(); + + return this; + } + + /** + * Store this matrix in a float buffer. The matrix is stored in column + * major (openGL) order. + * @param buf The buffer to store this matrix in + */ + public void store(FloatBuffer buf) { + buf.put(m00); + buf.put(m10); + buf.put(m01); + buf.put(m11); + } + + + + /** * Add two matrices together and place the result in a third matrix. * @param left The left source matrix * @param right The right source matrix @@ -165,14 +196,14 @@ } /** - * Multiply a Vector by a matrix and return the result in a destination + * Transform a Vector by a matrix and return the result in a destination * vector. * @param left The left matrix * @param right The right vector * @param dest The destination vector, or null if a new one is to be created * @return the destination vector */ - public static Vector2f mul(Matrix2f left, Vector2f right, Vector2f dest) { + public static Vector2f transform(Matrix2f left, Vector2f right, Vector2f dest) { Vector2f temp = null; 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.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Matrix4f.java 24 Aug 2002 21:12:31 -0000 1.3 +++ Matrix4f.java 24 Aug 2002 21:26:47 -0000 1.4 @@ -31,6 +31,8 @@ */ package org.lwjgl.vector; +import java.nio.FloatBuffer; + /** * Holds a 4x4 float matrix. * @@ -124,6 +126,61 @@ return this; } + + /** + * Load from a float buffer. The buffer stores the matrix in column major + * (OpenGL) order. + * + * @param buf A float buffer to read from + * @return this + */ + public Matrix4f 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(); + m13 = buf.get(); + m23 = buf.get(); + m33 = buf.get(); + + return this; + } + + /** + * Store this matrix in a float buffer. The matrix is stored in column + * major (openGL) order. + * @param buf The buffer to store this matrix in + */ + public void 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(m13); + buf.put(m23); + buf.put(m33); + } + + /** * Add two matrices together and place the result in a third matrix. * @param left The left source matrix @@ -253,14 +310,14 @@ } /** - * Multiply a Vector by a matrix and return the result in a destination + * Transform a Vector by a matrix and return the result in a destination * vector. * @param left The left matrix * @param right The right vector * @param dest The destination vector, or null if a new one is to be created * @return the destination vector */ - public static Vector4f mul(Matrix4f left, Vector4f right, Vector4f dest) { + public static Vector4f transform(Matrix4f left, Vector4f right, Vector4f dest) { Vector4f temp = null; 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.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Matrix3f.java 24 Aug 2002 21:12:31 -0000 1.3 +++ Matrix3f.java 24 Aug 2002 21:26:47 -0000 1.4 @@ -31,6 +31,8 @@ */ package org.lwjgl.vector; +import java.nio.FloatBuffer; + /** * $Id$ * @@ -77,6 +79,47 @@ return this; } + + /** + * Load from a float buffer. The buffer stores the matrix in column major + * (OpenGL) order. + * + * @param buf A float buffer to read from + * @return this + */ + public Matrix3f load(FloatBuffer buf) { + + m00 = buf.get(); + m10 = 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; + } + + /** + * Store this matrix in a float buffer. The matrix is stored in column + * major (openGL) order. + * @param buf The buffer to store this matrix in + */ + public void 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(m12); + buf.put(m22); + } + + /** * Add two matrices together and place the result in a third matrix. @@ -193,14 +236,14 @@ } /** - * Multiply a Vector by a matrix and return the result in a destination + * Transform a Vector by a matrix and return the result in a destination * vector. * @param left The left matrix * @param right The right vector * @param dest The destination vector, or null if a new one is to be created * @return the destination vector */ - public static Vector3f mul(Matrix3f left, Vector3f right, Vector3f dest) { + public static Vector3f transform(Matrix3f left, Vector3f right, Vector3f dest) { Vector3f temp = null; |
From: Caspian Rychlik-P. <ci...@us...> - 2002-08-24 21:19:08
|
Update of /cvsroot/java-game-lib/LWJGL In directory usw-pr-cvs1:/tmp/cvs-serv10872 Added Files: .cvsignore Log Message: Checkpoint --- NEW FILE: .cvsignore --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/.cvsignore .classpath |
From: Caspian Rychlik-P. <ci...@us...> - 2002-08-24 21:18:46
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory usw-pr-cvs1:/tmp/cvs-serv10752/src/native/win32 Added Files: .cvsignore Log Message: Checkpoint --- NEW FILE: .cvsignore --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/.cvsignore Debug |
From: Caspian Rychlik-P. <ci...@us...> - 2002-08-24 21:17:39
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory usw-pr-cvs1:/tmp/cvs-serv10405/src/native/common Modified Files: org_lwjgl_input_Mouse.h .cvsignore Added Files: org_lwjgl_input_Joystick.h org_lwjgl_input_GamePad.h Log Message: Checkpoint --- NEW FILE: org_lwjgl_input_Joystick.h --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/org_lwjgl_input_Joystick.h /* DO NOT EDIT THIS FILE - it is machine generated */ #include <jni.h> /* Header for class org_lwjgl_input_Joystick */ #ifndef _Included_org_lwjgl_input_Joystick #define _Included_org_lwjgl_input_Joystick #ifdef __cplusplus extern "C" { #endif /* Inaccessible static: _00024assertionsDisabled */ /* Inaccessible static: created */ /* Inaccessible static: button */ /* Inaccessible static: x */ /* Inaccessible static: y */ /* Inaccessible static: z */ /* Inaccessible static: readBuffer */ /* Inaccessible static: readBufferAddress */ #undef org_lwjgl_input_Joystick_JOYSTICK_EVENT_SIZE #define org_lwjgl_input_Joystick_JOYSTICK_EVENT_SIZE 20L #undef org_lwjgl_input_Joystick_JOYSTICK_EVENT_STRIDE #define org_lwjgl_input_Joystick_JOYSTICK_EVENT_STRIDE 32L /* Inaccessible static: class_000240 */ /* * Class: org_lwjgl_input_Joystick * Method: initIDs * Signature: ()V */ JNIEXPORT void JNICALL Java_org_lwjgl_input_Joystick_initIDs (JNIEnv *, jclass); /* * Class: org_lwjgl_input_Joystick * Method: nCreate * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_input_Joystick_nCreate (JNIEnv *, jclass); /* * Class: org_lwjgl_input_Joystick * Method: nDestroy * Signature: ()V */ JNIEXPORT void JNICALL Java_org_lwjgl_input_Joystick_nDestroy (JNIEnv *, jclass); /* * Class: org_lwjgl_input_Joystick * Method: nPoll * Signature: ()V */ JNIEXPORT void JNICALL Java_org_lwjgl_input_Joystick_nPoll (JNIEnv *, jclass); /* * Class: org_lwjgl_input_Joystick * Method: nGetNumButtons * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_lwjgl_input_Joystick_nGetNumButtons (JNIEnv *, jclass); /* * Class: org_lwjgl_input_Joystick * Method: nHasZValue * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_input_Joystick_nHasZValue (JNIEnv *, jclass); /* * Class: org_lwjgl_input_Joystick * Method: nRead * Signature: (I)I */ JNIEXPORT jint JNICALL Java_org_lwjgl_input_Joystick_nRead (JNIEnv *, jclass, jint); /* * Class: org_lwjgl_input_Joystick * Method: nEnableBuffer * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_lwjgl_input_Joystick_nEnableBuffer (JNIEnv *, jclass); #ifdef __cplusplus } #endif #endif --- NEW FILE: org_lwjgl_input_GamePad.h --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/org_lwjgl_input_GamePad.h /* DO NOT EDIT THIS FILE - it is machine generated */ #include <jni.h> /* Header for class org_lwjgl_input_GamePad */ #ifndef _Included_org_lwjgl_input_GamePad #define _Included_org_lwjgl_input_GamePad #ifdef __cplusplus extern "C" { #endif /* Inaccessible static: _00024assertionsDisabled */ /* Inaccessible static: PAD_UP */ /* Inaccessible static: PAD_DOWN */ /* Inaccessible static: PAD_LEFT */ /* Inaccessible static: PAD_RIGHT */ /* Inaccessible static: PAD_BUTTON0 */ /* Inaccessible static: PAD_BUTTON1 */ /* Inaccessible static: PAD_BUTTON2 */ /* Inaccessible static: PAD_BUTTON3 */ /* Inaccessible static: PAD_BUTTON4 */ /* Inaccessible static: PAD_BUTTON5 */ /* Inaccessible static: PAD_BUTTON6 */ /* Inaccessible static: PAD_BUTTON7 */ /* Inaccessible static: PAD_BUTTON8 */ /* Inaccessible static: created */ /* Inaccessible static: buttonDownBuffer */ /* Inaccessible static: buttonDownAddress */ /* Inaccessible static: readBuffer */ /* Inaccessible static: readBufferAddress */ /* Inaccessible static: button */ /* Inaccessible static: state */ /* Inaccessible static: class_000240 */ /* * Class: org_lwjgl_input_GamePad * Method: initIDs * Signature: ()V */ JNIEXPORT void JNICALL Java_org_lwjgl_input_GamePad_initIDs (JNIEnv *, jclass); /* * Class: org_lwjgl_input_GamePad * Method: nCreate * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_input_GamePad_nCreate (JNIEnv *, jclass); /* * Class: org_lwjgl_input_GamePad * Method: nDestroy * Signature: ()V */ JNIEXPORT void JNICALL Java_org_lwjgl_input_GamePad_nDestroy (JNIEnv *, jclass); /* * Class: org_lwjgl_input_GamePad * Method: nPoll * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_input_GamePad_nPoll (JNIEnv *, jclass, jint); /* * Class: org_lwjgl_input_GamePad * Method: nRead * Signature: (I)I */ JNIEXPORT jint JNICALL Java_org_lwjgl_input_GamePad_nRead (JNIEnv *, jclass, jint); /* * Class: org_lwjgl_input_GamePad * Method: nEnableBuffer * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_lwjgl_input_GamePad_nEnableBuffer (JNIEnv *, jclass); /* * Class: org_lwjgl_input_GamePad * Method: nGetNumButtons * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_lwjgl_input_GamePad_nGetNumButtons (JNIEnv *, jclass); #ifdef __cplusplus } #endif #endif Index: org_lwjgl_input_Mouse.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/org_lwjgl_input_Mouse.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/org_lwjgl_input_Mouse.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- org_lwjgl_input_Mouse.h 11 Aug 2002 11:49:34 -0000 1.1.1.1 +++ org_lwjgl_input_Mouse.h 24 Aug 2002 21:17:37 -0000 1.2 @@ -13,6 +13,12 @@ /* Inaccessible static: dx */ /* Inaccessible static: dy */ /* Inaccessible static: dz */ +/* Inaccessible static: readBuffer */ +/* Inaccessible static: readBufferAddress */ +#undef org_lwjgl_input_Mouse_MOUSE_EVENT_SIZE +#define org_lwjgl_input_Mouse_MOUSE_EVENT_SIZE 20L +#undef org_lwjgl_input_Mouse_MOUSE_EVENT_STRIDE +#define org_lwjgl_input_Mouse_MOUSE_EVENT_STRIDE 32L /* Inaccessible static: class_000240 */ /* * Class: org_lwjgl_input_Mouse @@ -45,6 +51,38 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nPoll (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_input_Mouse + * Method: nGetNumButtons + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetNumButtons + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_input_Mouse + * Method: nHasZValue + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_input_Mouse_nHasZValue + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_input_Mouse + * Method: nEnableBuffer + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nEnableBuffer + (JNIEnv *, jclass); + +/* + * Class: org_lwjgl_input_Mouse + * Method: nRead + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nRead + (JNIEnv *, jclass, jint); #ifdef __cplusplus } Index: .cvsignore CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/.cvsignore =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- .cvsignore 24 Aug 2002 09:32:01 -0000 1.1 +++ .cvsignore 24 Aug 2002 21:17:37 -0000 1.2 @@ -1 +1,2 @@ Debug +Release |
From: Caspian Rychlik-P. <ci...@us...> - 2002-08-24 21:17:26
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/msvc In directory usw-pr-cvs1:/tmp/cvs-serv10358/src/native/msvc Modified Files: Native.dsp Log Message: Checkpoint Index: Native.dsp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/msvc/Native.dsp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/msvc/Native.dsp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Native.dsp 17 Aug 2002 14:13:12 -0000 1.4 +++ Native.dsp 24 Aug 2002 21:17:24 -0000 1.5 @@ -43,7 +43,7 @@ # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NATIVE_EXPORTS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "%JDK_HOME%\include" /I "..\common" /I "c:\j2sdk1.4.0\include" /I "c:\j2sdk1.4.0\include\win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NATIVE_EXPORTS" /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "%JDK_HOME%\include" /I "..\common" /I "c:\j2sdk1.4.0\include" /I "c:\j2sdk1.4.0\include\win32" /I "C:\Program Files\Creative Labs\OpenAL 1.0 SDK\Include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NATIVE_EXPORTS" /FD /c # SUBTRACT CPP /YX /Yc /Yu # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 @@ -54,7 +54,7 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dxguid.lib dinput.lib opengl32.lib glu32.lib /nologo /dll /machine:I386 /out:"..\..\..\bin\lwjgl.dll" /libpath:"c:\j2sdk1.4.0\lib" +# ADD LINK32 opengl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dxguid.lib dinput.lib glu32.lib openal32.lib alut.lib /nologo /dll /machine:I386 /out:"..\..\..\bin\lwjgl.dll" /libpath:"c:\j2sdk1.4.0\lib" /libpath:"C:\Program Files\Creative Labs\OpenAL 1.0 SDK\Libs" !ELSEIF "$(CFG)" == "Native - Win32 Debug" @@ -70,7 +70,7 @@ # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NATIVE_EXPORTS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\common" /I "c:\j2sdk1.4.0\include" /I "c:\j2sdk1.4.0\include\win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NATIVE_EXPORTS" /FR /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\common" /I "c:\j2sdk1.4.0\include" /I "c:\j2sdk1.4.0\include\win32" /I "C:\Program Files\Creative Labs\OpenAL 1.0 SDK\Include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NATIVE_EXPORTS" /FR /FD /GZ /c # SUBTRACT CPP /YX /Yc /Yu # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 @@ -81,7 +81,7 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 jvm.lib opengl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dxguid.lib dinput.lib glu32.lib /nologo /dll /debug /machine:I386 /out:"..\..\..\bin\lwjgl_d.dll" /pdbtype:sept /libpath:"c:\j2sdk1.4.0\lib" +# ADD LINK32 jvm.lib opengl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dxguid.lib dinput.lib glu32.lib openal32.lib alut.lib /nologo /dll /debug /machine:I386 /out:"..\..\..\bin\lwjgl_d.dll" /pdbtype:sept /libpath:"c:\j2sdk1.4.0\lib" /libpath:"C:\Program Files\Creative Labs\OpenAL 1.0 SDK\Libs" !ENDIF @@ -114,7 +114,71 @@ # End Source File # Begin Source File -SOURCE=..\win32\org_lwjgl_Math.cpp +SOURCE=..\win32\org_lwjgl_Math_MatrixOpAdd_MatrixOpDirect.cpp +# End Source File +# Begin Source File + +SOURCE=..\win32\org_lwjgl_Math_MatrixOpAdd_MatrixOpSafe.cpp +# End Source File +# Begin Source File + +SOURCE=..\win32\org_lwjgl_Math_MatrixOpCopy_MatrixOpDirect.cpp +# End Source File +# Begin Source File + +SOURCE=..\win32\org_lwjgl_Math_MatrixOpCopy_MatrixOpSafe.cpp +# End Source File +# Begin Source File + +SOURCE=..\win32\org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect.cpp +# End Source File +# Begin Source File + +SOURCE=..\win32\org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe.cpp +# End Source File +# Begin Source File + +SOURCE=..\win32\org_lwjgl_Math_MatrixOpMultiply_MatrixOpDirect.cpp +# End Source File +# Begin Source File + +SOURCE=..\win32\org_lwjgl_Math_MatrixOpMultiply_MatrixOpSafe.cpp +# End Source File +# Begin Source File + +SOURCE=..\win32\org_lwjgl_Math_MatrixOpNegate_MatrixOpDirect.cpp +# End Source File +# Begin Source File + +SOURCE=..\win32\org_lwjgl_Math_MatrixOpNegate_MatrixOpSafe.cpp +# End Source File +# Begin Source File + +SOURCE=..\win32\org_lwjgl_Math_MatrixOpNormalise_MatrixOpDirect.cpp +# End Source File +# Begin Source File + +SOURCE=..\win32\org_lwjgl_Math_MatrixOpNormalise_MatrixOpSafe.cpp +# End Source File +# Begin Source File + +SOURCE=..\win32\org_lwjgl_Math_MatrixOpSubtract_MatrixOpDirect.cpp +# End Source File +# Begin Source File + +SOURCE=..\win32\org_lwjgl_Math_MatrixOpSubtract_MatrixOpSafe.cpp +# End Source File +# Begin Source File + +SOURCE=..\win32\org_lwjgl_openal_ALC.cpp +# End Source File +# Begin Source File + +SOURCE=..\win32\org_lwjgl_openal_ALUT.cpp +# End Source File +# Begin Source File + +SOURCE=..\win32\org_lwjgl_openal_CoreAL.cpp # End Source File # Begin Source File @@ -154,6 +218,14 @@ # End Source File # Begin Source File +SOURCE=..\common\org_lwjgl_input_GamePad.h +# End Source File +# Begin Source File + +SOURCE=..\common\org_lwjgl_input_Joystick.h +# End Source File +# Begin Source File + SOURCE=..\common\org_lwjgl_input_Keyboard.h # End Source File # Begin Source File @@ -162,7 +234,99 @@ # End Source File # Begin Source File -SOURCE=..\common\org_lwjgl_Math.h +SOURCE=..\common\org_lwjgl_Math_MatrixOpAdd_MatrixOpDirect.h +# End Source File +# Begin Source File + +SOURCE=..\common\org_lwjgl_Math_MatrixOpAdd_MatrixOpOffset.h +# End Source File +# Begin Source File + +SOURCE=..\common\org_lwjgl_Math_MatrixOpAdd_MatrixOpSafe.h +# End Source File +# Begin Source File + +SOURCE=..\common\org_lwjgl_Math_MatrixOpCopy_MatrixOpDirect.h +# End Source File +# Begin Source File + +SOURCE=..\common\org_lwjgl_Math_MatrixOpCopy_MatrixOpOffset.h +# End Source File +# Begin Source File + +SOURCE=..\common\org_lwjgl_Math_MatrixOpCopy_MatrixOpSafe.h +# End Source File +# Begin Source File + +SOURCE=..\common\org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect.h +# End Source File +# Begin Source File + +SOURCE=..\common\org_lwjgl_Math_MatrixOpInvert_MatrixOpOffset.h +# End Source File +# Begin Source File + +SOURCE=..\common\org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe.h +# End Source File +# Begin Source File + +SOURCE=..\common\org_lwjgl_Math_MatrixOpMultiply_MatrixOpDirect.h +# End Source File +# Begin Source File + +SOURCE=..\common\org_lwjgl_Math_MatrixOpMultiply_MatrixOpOffset.h +# End Source File +# Begin Source File + +SOURCE=..\common\org_lwjgl_Math_MatrixOpMultiply_MatrixOpSafe.h +# End Source File +# Begin Source File + +SOURCE=..\common\org_lwjgl_Math_MatrixOpNegate_MatrixOpDirect.h +# End Source File +# Begin Source File + +SOURCE=..\common\org_lwjgl_Math_MatrixOpNegate_MatrixOpOffset.h +# End Source File +# Begin Source File + +SOURCE=..\common\org_lwjgl_Math_MatrixOpNegate_MatrixOpSafe.h +# End Source File +# Begin Source File + +SOURCE=..\common\org_lwjgl_Math_MatrixOpNormalise_MatrixOpDirect.h +# End Source File +# Begin Source File + +SOURCE=..\common\org_lwjgl_Math_MatrixOpNormalise_MatrixOpOffset.h +# End Source File +# Begin Source File + +SOURCE=..\common\org_lwjgl_Math_MatrixOpNormalise_MatrixOpSafe.h +# End Source File +# Begin Source File + +SOURCE=..\common\org_lwjgl_Math_MatrixOpSubtract_MatrixOpDirect.h +# End Source File +# Begin Source File + +SOURCE=..\common\org_lwjgl_Math_MatrixOpSubtract_MatrixOpOffset.h +# End Source File +# Begin Source File + +SOURCE=..\common\org_lwjgl_Math_MatrixOpSubtract_MatrixOpSafe.h +# End Source File +# Begin Source File + +SOURCE=..\common\org_lwjgl_openal_ALC.h +# End Source File +# Begin Source File + +SOURCE=..\common\org_lwjgl_openal_ALUT.h +# End Source File +# Begin Source File + +SOURCE=..\common\org_lwjgl_openal_CoreAL.h # End Source File # Begin Source File |
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory usw-pr-cvs1:/tmp/cvs-serv10185/src/native/win32 Modified Files: LWJGL.cpp org_lwjgl_Display.cpp org_lwjgl_Math.cpp Added Files: org_lwjgl_Math_MatrixOpSubtract_MatrixOpSafe.cpp org_lwjgl_Math_MatrixOpNegate_MatrixOpDirect.cpp org_lwjgl_Math_MatrixOpCopy_MatrixOpSafe.cpp org_lwjgl_Math_MatrixOpNormalise_MatrixOpDirect.cpp org_lwjgl_Math_MatrixOpAdd_MatrixOpDirect.cpp org_lwjgl_Math_MatrixOpMultiply_MatrixOpSafe.cpp org_lwjgl_Math_MatrixOpNormalise_MatrixOpSafe.cpp org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe.cpp org_lwjgl_Math_MatrixOpMultiply_MatrixOpDirect.cpp org_lwjgl_Math_MatrixOpSubtract_MatrixOpDirect.cpp org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect.cpp org_lwjgl_Math_MatrixOpCopy_MatrixOpDirect.cpp org_lwjgl_Math_MatrixOpNegate_MatrixOpSafe.cpp org_lwjgl_Math_MatrixOpAdd_MatrixOpSafe.cpp Log Message: Checkpoint --- NEW FILE: 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 /* * 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_MatrixOpSubtract_MatrixOpSafe.h" /* * Class: org_lwjgl_Math_MatrixOpSubtract_MatrixOpSafe * Method: execute * Signature: (IIIIIZIIIIIZIIZ)V */ JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpSubtract_00024MatrixOpSafe_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; } --- NEW FILE: 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 /* * 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_MatrixOpNegate_MatrixOpDirect.h" /* * Class: org_lwjgl_Math_MatrixOpNegate_MatrixOpDirect * Method: execute * Signature: (IIIIIZIIZ)V */ JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpNegate_00024MatrixOpDirect_execute ( JNIEnv * env, jobject obj, jint sourceAddress, jint sourceStride, jint numElements, jint sourceWidth, jint sourceHeight, jboolean transposeSource, jint destAddress, jint destStride, jboolean transposeDest ) { float * source = (float *) sourceAddress; float * dest = (float *) destAddress; } --- NEW FILE: 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 /* * 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_MatrixOpCopy_MatrixOpSafe.h" /* * Class: org_lwjgl_Math_MatrixOpCopy_MatrixOpSafe * Method: execute * Signature: (IIIIIZIIZ)V */ JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpCopy_00024MatrixOpSafe_execute ( JNIEnv * env, jobject obj, jint sourceAddress, jint sourceStride, jint numElements, jint sourceWidth, jint sourceHeight, jboolean transposeSource, jint destAddress, jint destStride, jboolean transposeDest ) { float * source = (float *) sourceAddress; float * dest = (float *) destAddress; } --- NEW FILE: 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 /* * 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_MatrixOpNormalise_MatrixOpDirect.h" /* * Class: org_lwjgl_Math_MatrixOpNormalise_MatrixOpDirect * Method: execute * Signature: (IIIIIZIIZ)V */ JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpNormalise_00024MatrixOpDirect_execute ( JNIEnv * env, jobject obj, jint sourceAddress, jint sourceStride, jint numElements, jint sourceWidth, jint sourceHeight, jboolean transposeSource, jint destAddress, jint destStride, jboolean transposeDest ) { float * source = (float *) sourceAddress; float * dest = (float *) destAddress; } --- NEW FILE: 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 /* * 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; } --- NEW FILE: 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 /* * 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_MatrixOpMultiply_MatrixOpSafe.h" /* * Class: org_lwjgl_Math_MatrixOpMultiply_MatrixOpSafe * Method: execute * Signature: (IIIIIZIIIIIZIIZ)V */ JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpMultiply_00024MatrixOpSafe_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; } --- NEW FILE: 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 /* * 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_MatrixOpSubtract_MatrixOpSafe.h" /* * Class: org_lwjgl_Math_MatrixOpNormalise_MatrixOpSafe * Method: execute * Signature: (IIIIIZIIZ)V */ JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpNormalise_00024MatrixOpSafe_execute ( JNIEnv * env, jobject obj, jint sourceAddress, jint sourceStride, jint numElements, jint sourceWidth, jint sourceHeight, jboolean transposeSource, jint destAddress, jint destStride, jboolean transposeDest ) { float * source = (float *) sourceAddress; float * dest = (float *) destAddress; } --- NEW FILE: 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 /* * 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_MatrixOpInvert_MatrixOpSafe.h" /* * Class: org_lwjgl_Math_MatrixOpInvert_MatrixOpSafe * Method: execute * Signature: (IIIIIZIIZ)V */ JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpInvert_00024MatrixOpSafe_execute ( JNIEnv * env, jobject obj, jint sourceAddress, jint sourceStride, jint numElements, jint sourceWidth, jint sourceHeight, jboolean transposeSource, jint destAddress, jint destStride, jboolean transposeDest ) { float * source = (float *) sourceAddress; float * dest = (float *) destAddress; } --- NEW FILE: 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 /* * 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_MatrixOpMultiply_MatrixOpDirect.h" /* * Class: org_lwjgl_Math_MatrixOpMultiply_MatrixOpDirect * Method: execute * Signature: (IIIIIZIIIIIZIIZ)V */ JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpMultiply_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; } --- NEW FILE: 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 /* * 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_MatrixOpSubtract_MatrixOpDirect.h" /* * Class: org_lwjgl_Math_MatrixOpSubtract_MatrixOpDirect * Method: execute * Signature: (IIIIIZIIIIIZIIZ)V */ JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpSubtract_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; } --- NEW FILE: 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 /* * 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_MatrixOpInvert_MatrixOpDirect.h" /* * Class: org_lwjgl_Math_MatrixOpInvert_MatrixOpDirect * Method: execute * Signature: (IIIIIZIIZ)V */ JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpInvert_00024MatrixOpDirect_execute ( JNIEnv * env, jobject obj, jint sourceAddress, jint sourceStride, jint numElements, jint sourceWidth, jint sourceHeight, jboolean transposeSource, jint destAddress, jint destStride, jboolean transposeDest ) { float * source = (float *) sourceAddress; float * dest = (float *) destAddress; } --- NEW FILE: 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 /* * 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_MatrixOpCopy_MatrixOpDirect.h" /* * Class: org_lwjgl_Math_MatrixOpCopy_MatrixOpDirect * Method: execute * Signature: (IIIIIZIIZ)V */ JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpCopy_00024MatrixOpDirect_execute ( JNIEnv * env, jobject obj, jint sourceAddress, jint sourceStride, jint numElements, jint sourceWidth, jint sourceHeight, jboolean transposeSource, jint destAddress, jint destStride, jboolean transposeDest ) { float * source = (float *) sourceAddress; float * dest = (float *) destAddress; } --- NEW FILE: 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 /* * 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_MatrixOpNegate_MatrixOpSafe.h" /* * Class: org_lwjgl_Math_MatrixOpNegate_MatrixOpSafe * Method: execute * Signature: (IIIIIZIIZ)V */ JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpNegate_00024MatrixOpSafe_execute ( JNIEnv * env, jobject obj, jint sourceAddress, jint sourceStride, jint numElements, jint sourceWidth, jint sourceHeight, jboolean transposeSource, jint destAddress, jint destStride, jboolean transposeDest ) { float * source = (float *) sourceAddress; float * dest = (float *) destAddress; } --- NEW FILE: 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 /* * 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_MatrixOpSafe.h" /* * Class: org_lwjgl_Math_MatrixOpAdd_MatrixOpSafe * Method: execute * Signature: (IIIIIZIIIIIZIIZ)V */ JNIEXPORT void JNICALL Java_org_lwjgl_Math_00024MatrixOpAdd_00024MatrixOpSafe_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; } Index: LWJGL.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/LWJGL.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/LWJGL.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- LWJGL.cpp 17 Aug 2002 14:13:11 -0000 1.3 +++ LWJGL.cpp 24 Aug 2002 21:16:53 -0000 1.4 @@ -42,7 +42,6 @@ #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <stdio.h> -#include "LWJGL.h" /* * DLL entry point for Windows. Called when Java loads the .dll Index: org_lwjgl_Display.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Display.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Display.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- org_lwjgl_Display.cpp 17 Aug 2002 14:13:12 -0000 1.4 +++ org_lwjgl_Display.cpp 24 Aug 2002 21:16:53 -0000 1.5 @@ -129,7 +129,39 @@ JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_Display_getAvailableDisplayModes (JNIEnv * env, jclass clazz) { - return NULL; + + DEVMODE mode; + + // First count the number of display modes. + int i = 0, n = 0; + while (EnumDisplaySettings(NULL, i ++, &mode) != 0) { + // Filter out indexed modes + if (mode.dmBitsPerPel < 16) { + continue; + } else + n ++; + } + ; // Do nothing + + // Allocate an array of DisplayModes big enough + jclass displayModeClass = env->FindClass("org/lwjgl/DisplayMode"); + jobjectArray ret = env->NewObjectArray(n, displayModeClass, NULL); + jmethodID displayModeConstructor = env->GetMethodID(displayModeClass, "<init>", "(IIII)V"); + + i = n = 0; + while (EnumDisplaySettings(NULL, i ++, &mode) != 0) { + // Filter out indexed modes + if (mode.dmBitsPerPel < 16) { + continue; + } else { + jobject displayMode = env->NewObject(displayModeClass, displayModeConstructor, mode.dmPelsWidth, mode.dmPelsHeight, + mode.dmBitsPerPel, mode.dmDisplayFrequency); + + env->SetObjectArrayElement(ret, n ++, displayMode); + } + } + + return ret; } /* @@ -138,13 +170,13 @@ * Signature: (IIIIZ)Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_Display_nCreate - (JNIEnv * env, jclass clazz, jint width, jint height, jint bpp, jint freq, jboolean debug) + (JNIEnv * env, jclass clazz, jint width, jint height, jint bpp, jint freq, jboolean fullscreen) { #ifdef _DEBUG printf("Creating display: size %dx%d %dhz %dbpp...\n", width, height, freq, bpp); #endif - if (!debug && SetDisplayMode(width, height, bpp, freq) != 1) + if (fullscreen && SetDisplayMode(width, height, bpp, freq) != 1) return JNI_FALSE; /* Index: org_lwjgl_Math.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Math.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- org_lwjgl_Math.cpp 15 Aug 2002 15:43:02 -0000 1.2 +++ org_lwjgl_Math.cpp 24 Aug 2002 21:16:53 -0000 1.3 @@ -43,111 +43,3 @@ #include "org_lwjgl_Math.h" #include "math.h" -/* - * Class: org_lwjgl_Math - * Method: random - * Signature: ()F - */ -JNIEXPORT jfloat JNICALL Java_org_lwjgl_Math_random - (JNIEnv * env, jclass clazz) -{ - return 0.0f; -} - -/* - * Class: org_lwjgl_Math - * Method: sin - * Signature: (F)F - */ -JNIEXPORT jfloat JNICALL Java_org_lwjgl_Math_sin - (JNIEnv * env, jclass clazz, jfloat theta) -{ - return 0.0f; -} - -/* - * Class: org_lwjgl_Math - * Method: cos - * Signature: (F)F - */ -JNIEXPORT jfloat JNICALL Java_org_lwjgl_Math_cos - (JNIEnv * env, jclass clazz, jfloat theta) -{ - return 0.0f; -} - -/* - * Class: org_lwjgl_Math - * Method: tan - * Signature: (F)F - */ -JNIEXPORT jfloat JNICALL Java_org_lwjgl_Math_tan - (JNIEnv * env, jclass clazz, jfloat theta) -{ - return 0.0f; -} - -/* - * Class: org_lwjgl_Math - * Method: asin - * Signature: (F)F - */ -JNIEXPORT jfloat JNICALL Java_org_lwjgl_Math_asin - (JNIEnv * env, jclass clazz, jfloat theta) -{ - return 0.0f; -} - -/* - * Class: org_lwjgl_Math - * Method: acos - * Signature: (F)F - */ -JNIEXPORT jfloat JNICALL Java_org_lwjgl_Math_acos - (JNIEnv * env, jclass clazz, jfloat theta) -{ - return 0.0f; -} - -/* - * Class: org_lwjgl_Math - * Method: atan - * Signature: (F)F - */ -JNIEXPORT jfloat JNICALL Java_org_lwjgl_Math_atan - (JNIEnv * env, jclass clazz, jfloat theta) -{ - return 0.0f; -} - -/* - * Class: org_lwjgl_Math - * Method: sqrt - * Signature: (F)F - */ -JNIEXPORT jfloat JNICALL Java_org_lwjgl_Math_sqrt - (JNIEnv * env, jclass clazz, jfloat value) -{ - return 0.0f; -} - -/* - * Class: org_lwjgl_Math - * Method: matrixOp - * Signature: (IIIIIIZIIZ)V - */ -JNIEXPORT void JNICALL Java_org_lwjgl_Math_matrixOp__IIIIIIZIIZ - (JNIEnv * env, jclass clazz, jint, jint, jint, jint, jint, jint, jboolean, jint, jint, jboolean) -{ -} - -/* - * Class: org_lwjgl_Math - * Method: matrixOp - * Signature: (IIIIIZIIIIZIIZ)V - */ -JNIEXPORT void JNICALL Java_org_lwjgl_Math_matrixOp__IIIIIZIIIIZIIZ - (JNIEnv * env, jclass clazz, jint, jint, jint, jint, jint, jboolean, jint, jint, jint, jint, jboolean, jint, jint, jboolean) -{ -} - |
From: Caspian Rychlik-P. <ci...@us...> - 2002-08-24 21:15:05
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory usw-pr-cvs1:/tmp/cvs-serv9752/src/java/org/lwjgl/opengl Modified Files: GL.java Log Message: Checkpoint 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.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- GL.java 19 Aug 2002 14:01:03 -0000 1.6 +++ GL.java 24 Aug 2002 21:15:03 -0000 1.7 @@ -1520,6 +1520,10 @@ public boolean SGIS_generate_mipmap; public boolean SGIX_shadow; public boolean SGIX_depth_texture; + public boolean OpenGL11; + public boolean OpenGL12; + public boolean OpenGL13; + public boolean OpenGL14; /** * Constructor for GL. @@ -1559,6 +1563,22 @@ } + // Let's see what openGL version we are too: + String version = getString(VERSION); + int i = version.indexOf("1."); + if (i > -1) { + char c = version.charAt(i + 2); + if (c == '2') { + OpenGL12 = true; + } else if (c == '3') { + OpenGL12 = true; + OpenGL13 = true; + } else if (c == '4') { + OpenGL12 = true; + OpenGL13 = true; + OpenGL14 = true; + } + } } /* @@ -1570,6 +1590,7 @@ public static boolean WGL_ARB_pixel_format; public static boolean WGL_ARB_render_texture; public static boolean WGL_EXT_extensions_string; + public static boolean WGL_EXT_swap_control; /** * Checks and sets WGL_EXT_extensions_string and WGL_ARB_extensions_string @@ -1601,10 +1622,13 @@ exts = wglGetExtensionsStringARB(Display.getHandle()); // Remember - this is an HWND not an HDC, which is what's required else exts = wglGetExtensionsStringEXT(); - + + System.out.println("Available WGL extensions:"); StringTokenizer st = new StringTokenizer(exts); while (st.hasMoreTokens()) { String ext = st.nextToken(); + + System.out.println(ext); Field f = (Field) map.get(ext); if (f != null) { |
From: Caspian Rychlik-P. <ci...@us...> - 2002-08-24 21:14:42
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input In directory usw-pr-cvs1:/tmp/cvs-serv9668/src/java/org/lwjgl/input Modified Files: GamePad.java Joystick.java Mouse.java Log Message: Buffering added 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.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- GamePad.java 20 Aug 2002 14:55:29 -0000 1.4 +++ GamePad.java 24 Aug 2002 21:14:40 -0000 1.5 @@ -167,7 +167,8 @@ private static native void nPoll(int keyDownBufferAddress); /** - * Reads the gamepad buffer. + * Reads the gamepad buffer. Call next() to read the events one by one. + * @see #next() */ public static void read() { assert created : "The gamepad has not been created."; 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.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Joystick.java 20 Aug 2002 14:55:29 -0000 1.4 +++ Joystick.java 24 Aug 2002 21:14:40 -0000 1.5 @@ -32,6 +32,8 @@ package org.lwjgl.input; +import java.nio.ByteBuffer; + import org.lwjgl.Display; import org.lwjgl.Sys; @@ -72,6 +74,20 @@ public static float z; /** + * The joystick events from the last read: a sequence of Events + */ + private static ByteBuffer readBuffer; + + /** Address of the read buffer */ + private static int readBufferAddress; + + /** The size in bytes of a single joystick event */ + private static final int JOYSTICK_EVENT_SIZE = 20; + + /** The stride in bytes of a single joystick event */ + private static final int JOYSTICK_EVENT_STRIDE = 32; + + /** * Joystick cannot be constructed. */ private Joystick() { @@ -166,4 +182,66 @@ * Native implementation of hasZValue() */ private static native boolean nHasZValue(); + + /** + * Enable joystick buffering. Must be called after the joystick is created. + * @return the size of the joystick buffer in events, or 0 if no buffering + * can be enabled for any reason + */ + public static int enableBuffer() { + assert created : "The joystick has not been created."; + return nEnableBuffer(); + } + + /** + * Native method to read the joystick buffer + * + * @param readBufferAddress the address of the joystick buffer + * @return the number of joystick events read + */ + private static native int nRead(int readBufferAddress); + + /** + * Reads the joystick buffer. + */ + public static void read() { + assert created : "The joystick has not been created."; + assert readBuffer != null : "Joystick buffering has not been enabled."; + readBuffer.clear(); + readBuffer.limit(nRead(readBufferAddress) << 1); + } + + /** + * Native method to enable the buffer + * @return the size of the buffer allocated, in events (1 event is 2 bytes), + * or 0 if no buffer can be allocated + */ + private static native int nEnableBuffer(); + + /** + * Gets the next joystick event. This returns its results as if a poll() had + * been called. + * + * @return true if a joystick event was read, false otherwise + */ + public static boolean next() { + assert created : "The joystick has not been created."; + assert readBuffer != null : "Joystick buffering has not been enabled."; + + if (readBuffer.hasRemaining()) { + x = readBuffer.getFloat(); + y = readBuffer.getFloat(); + z = readBuffer.getFloat(); + for (int i = 0; i < button.length; i ++) + button[i] = readBuffer.get() != (byte)0; + readBuffer.position(readBuffer.position() + (JOYSTICK_EVENT_STRIDE - JOYSTICK_EVENT_SIZE)); + return true; + } else + return false; + + } + + + + } 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.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Mouse.java 20 Aug 2002 14:55:29 -0000 1.6 +++ Mouse.java 24 Aug 2002 21:14:40 -0000 1.7 @@ -32,6 +32,8 @@ package org.lwjgl.input; +import java.nio.ByteBuffer; + import org.lwjgl.Display; import org.lwjgl.Sys; @@ -40,7 +42,6 @@ * * A raw Mouse interface. This can be used to poll the current state of the * mouse buttons, and determine the mouse movement delta since the last poll. - * No buffering is available. * * Up to 8 buttons are available. A scrolly wheel, if present, is the z * value. This will be in the range of -10000 to +10000. @@ -70,6 +71,21 @@ public static int dz; /** + * The mouse events from the last read: a sequence of Events + */ + private static ByteBuffer readBuffer; + + /** Address of the read buffer */ + private static int readBufferAddress; + + /** The size in bytes of a single mouse event */ + private static final int MOUSE_EVENT_SIZE = 20; + + /** The stride in bytes of a single mouse event */ + private static final int MOUSE_EVENT_STRIDE = 32; + + + /** * Mouse cannot be constructed. */ private Mouse() { @@ -164,4 +180,69 @@ * Native implementation of hasZValue() */ private static native boolean nHasZValue(); + + /** + * Enable mouse buffering. Must be called after the mouse is created. + * @return the size of the mouse buffer in events, or 0 if no buffering + * can be enabled for any reason + */ + public static int enableBuffer() { + assert created : "The mouse has not been created."; + return nEnableBuffer(); + } + + + /** + * Native method to enable the buffer + * @return the size of the buffer allocated, in events (1 event is 2 bytes), + * or 0 if no buffer can be allocated + */ + private static native int nEnableBuffer(); + + + /** + * Gets the next mouse event. This returns its results as if a poll() had + * been called. + * + * @return true if a mouse event was read, false otherwise + */ + public static boolean next() { + assert created : "The mouse has not been created."; + assert readBuffer != null : "Mouse buffering has not been enabled."; + + if (readBuffer.hasRemaining()) { + dx = readBuffer.getInt(); + dy = readBuffer.getInt(); + dz = readBuffer.getInt(); + for (int i = 0; i < button.length; i ++) + button[i] = readBuffer.get() != (byte)0; + readBuffer.position(readBuffer.position() + (MOUSE_EVENT_STRIDE - MOUSE_EVENT_SIZE)); + return true; + } else + return false; + + } + + + /** + * Native method to read the gamepad buffer + * + * @param readBufferAddress the address of the mouse buffer + * @return the number of mouse events read + */ + private static native int nRead(int readBufferAddress); + + + /** + * Reads the mouse buffer. + */ + public static void read() { + assert created : "The mouse has not been created."; + assert readBuffer != null : "Mouse buffering has not been enabled."; + readBuffer.clear(); + readBuffer.limit(nRead(readBufferAddress) * MOUSE_EVENT_SIZE); + } + + + } |
From: Caspian Rychlik-P. <ci...@us...> - 2002-08-24 21:12:35
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/vector In directory usw-pr-cvs1:/tmp/cvs-serv9050/src/java/org/lwjgl/vector Modified Files: Matrix2f.java Vector3f.java Matrix4f.java Vector2f.java Vector4f.java Matrix3f.java Log Message: Bunch of matrix and vector code added 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.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Matrix2f.java 16 Aug 2002 21:52:25 -0000 1.2 +++ Matrix2f.java 24 Aug 2002 21:12:31 -0000 1.3 @@ -36,20 +36,258 @@ /** * $Id$ * - * Holds a 2x2 matrix. - * + * Holds a 2x2 matrix + * * @author cix_foo <ci...@us...> * @version $Revision$ */ public class Matrix2f { - public float m00, m01, m10, m11; + public float m00 = 1.0f, m01, m10, m11 = 1.0f; /** * Constructor for Matrix2f. */ public Matrix2f() { } + + /** + * Constructor + */ + public Matrix2f(Matrix2f src) { + load(src); + } + + /** + * Load from another matrix2f + * @param src The source matrix + * @return this + */ + public Matrix2f load(Matrix2f src) { + + m00 = src.m00; + m01 = src.m01; + m10 = src.m10; + m11 = src.m11; + + return this; + } + + /** + * Add two matrices together and place the result in a third matrix. + * @param left The left source matrix + * @param right The right source matrix + * @param dest The destination matrix, or null if a new one is to be created + * @return the destination matrix + */ + public static Matrix2f add(Matrix2f left, Matrix2f right, Matrix2f dest) { + + Matrix2f temp = null; + + if (dest == null) + dest = new Matrix2f(); + else if (dest == left || dest == right) { + temp = dest; + dest = new Matrix2f(); + } + + dest.m00 = left.m00 + right.m00; + dest.m01 = left.m01 + right.m01; + dest.m10 = left.m10 + right.m10; + dest.m11 = left.m11 + right.m11; + + if (temp != null) { + temp.load(dest); + return temp; + } else + return dest; + } + + /** + * Subtract the right matrix from the left and place the result in a third matrix. + * @param left The left source matrix + * @param right The right source matrix + * @param dest The destination matrix, or null if a new one is to be created + * @return the destination matrix + */ + public static Matrix2f sub(Matrix2f left, Matrix2f right, Matrix2f dest) { + + Matrix2f temp = null; + + if (dest == null) + dest = new Matrix2f(); + else if (dest == left || dest == right) { + temp = dest; + dest = new Matrix2f(); + } + + dest.m00 = left.m00 - right.m00; + dest.m01 = left.m01 - right.m01; + dest.m10 = left.m10 - right.m10; + dest.m11 = left.m11 - right.m11; + + if (temp != null) { + temp.load(dest); + return temp; + } else + return dest; + } + + /** + * Multiply the right matrix by the left and place the result in a third matrix. + * @param left The left source matrix + * @param right The right source matrix + * @param dest The destination matrix, or null if a new one is to be created + * @return the destination matrix + */ + public static Matrix2f mul(Matrix2f left, Matrix2f right, Matrix2f dest) { + + Matrix2f temp = null; + + if (dest == null) + dest = new Matrix2f(); + else if (dest == left || dest == right) { + temp = dest; + dest = new Matrix2f(); + } + + dest.m00 = left.m00 * right.m00 + left.m10 * right.m01; + dest.m01 = left.m01 * right.m00 + left.m11 * right.m01; + dest.m10 = left.m00 * right.m10 + left.m10 * right.m11; + dest.m11 = left.m01 * right.m10 + left.m11 * right.m11; + + if (temp != null) { + temp.load(dest); + return temp; + } else + return dest; + } + + /** + * Multiply a Vector by a matrix and return the result in a destination + * vector. + * @param left The left matrix + * @param right The right vector + * @param dest The destination vector, or null if a new one is to be created + * @return the destination vector + */ + public static Vector2f mul(Matrix2f left, Vector2f right, Vector2f dest) { + + Vector2f temp = null; + + if (dest == null) + dest = new Vector2f(); + else if (dest == right) { + temp = dest; + dest = new Vector2f(); + } + + dest.x = left.m00 * right.x + left.m10 * right.y; + dest.y = left.m01 * right.x + left.m11 * right.y; + + if (temp != null) { + temp.set(dest); + return temp; + } else + return dest; + } + + /** + * Transpose this matrix + * @return this + */ + public Matrix2f transpose() { + float temp; + + temp = m01; + m01 = m10; + m10 = temp; + return this; + } + + /** + * 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 + */ + public Matrix2f transpose(Matrix2f dest) { + + if (dest == null) + dest = new Matrix2f(); + + if (dest == this) + transpose(); + else { + dest.m01 = m10; + dest.m10 = m01; + } + + return dest; + } + /** + * Invert this matrix + * @return this + */ + public Matrix2f invert() { + return this; + } + + /** + * Negate this matrix + * @return this + */ + public Matrix2f negate() { + + m00 = -m00; + m01 = -m01; + m10 = -m10; + m11 = -m11; + + return this; + } + + /** + * Negate this matrix and stash the result in another matrix. + * @param dest The destination matrix, or null if a new matrix is to be created + * @return the negated matrix + */ + public Matrix2f negate(Matrix2f dest) { + + if (dest == null) + dest = new Matrix2f(); + + dest.m00 = -m00; + dest.m01 = -m01; + dest.m10 = -m10; + dest.m11 = -m11; + + return dest; + } + + /** + * Set this matrix to be the identity matrix. + * @return this + */ + public Matrix2f identity() { + m00 = 1.0f; + m01 = 0.0f; + m10 = 0.0f; + m11 = 1.0f; + return this; + } + + /** + * Set this matrix to 0. + * @return this + */ + public Matrix2f zero() { + m00 = 0.0f; + m01 = 0.0f; + m10 = 0.0f; + m11 = 0.0f; + return this; + } + } 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.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Vector3f.java 16 Aug 2002 21:52:26 -0000 1.2 +++ Vector3f.java 24 Aug 2002 21:12:31 -0000 1.3 @@ -31,6 +31,8 @@ */ package org.lwjgl.vector; +import org.lwjgl.Math; + /** * $Id$ * @@ -50,5 +52,134 @@ public Vector3f() { super(); } + + /** + * Constructor + */ + public Vector3f(Vector3f src) { + set(src); + } + + /** + * Constructor + */ + public Vector3f(float x, float y, float z) { + set(x, y, z); + } + /** + * Set values + * @return this + */ + public Vector3f set(float x, float y, float z) { + this.x = x; + this.y = y; + this.z = z; + return this; + } + + /** + * Load from another Vector3f + * @param src The source vector + * @return this + */ + public Vector3f set(Vector3f src) { + x = src.x; + y = src.y; + z = src.z; + return this; + } + + /** + * @return the length of the vector + */ + public float length() { + return Math.sqrt(lengthSquared()); + } + + /** + * @return the length squared of the vector + */ + public float lengthSquared() { + return x * x + y * y + z * z; + } + + /** + * Translate a vector + * @param x The translation in x + * @param y the translation in y + * @return this + */ + public Vector3f translate(float x, float y, float z) { + this.x += x; + this.y += y; + this.z += z; + return this; + } + + /** + * Negate a vector + * @return this + */ + public Vector3f negate() { + x = -x; + y = -y; + z = -z; + return this; + } + + /** + * Normalise this vector + * @return this + */ + public Vector3f normalise() { + float l = 1.0f / length(); + x *= l; + y *= l; + z *= l; + return this; + } + + /** + * Normalise this vector and place the result in another vector. + * @param dest The destination vector, or null if a new vector is to be created + * @return the normalised vector + */ + public Vector3f normalise(Vector3f dest) { + float l = length(); + + if (dest == null) + dest = new Vector3f(x / l, y / l, z / l); + else + dest.set(x / l, y / l, z / l); + + return dest; + } + + /** + * The dot product of two vectors is calculated as + * 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 + */ + public static float dot(Vector3f left, Vector3f right) { + return left.x * right.x + left.y * right.y + left.z * right.z; + } + + /** + * Calculate the angle between two vectors, in degrees + * @param a A vector + * @param b The other vector + * @return the angle between the two vectors, in degrees + */ + public static float angle(Vector3f a, Vector3f b) { + float dls = dot(a, b) / (a.length() * b.length()); + if (dls < -1f) + dls = -1f; + else if (dls > 1.0f) + dls = 1.0f; + return Math.acos(dls); + } + } 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.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Matrix4f.java 16 Aug 2002 21:52:26 -0000 1.2 +++ Matrix4f.java 24 Aug 2002 21:12:31 -0000 1.3 @@ -37,14 +37,371 @@ * @author foo */ public class Matrix4f { + /** + * Set this matrix to be the identity matrix. + * @return this + */ + public Matrix4f setIdentity() { + m00 = 1.0f; + m01 = 0.0f; + m02 = 0.0f; + m03 = 0.0f; + m10 = 0.0f; + m11 = 1.0f; + m12 = 0.0f; + m13 = 0.0f; + m20 = 0.0f; + m21 = 0.0f; + m22 = 1.0f; + m23 = 0.0f; + m30 = 0.0f; + m31 = 0.0f; + m32 = 0.0f; + m33 = 1.0f; + + return this; + } + + + /** + * Set this matrix to 0. + * @return this + */ + public Matrix4f setZero() { + m00 = 0.0f; + m01 = 0.0f; + m02 = 0.0f; + m03 = 0.0f; + m10 = 0.0f; + m11 = 0.0f; + m12 = 0.0f; + m13 = 0.0f; + m20 = 0.0f; + m21 = 0.0f; + m22 = 0.0f; + m23 = 0.0f; + m30 = 0.0f; + m31 = 0.0f; + m32 = 0.0f; + m33 = 0.0f; + + return this; + } + + - public float m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33; + 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 + * @return this + */ + public Matrix4f load(Matrix4f src) { + + m00 = src.m00; + m01 = src.m01; + m02 = src.m02; + m03 = src.m03; + m10 = src.m10; + m11 = src.m11; + m12 = src.m12; + m13 = src.m13; + m20 = src.m20; + m21 = src.m21; + m22 = src.m22; + m23 = src.m23; + m30 = src.m30; + m31 = src.m31; + m32 = src.m32; + m33 = src.m33; + + return this; + } + /** + * Add two matrices together and place the result in a third matrix. + * @param left The left source matrix + * @param right The right source matrix + * @param dest The destination matrix, or null if a new one is to be created + * @return the destination matrix + */ + public static Matrix4f add(Matrix4f left, Matrix4f right, Matrix4f dest) { + + Matrix4f temp = null; + + if (dest == null) + dest = new Matrix4f(); + else if (dest == left || dest == right) { + temp = dest; + dest = new Matrix4f(); + } + + dest.m00 = left.m00 + right.m00; + dest.m01 = left.m01 + right.m01; + dest.m02 = left.m02 + right.m02; + dest.m03 = left.m03 + right.m03; + dest.m10 = left.m10 + right.m10; + dest.m11 = left.m11 + right.m11; + dest.m12 = left.m12 + right.m12; + dest.m13 = left.m13 + right.m13; + dest.m20 = left.m20 + right.m20; + dest.m21 = left.m21 + right.m21; + dest.m22 = left.m22 + right.m22; + dest.m23 = left.m23 + right.m23; + dest.m30 = left.m30 + right.m30; + dest.m31 = left.m31 + right.m31; + dest.m32 = left.m32 + right.m32; + dest.m33 = left.m33 + right.m33; + + + if (temp != null) { + temp.load(dest); + return temp; + } else + return dest; + } + + /** + * Subtract the right matrix from the left and place the result in a third matrix. + * @param left The left source matrix + * @param right The right source matrix + * @param dest The destination matrix, or null if a new one is to be created + * @return the destination matrix + */ + public static Matrix4f sub(Matrix4f left, Matrix4f right, Matrix4f dest) { + + Matrix4f temp = null; + + if (dest == null) + dest = new Matrix4f(); + else if (dest == left || dest == right) { + temp = dest; + dest = new Matrix4f(); + } + + dest.m00 = left.m00 - right.m00; + dest.m01 = left.m01 - right.m01; + dest.m02 = left.m02 - right.m02; + dest.m03 = left.m03 - right.m03; + dest.m10 = left.m10 - right.m10; + dest.m11 = left.m11 - right.m11; + dest.m12 = left.m12 - right.m12; + dest.m13 = left.m13 - right.m13; + dest.m20 = left.m20 - right.m20; + dest.m21 = left.m21 - right.m21; + dest.m22 = left.m22 - right.m22; + dest.m23 = left.m23 - right.m23; + dest.m30 = left.m30 - right.m30; + dest.m31 = left.m31 - right.m31; + dest.m32 = left.m32 - right.m32; + dest.m33 = left.m33 - right.m33; + + if (temp != null) { + temp.load(dest); + return temp; + } else + return dest; + } + + /** + * Multiply the right matrix by the left and place the result in a third matrix. + * @param left The left source matrix + * @param right The right source matrix + * @param dest The destination matrix, or null if a new one is to be created + * @return the destination matrix + */ + public static Matrix4f mul(Matrix4f left, Matrix4f right, Matrix4f dest) { + + Matrix4f temp = null; + + if (dest == null) + dest = new Matrix4f(); + else if (dest == left || dest == right) { + temp = dest; + dest = new Matrix4f(); + } + + + dest.m00 = left.m00 * right.m00 + left.m10 * right.m01 + left.m20 * right.m02 + left.m30 * right.m03; + dest.m01 = left.m01 * right.m00 + left.m11 * right.m01 + left.m21 * right.m02 + left.m31 * right.m03; + dest.m02 = left.m02 * right.m00 + left.m12 * right.m01 + left.m22 * right.m02 + left.m32 * right.m03; + dest.m03 = left.m03 * right.m00 + left.m13 * right.m01 + left.m23 * right.m02 + left.m33 * right.m03; + dest.m10 = left.m00 * right.m10 + left.m10 * right.m11 + left.m20 * right.m12 + left.m30 * right.m13; + dest.m11 = left.m01 * right.m10 + left.m11 * right.m11 + left.m21 * right.m12 + left.m31 * right.m13; + dest.m12 = left.m02 * right.m10 + left.m12 * right.m11 + left.m22 * right.m12 + left.m32 * right.m13; + dest.m13 = left.m03 * right.m10 + left.m13 * right.m11 + left.m23 * right.m12 + left.m33 * right.m13; + dest.m20 = left.m00 * right.m20 + left.m10 * right.m21 + left.m20 * right.m22 + left.m30 * right.m23; + dest.m21 = left.m01 * right.m20 + left.m11 * right.m21 + left.m21 * right.m22 + left.m31 * right.m23; + dest.m22 = left.m02 * right.m20 + left.m12 * right.m21 + left.m22 * right.m22 + left.m32 * right.m23; + dest.m23 = left.m03 * right.m20 + left.m13 * right.m21 + left.m23 * right.m22 + left.m33 * right.m23; + dest.m30 = left.m00 * right.m30 + left.m10 * right.m31 + left.m20 * right.m32 + left.m30 * right.m33; + dest.m31 = left.m01 * right.m30 + left.m11 * right.m31 + left.m21 * right.m32 + left.m31 * right.m33; + dest.m32 = left.m02 * right.m30 + left.m12 * right.m31 + left.m22 * right.m32 + left.m32 * right.m33; + dest.m33 = left.m03 * right.m30 + left.m13 * right.m31 + left.m23 * right.m32 + left.m33 * right.m33; + + if (temp != null) { + temp.load(dest); + return temp; + } else + return dest; + } + + /** + * Multiply a Vector by a matrix and return the result in a destination + * vector. + * @param left The left matrix + * @param right The right vector + * @param dest The destination vector, or null if a new one is to be created + * @return the destination vector + */ + public static Vector4f mul(Matrix4f left, Vector4f right, Vector4f dest) { + + Vector4f temp = null; + + if (dest == null) + dest = new Vector4f(); + else if (dest == right) { + temp = dest; + dest = new Vector4f(); + } + + + dest.x = left.m00 * right.x + left.m10 * right.y + left.m20 * right.z + left.m30 * right.w; + dest.y = left.m01 * right.x + left.m11 * right.y + left.m21 * right.z + left.m31 * right.w; + dest.z = left.m02 * right.x + left.m12 * right.y + left.m22 * right.z + left.m32 * right.w; + dest.w = left.m03 * right.x + left.m13 * right.y + left.m23 * right.z + left.m33 * right.w; + + if (temp != null) { + temp.set(dest); + return temp; + } else + return dest; + } + + /** + * Transpose this matrix + * @return this + */ + public Matrix4f transpose() { + + float f = m10; + m10 = m01; + m01 = f; + f = m20; + m20 = m02; + m02 = f; + f = m30; + m30 = m03; + m03 = f; + f = m21; + m21 = m12; + m12 = f; + f = m31; + m31 = m13; + m13 = f; + f = m32; + m32 = m23; + m23 = f; + + return this; + } + + /** + * 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 + */ + public Matrix4f transpose(Matrix4f dest) { + + if (this != dest) { + m00 = dest.m00; + m01 = dest.m10; + m02 = dest.m20; + m03 = dest.m30; + m10 = dest.m01; + m11 = dest.m11; + m12 = dest.m21; + m13 = dest.m31; + m20 = dest.m02; + m21 = dest.m12; + m22 = dest.m22; + m23 = dest.m32; + m30 = dest.m03; + m31 = dest.m13; + m32 = dest.m23; + m33 = dest.m33; + } else + transpose(); + + return dest; + } + + + /** + * Invert this matrix + * @return this + */ + public Matrix4f invert() { + return this; + } + + /** + * Negate this matrix + * @return this + */ + public Matrix4f negate() { + m00 = -m00; + m01 = -m01; + m02 = -m02; + m03 = -m03; + m10 = -m10; + m11 = -m11; + m12 = -m12; + m13 = -m13; + m20 = -m20; + m21 = -m21; + m22 = -m22; + m23 = -m23; + m30 = -m30; + m31 = -m31; + m32 = -m32; + m33 = -m33; + return this; + } + + /** + * Negate this matrix and place the result in a destination matrix. + * @param dest The destination matrix, or null if a new matrix is to be created + * @return the negated matrix + */ + public Matrix4f negate(Matrix4f dest) { + if (dest == null) + dest = new Matrix4f(); + + dest.m00 = -m00; + dest.m01 = -m01; + dest.m02 = -m02; + dest.m03 = -m03; + dest.m10 = -m10; + dest.m11 = -m11; + dest.m12 = -m12; + dest.m13 = -m13; + dest.m20 = -m20; + dest.m21 = -m21; + dest.m22 = -m22; + dest.m23 = -m23; + dest.m30 = -m30; + dest.m31 = -m31; + dest.m32 = -m32; + dest.m33 = -m33; + + return dest; } } 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.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Vector2f.java 16 Aug 2002 21:52:26 -0000 1.2 +++ Vector2f.java 24 Aug 2002 21:12:31 -0000 1.3 @@ -31,6 +31,8 @@ */ package org.lwjgl.vector; +import org.lwjgl.Math; + /** * $Id$ * @@ -45,10 +47,134 @@ public float x, y; /** - * Constructor for Vector2f. + * Constructor for Vector3f. */ public Vector2f() { super(); } + + /** + * Constructor + */ + public Vector2f(Vector2f src) { + set(src); + } + + /** + * Constructor + */ + public Vector2f(float x, float y) { + set(x, y); + } + + /** + * Set values + * @return this + */ + public Vector2f set(float x, float y) { + this.x = x; + this.y = y; + return this; + } + /** + * Load from another Vector2f + * @param src The source vector + * @return this + */ + public Vector2f set(Vector2f src) { + x = src.x; + y = src.y; + return this; + } + + /** + * @return the length of the vector + */ + public float length() { + return Math.sqrt(lengthSquared()); + } + + /** + * @return the length squared of the vector + */ + public float lengthSquared() { + return x * x + y * y; + } + + /** + * Translate a vector + * @param x The translation in x + * @param y the translation in y + * @return this + */ + public Vector2f translate(float x, float y) { + this.x += x; + this.y += y; + return this; + } + + /** + * Negate a vector + * @return this + */ + public Vector2f negate() { + x = -x; + y = -y; + return this; + } + + /** + * Normalise this vector + * @return this + */ + public Vector2f normalise() { + float l = 1.0f / length(); + x *= l; + y *= l; + return this; + } + + /** + * Normalise this vector and place the result in another vector. + * @param dest The destination vector, or null if a new vector is to be created + * @return the normalised vector + */ + public Vector2f normalise(Vector2f dest) { + float l = length(); + + if (dest == null) + dest = new Vector2f(x / l, y / l); + else + dest.set(x / l, y / l); + + return dest; + } + + /** + * The dot product of two vectors is calculated as + * v1.x * v2.x + v1.y * v2.y + * @param left The LHS vector + * @param right The RHS vector + * @return left dot right + */ + 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 + * @param a A vector + * @param b The other vector + * @return the angle between the two vectors, in degrees + */ + public static float angle(Vector2f a, Vector2f b) { + float dls = dot(a, b) / (a.length() * b.length()); + if (dls < -1f) + dls = -1f; + else if (dls > 1.0f) + dls = 1.0f; + return Math.acos(dls); + } + } 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.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Vector4f.java 16 Aug 2002 21:52:26 -0000 1.2 +++ Vector4f.java 24 Aug 2002 21:12:31 -0000 1.3 @@ -31,6 +31,8 @@ */ package org.lwjgl.vector; +import org.lwjgl.Math; + /** * $Id$ * @@ -50,5 +52,139 @@ public Vector4f() { super(); } + + /** + * Constructor + */ + public Vector4f(Vector4f src) { + set(src); + } + + /** + * Constructor + */ + public Vector4f(float x, float y, float z, float w) { + set(x, y, z, w); + } + + /** + * Set values + * @return this + */ + public Vector4f set(float x, float y, float z, float w) { + this.x = x; + this.y = y; + this.z = z; + this.w = w; + return this; + } + /** + * Load from another Vector4f + * @param src The source vector + * @return this + */ + public Vector4f set(Vector4f src) { + x = src.x; + y = src.y; + z = src.z; + w = src.w; + return this; + } + + /** + * @return the length of the vector + */ + public float length() { + return Math.sqrt(lengthSquared()); + } + + /** + * @return the length squared of the vector + */ + public float lengthSquared() { + return x * x + y * y + z * z + w * w; + } + + /** + * Translate a vector + * @param x The translation in x + * @param y the translation in y + * @return this + */ + public Vector4f translate(float x, float y, float z, float w) { + this.x += x; + this.y += y; + this.z += z; + this.w += w; + return this; + } + + /** + * Negate a vector + * @return this + */ + public Vector4f negate() { + x = -x; + y = -y; + z = -z; + w = -w; + return this; + } + + /** + * Normalise this vector + * @return this + */ + public Vector4f normalise() { + float l = 1.0f / length(); + x *= l; + y *= l; + z *= l; + w *= l; + return this; + } + + /** + * Normalise this vector and place the result in another vector. + * @param dest The destination vector, or null if a new vector is to be created + * @return the normalised vector + */ + public Vector4f normalise(Vector4f dest) { + float l = length(); + + if (dest == null) + dest = new Vector4f(x / l, y / l, z / l, w / l); + else + dest.set(x / l, y / l, z / l, w / l); + + return dest; + } + + /** + * The dot product of two vectors is calculated as + * v1.x * v2.x + v1.y * v2.y + v1.z * v2.z + v1.w * v2.w + * @param left The LHS vector + * @param right The RHS vector + * @return left dot right + */ + public static float dot(Vector4f left, Vector4f right) { + return left.x * right.x + left.y * right.y + left.z * right.z + left.w * right.w; + } + + /** + * Calculate the angle between two vectors, in degrees + * @param a A vector + * @param b The other vector + * @return the angle between the two vectors, in degrees + */ + public static float angle(Vector4f a, Vector4f b) { + float dls = dot(a, b) / (a.length() * b.length()); + if (dls < -1f) + dls = -1f; + else if (dls > 1.0f) + dls = 1.0f; + return Math.acos(dls); + } + } 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.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Matrix3f.java 16 Aug 2002 21:52:26 -0000 1.2 +++ Matrix3f.java 24 Aug 2002 21:12:31 -0000 1.3 @@ -42,13 +42,308 @@ public class Matrix3f { - public float m00, m01, m02, m10, m11, m12, m20, m21, m22; - + public float m00 = 1.0f, + m01, + m02, + m10, + m11 = 1.0f, + m12, + m20, + m21, + m22 = 1.0f; + /** * Constructor for Matrix3f. */ public Matrix3f() { super(); + } + /** + * Load from another matrix3f + * @param src The source matrix + * @return this + */ + public Matrix3f load(Matrix3f src) { + + m00 = src.m00; + m10 = src.m10; + m20 = src.m20; + m01 = src.m01; + m11 = src.m11; + m21 = src.m21; + m02 = src.m02; + m12 = src.m12; + m22 = src.m22; + + return this; + } + + /** + * Add two matrices together and place the result in a third matrix. + * @param left The left source matrix + * @param right The right source matrix + * @param dest The destination matrix, or null if a new one is to be created + * @return the destination matrix + */ + public static Matrix3f add(Matrix3f left, Matrix3f right, Matrix3f dest) { + + Matrix3f temp = null; + + if (dest == null) + dest = new Matrix3f(); + else if (dest == left || dest == right) { + temp = dest; + dest = new Matrix3f(); + } + + dest.m00 = left.m00 + right.m00; + dest.m01 = left.m01 + right.m01; + dest.m02 = left.m02 + right.m02; + dest.m10 = left.m10 + right.m10; + dest.m11 = left.m11 + right.m11; + dest.m12 = left.m12 + right.m12; + dest.m20 = left.m20 + right.m20; + dest.m21 = left.m21 + right.m21; + dest.m22 = left.m22 + right.m22; + + if (temp != null) { + temp.load(dest); + return temp; + } else + return dest; + } + + /** + * Subtract the right matrix from the left and place the result in a third matrix. + * @param left The left source matrix + * @param right The right source matrix + * @param dest The destination matrix, or null if a new one is to be created + * @return the destination matrix + */ + public static Matrix3f sub(Matrix3f left, Matrix3f right, Matrix3f dest) { + + Matrix3f temp = null; + + if (dest == null) + dest = new Matrix3f(); + else if (dest == left || dest == right) { + temp = dest; + dest = new Matrix3f(); + } + + dest.m00 = left.m00 - right.m00; + dest.m01 = left.m01 - right.m01; + dest.m02 = left.m02 - right.m02; + dest.m10 = left.m10 - right.m10; + dest.m11 = left.m11 - right.m11; + dest.m12 = left.m12 - right.m12; + dest.m20 = left.m20 - right.m20; + dest.m21 = left.m21 - right.m21; + dest.m22 = left.m22 - right.m22; + + if (temp != null) { + temp.load(dest); + return temp; + } else + return dest; + } + + /** + * Multiply the right matrix by the left and place the result in a third matrix. + * @param left The left source matrix + * @param right The right source matrix + * @param dest The destination matrix, or null if a new one is to be created + * @return the destination matrix + */ + public static Matrix3f mul(Matrix3f left, Matrix3f right, Matrix3f dest) { + + Matrix3f temp = null; + + if (dest == null) + dest = new Matrix3f(); + else if (dest == left || dest == right) { + temp = dest; + dest = new Matrix3f(); + } + + dest.m00 = + left.m00 * right.m00 + left.m10 * right.m01 + left.m20 * right.m02; + dest.m01 = + left.m01 * right.m00 + left.m11 * right.m01 + left.m21 * right.m02; + dest.m02 = + left.m02 * right.m00 + left.m12 * right.m01 + left.m22 * right.m02; + dest.m10 = + left.m00 * right.m10 + left.m10 * right.m11 + left.m20 * right.m12; + dest.m11 = + left.m01 * right.m10 + left.m11 * right.m11 + left.m21 * right.m12; + dest.m12 = + left.m02 * right.m10 + left.m12 * right.m11 + left.m22 * right.m12; + dest.m20 = + left.m00 * right.m20 + left.m10 * right.m21 + left.m20 * right.m22; + dest.m21 = + left.m01 * right.m20 + left.m11 * right.m21 + left.m21 * right.m22; + dest.m22 = + left.m02 * right.m20 + left.m12 * right.m21 + left.m22 * right.m22; + + if (temp != null) { + temp.load(dest); + return temp; + } else + return dest; + } + + /** + * Multiply a Vector by a matrix and return the result in a destination + * vector. + * @param left The left matrix + * @param right The right vector + * @param dest The destination vector, or null if a new one is to be created + * @return the destination vector + */ + public static Vector3f mul(Matrix3f left, Vector3f right, Vector3f dest) { + + Vector3f temp = null; + + if (dest == null) + dest = new Vector3f(); + else if (dest == right) { + temp = dest; + dest = new Vector3f(); + } + + dest.x = left.m00 * right.x + left.m10 * right.y + left.m20 * right.z; + dest.y = left.m01 * right.x + left.m11 * right.y + left.m21 * right.z; + dest.z = left.m02 * right.x + left.m12 * right.y + left.m22 * right.z; + + if (temp != null) { + temp.set(dest); + return temp; + } else + return dest; + } + + /** + * Transpose this matrix + * @return this + */ + public Matrix3f transpose() { + float f = m10; + m10 = m01; + m01 = f; + f = m20; + m20 = m02; + m02 = f; + f = m21; + m21 = m12; + m12 = f; + return this; + } + + /** + * 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 + */ + public Matrix3f transpose(Matrix3f dest) { + + if (dest == null) + dest = new Matrix3f(); + + if (this != dest) { + m00 = dest.m00; + m01 = dest.m10; + m02 = dest.m20; + m10 = dest.m01; + m11 = dest.m11; + m12 = dest.m21; + m20 = dest.m02; + m21 = dest.m12; + m22 = dest.m22; + } else + transpose(); + + return this; + + } + + /** + * Invert this matrix + * @return this + */ + public Matrix3f invert() { + return this; + } + + /** + * Negate this matrix + * @return this + */ + public Matrix3f negate() { + m00 = -m00; + m01 = -m02; + m02 = -m01; + m10 = -m10; + m11 = -m12; + m12 = -m11; + m20 = -m20; + m21 = -m22; + m22 = -m21; + return this; + } + + /** + * Negate this matrix and place the result in a destination matrix. + * @param dest The destination matrix, or null if a new matrix is to be created + * @return the negated matrix + */ + public Matrix3f negate(Matrix3f dest) { + if (dest == null) + dest = new Matrix3f(); + + dest.m00 = -m00; + dest.m01 = -m02; + dest.m02 = -m01; + dest.m10 = -m10; + dest.m11 = -m12; + dest.m12 = -m11; + dest.m20 = -m20; + dest.m21 = -m22; + dest.m22 = -m21; + return dest; + } + + /** + * Set this matrix to be the identity matrix. + * @return this + */ + public Matrix3f setIdentity() { + m00 = 1.0f; + m01 = 0.0f; + m02 = 0.0f; + m10 = 0.0f; + m11 = 1.0f; + m12 = 0.0f; + m20 = 0.0f; + m21 = 0.0f; + m22 = 1.0f; + return this; + } + + /** + * Set this matrix to 0. + * @return this + */ + public Matrix3f setZero() { + m00 = 0.0f; + m01 = 0.0f; + m02 = 0.0f; + m10 = 0.0f; + m11 = 0.0f; + m12 = 0.0f; + m20 = 0.0f; + m21 = 0.0f; + m22 = 0.0f; + return this; } } |
From: Caspian Rychlik-P. <ci...@us...> - 2002-08-24 16:34:43
|
Update of /cvsroot/java-game-lib/LWJGL/doc/tutorial In directory usw-pr-cvs1:/tmp/cvs-serv28532/doc/tutorial Added Files: skeleton_code.html Log Message: Rough incomplete draft --- NEW FILE: skeleton_code.html --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/doc/tutorial/skeleton_code.html <html> <head> <meta http-equiv="Content-Language" content="en-gb"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <title>4</title> </head> <body> <p>4.0 Skeleton Game Code</p> <p>So now you want to know how to just get stuck in and start writing games. First you need to understand a couple of game programming design patterns and why they'll make your life easier; and then you'll want to fill in the gaps in a bit of skeleton code that we're going to discuss below.</p> <p>4.1 Design Decisions</p> <p>4.1.1 Static Game Class</p> <p>How many instances of your game do you expect to be running in a JVM? One, and only one. Given this, you may feel the urge to implement the singleton pattern on your game, where your game class holds a single instance of itself and a method to retrieve that instance, something like:</p> <p style="background-color: #FFFFCC; border-style: solid; border-width: 1; padding: 3"><code>public class Game {</code><code><br> <br> /** The single instance of the Game */<br> private final Game game = new Game();<br> <br> /** Don't allow construction from anywhere else */<br> private Game() {</code><code><br> }<br> </code><code><br> /** @return the game instance */<br> public static Game getGame() {<br> return game;</code><code><br> }<br> <br> /** Start a new game */<br> public void newGame() {<br> // etc<br> }<br> <br> /** The main game loop */<br> public void mainLoop() {<br> // etc<br> }<br> <br> // etc<br> }</code></p> <p>However this does result in code all over your application calling Game.getGame().someMethod() - and to what end? It might <i>look</i> like object-oriented code but in reality you're just making things harder for yourself. It's far more intuitive to write your class purely statically, like this:</p> <p style="background-color: #FFFFCC; border-style: solid; border-width: 1; padding: 3"><code>public class Game {</code><code><br> <br> /** Don't allow construction from anywhere else */<br> private Game() {</code><code><br> }<br> <br> /** Start a new game */<br> public static void newGame() {<br> // etc<br> }<br> <br> /** The main game loop */<br> public static void mainLoop() {<br> // etc<br> }<br> <br> // etc<br> }</code></p> <p>Now you can just call your methods directly on the Game class. We're going to use this pattern in the forthcoming skeleton game code.</p> <p>4.1.2 About Threads and Timeslicing</p> <p>There is a tendency for Java programs to be heavily multithreaded, simply because you <i>can</i> in Java, whereas it is exceedingly difficult to do properly in C++. However, you are likely to fall into a number of pitfalls in game programming above and beyond those experienced in general multithreaded programming:</p> <p>Firstly, threads were designed a long time ago for a specific purpose, and that purpose is keeping the processor busy whilst some slow I/O operation is being carried out. How many slow I/O operations are you going to do in your game? Apart from loading the graphics, sounds, and level data at the start - none (unless you're doing networking but that's a whole other issue).</p> <p>What does this mean for you? Well, in normal Java, programmers will tend to set off a number of threads and expect them to more or less behave like <i>time slices</i> rather than <i>threads.</i> Time slices work in a rather different way to threads: each is executed, in turn, for a finite amount of time. You can more or less guarantee that a slice will execute for its allotted time, and that all slices will get a look-in.</p> <p>Threads don't work like this. To put it bluntly, you can't <i>accurately</i> predict when a thread is going to execute (or if it will ever be executed), or even how long it will execute for. Therefore you should not be using threads to do stuff that you expect to occur in a timely fashion. This includes <i>collision detection, animation, sound playback</i> and <i>device input, </i>and the ultimate blow, <i>event handling.</i></p> <p>In the absence of threads to do this useful stuff, we have to resort to a <i>single-threaded model</i> where the game effectively runs in one, very busy, thread - the "main loop". This is quite convenient, however, because it highlights another problem with multithreaded game code that is not immediately obvious.</p> <p>4.1.3 About Threads and Hardware</p> <p>Your machine's <i>hardware</i> is only ever in <i>one state at a time, </i>unless it is some kind of quantum computer. The device drivers for the hardware - namely OpenGL and the like - keep track of this state in order to send the correct hardware setup commands to the device. Can you imagine what might happen if one thread is trying to do some drawing at the same time that another thread is trying to do some drawing? Yes, you get a mess. You will discover that in order to draw in a thread in OpenGL that you need to associate the current rendering thread with the current state of the hardware (the "context"). Suddenly you need to synchronize every method which can alter the hardware state. Suddenly your application looks <i>incredibly complicated</i> and <i>runs like a dog!</i> So much for threads.</p> <p>So be aware of this next time you think it's a good idea to load your textures in a background thread, and remember that only one thread - the main thread - is allowed to execute any commands on your hardware devices.</p> <p>It is for this reason that we use <i>polling </i>to read input devices as well. Not to mention the fact that we can't guarantee that an event loop will be executed every game frame, and so our input will be erratic.</p> <p>4.1.4 Object-orientation</p> <p>Object-orientation is <i>good</i> when it's done right. It makes your code much, much, easier to understand and work on. However you may be led astray by <i>parrots who repeat mantras.</i> There are some programmers that say <i>everything should be private</i> and you should expose your instance variables with getters and setters. The Hotspot virtual machine is even cleverly optimised to make this operation almost entirely free. <i>But wait! </i>Ask yourself why you're filling your classes up with getters and setters <i>when a dot would do the same job without any need to maintain it.</i></p> <p>You're writing a game: the source code is probably only going to be used once, or by a very few people. Most of your game code is so unique to your actual game that it is <i>disposable code.</i> So save yourself some effort and use a dot if you can. A critical mistake I have observed time and time again in object-oriented projects is to get so bogged down trying to design a perfect object-oriented model that the project takes absolutely ages to design. Before you know it there are hundreds of getters and setters to maintain, and interfaces all over the place to keep the reuse of your classes to a maximum - when <i>all along the project design goal was not reuse but to get the bloody thing finished on time and under budget!</i></p> <p>Your mileage may vary...</p> <p>4.2 Show Me The Money</p> <p>Ok, ok, without further ado, here is a skeleton listing which you can use to write a fullscreen Java game using LWJGL. Because we're games programmers, we don't want to do a Hello World as we'd probably rather shoot it. But before we can make bullets we must pay homage to the <i>rotating square!</i></p> <p style="background-color: #FFFFCC; border-style: solid; border-width: 1; padding: 3"><code>public final class Game {<br> static {<br> try {<br> DisplayMode[] modes = Display.getAvailableDisplayModes();<br> System.out.println("Available display modes:");<br> for (int i = 0; i < modes.length; i ++)<br> System.out.println(modes[i]);<br> // For now let's just pick a mode we're certain to have<br> Display.create(new DisplayMode(640, 480, 16, 60), true);<br> System.out.println("Created display.");<br> } catch (Exception e) {<br> System.err.println("Failed to create display due to "+e);<br> System.exit(1);<br> }<br> }<br> public static final GL gl = new GL(16, 0, 16, 8);<br> static {<br> try {<br> gl.create();<br> System.out.println("Created OpenGL.");<br> } catch (Exception e) {<br> System.err.println("Failed to create OpenGL due to "+e);<br> System.exit(1);<br> }<br> }<br> /** A handy number formatter for use displaying FPS and the like */<br> public static NumberFormat fmt = new DecimalFormat();<br> static {<br> fmt.setMaximumFractionDigits(1);<br> fmt.setMinimumFractionDigits(1);<br> fmt.setGroupingUsed(false);<br> }<br> /** Is the game finished? */<br> private static boolean finished;<br> /** A rotating square! */<br> private static float angle;<br> /**<br> * No construction allowed<br> */<br> private Game() {<br> }<br> public static void main(String[] arguments) {<br> try {<br> init();<br> int frames = 0;<br> float fps = 0.0f;<br> Timer timer = new Timer();<br> timer.reset();<br> timer.resume();<br> while (!finished) {<br> AbsMouse.poll();<br> Keyboard.poll();<br> Keyboard.read();<br> gl.clear(GL.COLOR_BUFFER_BIT);<br> mainLoop();<br> render();<br> gl.swapBuffers();<br> // Count the frames per second. Do with this what you will..<br> frames++;<br> float time = timer.getTime();<br> if (time >= 1.0f) {<br> fps = (int) (frames / time);<br> timer.reset();<br> frames = 0;<br> }<br> }<br> } catch (Throwable t) {<br> t.printStackTrace();<br> } finally {<br> cleanup();<br> }<br> }<br> <br> /**<br> * All calculations are done in here<br> */<br> private static void mainLoop() {<br> angle += 1f;<br> if (angle > 360.0f)<br> angle = 0.0f;<br> <br> if (Keyboard.isKeyDown(Keyboard.KEY_ESCAPE))<br> finished = true;<br> }<br> <br> /**<br> * All rendering is done in here<br> */<br> private static void render() {<br> <br> gl.pushMatrix();<br> gl.translatef(Display.getWidth() / 2, Display.getHeight() / 2, 0.0f);<br> gl.rotatef(angle, 0, 0, 1.0f);<br> gl.begin(GL.QUADS);<br> gl.vertex2i(-50, -50);<br> gl.vertex2i(50, -50);<br> gl.vertex2i(50, 50);<br> gl.vertex2i(-50, 50);<br> gl.end();<br> gl.popMatrix();<br> }<br> /**<br> * Initialize<br> */<br> private static void init() throws Exception {<br> Keyboard.create();<br> Keyboard.enableBuffer();<br> Mouse.create();<br> // Go into orthographic projection mode.<br> gl.matrixMode(GL.PROJECTION);<br> gl.loadIdentity();<br> gl.glu.ortho2D(0, Display.getWidth(), 0, Display.getHeight());<br> gl.matrixMode(GL.MODELVIEW);<br> gl.loadIdentity();<br> gl.viewport(0, 0, Display.getWidth(), Display.getHeight());<br> // Fix the refresh rate to the display frequency.<br> gl.wglSwapIntervalEXT(1);<br> }<br> /**<br> * Cleanup<br> */<br> private static void cleanup() {<br> Keyboard.destroy();<br> Mouse.destroy();<br> gl.destroy();<br> Display.destroy();<br> }<br> }</code></p> </body> </html> |
From: Caspian Rychlik-P. <ci...@us...> - 2002-08-24 16:34:21
|
Update of /cvsroot/java-game-lib/LWJGL/doc/tutorial In directory usw-pr-cvs1:/tmp/cvs-serv28445/doc/tutorial Added Files: index.html Log Message: Rough incomplete draft --- NEW FILE: index.html --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/doc/tutorial/index.html <html> <head> <meta http-equiv="Content-Language" content="en-gb"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <title>Lightweight Java Game Library Tutorial Index</title> <style> <!-- .document_title { text-align: Center; font-size: 24pt; letter-spacing: 4 } .code_snippet { font-family: Courier New } --> </style> </head> <body> <p class="document_title">Lightweight Java Game Library</p> <p class="document_title">Tutorial</p> <p align="center">Written by Caspian Rychlik-Prince</p> <p align="center">Please direct comments, errata, and flames to the author at <a href="mailto:ci...@us...">ci...@us...</a></p> <p align="center">Last modified <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->23 August 2002<!--webbot bot="Timestamp" endspan i-checksum="31308" --> </p> <p> </p> <p><a name="Introduction">1.0 Introduction</a></p> <p>The Lightweight Java Game Library (LWJGL) is a solution aimed directly at professional and amateur Java programmers alike to enable commercial quality games to be written in Java. This tutorial is nonetheless aimed at <i>experienced </i>programmers and won't be explaining some obvious techniques. Currently the LWJGL supports only the Win32 platform, and JDK1.4. </p> <p>LWJGL is not meant to make writing games particularly <i>easy;</i> it is primarily an <i>enabling technology </i>which allows developers to get at resources that are simply otherwise unavailable or poorly implemented on the existing Java platform. We anticipate that the LWJGL will, through evolution and extension, become the foundation for more complete game libraries and "game engines" as they have popularly become known, and hide some of the new evils we have had to expose in the APIs.</p> <p>2.0 Contents</p> <p> </p> <p>3.0 Aims & Design</p> <p>Because the LWJGL API is not meant to be a fully featured game engine it has been ruthlessly pruned of all non-essential code. Its ultimate philosophy is that it provides the <i>bare minimum</i> of API functionality which will let a game programmer produce games in Java without having to write native code in order to get <i>performance </i>or <i>access some hardware feature not exposed by Java 2</i>. We settled on using two other open technologies as our major foundations, namely OpenGL and OpenAL for graphics and sound respectively.</p> <p>A sub-requirement of the LWJGL is that it be freed Java programmers from the requirement to ship a whole JRE with their games. Currently the Sun licensing terms dictate that J2SE be shipped in its entirety, even for the tiniest of demos. As this could easily triple the size of a demo and discourage end users with configuration issues we have made it a primary concern that games written using LWJGL can be compiled into completely standalone native binary executables by compilers such as GNU's GCJ and Excelsior's JET. We have done this by implementing the library in such a way that <i>no dependencies </i>on Sun's proprietry JRE binaries are present in the library.</p> <p>The final aim of LWJGL is to make the library available for Win32 systems above all others, for that is what most commercial programmers need.</p> <p>Linuxians and Macophiles do not despair! There's nothing inherently non-portable about the LWJGL - we just don't have the time and expertise to do it yet. But it will happen.</p> <p>3.1 General API</p> <p>The general API gives us the foundations of game programming: we have a Display class, for initialising the display and querying its available modes; we have a Math class to provide us with some floating point maths functions (rather than the double-precision ones provided by Java), and matrix batch operations; and a Sys class, which gives us our <i>most useful gaming functions:</i> the ability to get the address of a direct byte buffer so we can cache it on the Java side of the JNI barrier, and hence access all those lovely hardware calls we need for performance; and the ability to use the system's <i>hires timer</i>, which is so critical for animation timing. In addition we can also create a direct byte buffer at <i>any address in memory.</i></p> <p>The Evil Of Pointers And What It Means For Security</p> <p>Yes, we have exposed <i>pointers</i> to Java programmers. Yes, you can write to just about any bit of memory you so please, and cause untold havoc. You can break things. You can bypass security constraints and exploit the dreaded <i>buffer vuln.</i></p> <p>But <i>why?</i> Because without pointers, all those nice easy native API calls would suddenly become complex and behave slightly differently to their C counterparts, and require us to pass direct ByteBuffers to JNI for every call. This requires that every single call which takes a pointer calls the JNI method GetDirectBufferAddress every time, which is an unnecessary overhead.</p> <p>The implications for security are simple and final: your game can <b>no longer be considered secure</b> and part of the Java security model. This puts it in exactly the same boat as any other application on the user's system. This also means you will not be able to use it in applets or with Webstart without getting your code signed and trusted. LWJGL itself will not be signed nor trusted; you are expected to deliver it bundled in with every application you ship and verify that your entire distribution is safe.</p> <p>We feel that our target developer, the commercial game developer, should not be concerned with this issue as the status quo is merely maintained from the old ways of programming with any other language; and used wisely, your exposure to pointers is unlikely to cause you any problems.</p> <p>If you are concerned about security, or wish to write games which will run as applets or from Webstart, or would rather have a full game library which takes care of things for you, you don't want to use LWJGL at all - it's that simple! What you need is Sun's Java Gaming Profile, or Java3D. If you feel a need to argue, you're using LWJGL for the wrong reasons.</p> <p>3.2 Graphics</p> <p>Graphics is based on the latest OpenGL1.4, and all the extensions we could implement that might be vaguely useful for games programmers. These include <i>all</i> of Nvidia's and ATI's proprietry extensions, and <i>all</i> the ARB extensions, and most of the EXT extensions, as well as numerous other miscellaneous ones.</p> <p>For Windows programmers, our primary target, the WGL extensions are present.</p> <p>All OpenGL functions that take pointers are passed ints. These pointers can be obtained from direct ByteBuffers using the Sys.getDirectBufferAddress() method. There are a very few native methods that return pointers as ints as well. Be sure to read the caveat about using pointers in Java!</p> <p>3.3 Sounds</p> <p>Sound is based on the latest OpenAL1.0 specification, which comes with but one extension, EAX, for interesting environmental effects. The LWJGL binary distribution includes the OpenAL .dlls for Win32.</p> <p>3.4 Input</p> <p>Input can be a complicated topic. A user can have all sorts of strange fancy force-feedback hardware installed on their systems, with scrolly knobs and twistgrips and bristling with many buttons. However, the vast majority of gamers have just a keyboard and a mouse; some of them have analogue joysticks too, and some of them have a gamepad attached from some console or other. For our first cut of the input library we've just kept it all rather simple, and decided that there is but one of each of these devices, and that force feedback and multiple potentiometers is a feature we may add another time.</p> <p>So in the interests of keeping things simple, the four input classes - Keyboard, Mouse, Gamepad and Joystick - are all static, and can all be polled once per game loop iteration to determine where they've moved since you last looked and what buttons are down at the time. The Gamepad and Keyboard may additionally support <i>buffering</i> which is a more reliable way of detecting rapid changes of state which may occur rather more quickly than your framerate.</p> <p>3.5 Maths</p> <p>Java's maths performance leaves much to be desired, particularly with respect to bulk operations for 3D rendering engines. The main problem is that the existing maths libraries use double precision when single precision is entirely adequate for most realtime games programming; and that no clever processor-specific optimisations can be done because the Hotspot compiler is simply not supplied enough semantic context to understand that it could use some special SIMD instruction to achieve the effect you desire in a fraction of the cycles. Furthermore, all maths in Java is done in Java - and once you've computed the results you usually have to subsequently copy them into a buffer to pass to a native rendering method in OpenGL anyway.</p> <p>The Math class provides two <i>totally generic</i> vector operators for unary and binary vector operations performed on direct ByteBuffers containing packed floating point vectors. The idea is to set up the source(s) of the operations and then perform a single call to JNI to perform a <i>highly optimised operation</i> on the whole lot in one go. The JNI code is specially optimised for the common cases in 3d games programming to use processor-specific instructions and take advantage, where feasible, of memory caching architecture. And the end result is placed directly back in memory, ready to simply send as a pointer direct to OpenGL or some other API.</p> <p>In addition we provide implementations of common Vector and Matrix sizes similar to those provided by the javax.vecmath package, but ours are <i>open source</i> and available without downloading the whole of Java3D.</p> <p> </p> </body> </html> |