|
From: Brian M. <ma...@us...> - 2005-11-04 19:22:28
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/devil In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30364 Modified Files: IL.java ILU.java ILUT.java ILinfo.java ILpointf.java ILpointi.java Added Files: ILNative.java Log Message: reworked devil dynamic stub to use generated header using a new ILNative class Index: ILUT.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/devil/ILUT.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- ILUT.java 2 Nov 2005 22:08:27 -0000 1.14 +++ ILUT.java 4 Nov 2005 19:22:18 -0000 1.15 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2004 LWJGL Project + * Copyright (c) 2002-2005 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,7 +35,6 @@ import java.nio.IntBuffer; import org.lwjgl.LWJGLException; -import org.lwjgl.LWJGLUtil; /** * $Id$ @@ -83,9 +82,6 @@ public static final int ILUT_VENDOR = IL.IL_VENDOR; public static final int ILUT_VERSION_NUM = IL.IL_VERSION_NUM; - /** Have we been created? */ - protected static boolean created; - public static native boolean ilutRenderer(int renderer); public static native boolean ilutDisable(int mode); public static native boolean ilutEnable(int mode); @@ -94,7 +90,7 @@ public static native void ilutGetBooleanv(int mode, ByteBuffer param); public static native void ilutGetIntegerv(int mode, IntBuffer Param); public static native String ilutGetString(int stringName); - private static native void ilutInit(); + static native void ilutInit(); public static native boolean ilutIsDisabled(int mode); public static native boolean ilutIsEnabled(int mode); public static native void ilutPopAttrib(); @@ -112,13 +108,9 @@ public static native boolean ilutGLSaveImage(String fileName, int texID); public static native boolean ilutGLSetTex(int texID); public static native boolean ilutGLTexImage(int level); - - /** - * @return true if ILUT has been created - */ - public static boolean isCreated() { - return created; - } + + /** Have we been created? */ + protected static boolean created; /** * Creates a new instance of ILUT. Cannot be created unless IL has been created. @@ -127,56 +119,25 @@ if(!IL.isCreated()) { throw new LWJGLException("Cannot create ILUT without having created IL instance"); } - - String[] ilutPaths = LWJGLUtil.getLibraryPaths(new String[]{ - "ILUT", "ILUT.dll", - "ILUT", "libILUT.so", - "ILUT", "libILUT.dylib"}, ILUT.class.getClassLoader()); - nCreate(ilutPaths); - - try { - ILUT.initNativeStubs(); - ILUT.ilutInit(); - created = true; - } catch (LWJGLException e) { - destroy(); - throw e; - } + + ILNative.createILUT(); + created = true; } - static native void initNativeStubs() throws LWJGLException; - - static native void resetNativeStubs(Class clazz); - /** * Exit cleanly by calling destroy. */ public static void destroy() { - resetNativeStubs(ILUT.class); if (created) { - nDestroy(); + ILNative.destroyILUT(); + created = false; } - created = false; } - - /** - * Native method to create ILUT instance - * - * @param ilutPaths Array of strings containing paths to search for ILUT library - */ - protected static native void nCreate(String[] ilutPaths) throws LWJGLException; - - /** - * Native method the destroy the ILUT - */ - protected static native void nDestroy(); - + /** - * Forcefully set created. Used internally by mac platform since - * it loads ilu/ilut in IL and needs to mark them as created - * @param created value to set created to + * @return true if ILUT has been created */ - static void setCreated(boolean created) { - ILUT.created = created; - } + public static boolean isCreated() { + return created; + } } Index: IL.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/devil/IL.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- IL.java 2 Nov 2005 22:08:27 -0000 1.21 +++ IL.java 4 Nov 2005 19:22:18 -0000 1.22 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2004 LWJGL Project + * Copyright (c) 2002-2005 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,6 @@ import org.lwjgl.BufferChecks; import org.lwjgl.LWJGLException; -import org.lwjgl.LWJGLUtil; /** * $Id$ @@ -295,9 +294,6 @@ public static final int IL_SEEK_END = 2; public static final int IL_EOF = -1; - /** Have we been created? */ - protected static boolean created; - public static native boolean ilActiveImage(int Number); public static native boolean ilActiveLayer(int Number); public static native boolean ilActiveMipmap(int Number); @@ -362,7 +358,7 @@ public static native ByteBuffer ilGetPalette(); public static native String ilGetString(int StringName); public static native void ilHint(int Target, int Mode); - private static native void ilInit(); + static native void ilInit(); public static native boolean ilIsDisabled(int Mode); public static native boolean ilIsEnabled(int Mode); public static native boolean ilIsImage(int Image); @@ -573,41 +569,9 @@ return result; } - // public static native int ilGetDXTCData(ILvoid *Buffer, int BufferSize, int DXTCFormat); - // public static native boolean ilIsValidF(int Type, ILHANDLE File); - // public static native boolean ilLoadF(int Type, ILHANDLE File); - // public static native boolean ilLoadDataF(ILHANDLE File, int Width, int Height, int Depth, ILubyte Bpp); - // public static native int ilSaveF(int Type, ILHANDLE File); - // public static native void ilRegisterFormat(int Format); - // public static native boolean ilRegisterLoad(String Ext, IL_LOADPROC Load); - // public static native boolean ilRegisterMipNum(int Num); - // public static native boolean ilRegisterNumImages(int Num); - // public static native void ilRegisterOrigin(int Origin); - // public static void ilRegisterPal(ByteBuffer Pal, int Size, int Type); - // public static native void nilRegisterPal(ByteBuffer Pal, int pal_position, int Size, int Type); - // public static native boolean ilRegisterSave(String Ext, IL_SAVEPROC Save); - // public static native void ilRegisterType(int Type); - // public static native void ilSetMemory(mAlloc, mFree); - // public static native void ilSetRead(fOpenRProc, fCloseRProc, fEofProc, fGetcProc, fReadProc, fSeekRProc, fTellRProc); - // public static native void ilSetWrite(fOpenWProc, fCloseWProc, fPutcProc, fSeekWProc, fTellWProc, fWriteProc); - - - static { - System.loadLibrary("lwjgl-devil"); - } - - - /** - * @return true if DevIL has been created - */ - public static boolean isCreated() { - return created; - } - - private static native void initNativeStubs() throws LWJGLException; - - private static native void resetNativeStubs(Class clazz); - + /** Have we been created? */ + protected static boolean created; + /** * Creates a new instance of IL. */ @@ -616,43 +580,24 @@ return; } - String[] illPaths = LWJGLUtil.getLibraryPaths(new String[]{ - "DevIL", "DevIL.dll", - "IL", "libIL.so", - "IL", "libIL.dylib"}, IL.class.getClassLoader()); - nCreate(illPaths); - - try { - IL.initNativeStubs(); - IL.ilInit(); - created = true; - } catch (LWJGLException e) { - destroy(); - throw e; - } + ILNative.createIL(); + created = true; } /** * Exit cleanly by calling destroy. */ public static void destroy() { - resetNativeStubs(IL.class); - if (created) { - nDestroy(); + ILNative.destroyIL(); + created = false; } - created = false; } - - /** - * Native method to create IL instance - * - * @param ilPaths Array of strings containing paths to search for Devil library - */ - protected static native void nCreate(String[] ilPaths) throws LWJGLException; - + /** - * Native method the destroy the IL + * @return true if DevIL has been created */ - protected static native void nDestroy(); + public static boolean isCreated() { + return created; + } } Index: ILU.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/devil/ILU.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- ILU.java 2 Nov 2005 22:08:27 -0000 1.14 +++ ILU.java 4 Nov 2005 19:22:18 -0000 1.15 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2004 LWJGL Project + * Copyright (c) 2002-2005 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,7 +35,6 @@ import org.lwjgl.BufferChecks; import org.lwjgl.LWJGLException; -import org.lwjgl.LWJGLUtil; /** * $Id$ @@ -79,16 +78,6 @@ public static final int ILU_VERSION_NUM = IL.IL_VERSION_NUM; public static final int ILU_VENDOR = IL.IL_VENDOR; - /** Have we been created? */ - protected static boolean created; - - /** - * @return true if ILU has been created - */ - public static boolean isCreated() { - return created; - } - public static native boolean iluAlienify(); public static native boolean iluBlurAvg(int iter); public static native boolean iluBlurGaussian(int iter); @@ -118,7 +107,7 @@ private static native void niluGetIntegerv(int mode, IntBuffer param, int param_offset); public static native String iluGetString(int stringName); public static native void iluImageParameter(int pName, int param); - private static native void iluInit(); + static native void iluInit(); public static native boolean iluInvertAlpha(); public static native int iluLoadImage(String fileName); public static native boolean iluMirror(); @@ -154,6 +143,9 @@ iluScaleColours(r, g, b); } // ------------------------------------------------------------------------ + + /** Have we been created? */ + protected static boolean created; /** * Creates a new instance of ILU. Cannot be created unless IL has been created. @@ -163,55 +155,24 @@ throw new LWJGLException("Cannot create ILU without having created IL instance"); } - String[] iluPaths = LWJGLUtil.getLibraryPaths(new String[]{ - "ILU", "ILU.dll", - "ILU", "libILU.so", - "ILU", "libILU.dylib"}, ILU.class.getClassLoader()); - nCreate(iluPaths); - - try { - ILU.initNativeStubs(); - ILU.iluInit(); - created = true; - } catch (LWJGLException e) { - destroy(); - throw e; - } + ILNative.createILU(); + created = true; } - static native void initNativeStubs() throws LWJGLException; - - static native void resetNativeStubs(Class clazz); - /** * Exit cleanly by calling destroy. */ public static void destroy() { - resetNativeStubs(ILU.class); if (created) { - nDestroy(); + ILNative.destroyILU(); + created = false; } - created = false; } - - /** - * Native method to create ILU instance - * - * @param iluPaths Array of strings containing paths to search for ILU library - */ - protected static native void nCreate(String[] iluPaths) throws LWJGLException; - - /** - * Native method the destroy the ILU - */ - static native void nDestroy(); - + /** - * Forcefully set created. Used internally by mac platform since - * it loads ilu/ilut in IL and needs to mark them as created - * @param created value to set created to + * @return true if ILU has been created */ - static void setCreated(boolean created) { - ILU.created = created; - } + public static boolean isCreated() { + return created; + } } Index: ILpointi.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/devil/ILpointi.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ILpointi.java 9 Jan 2005 23:59:33 -0000 1.2 +++ ILpointi.java 4 Nov 2005 19:22:18 -0000 1.3 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2004 LWJGL Project + * Copyright (c) 2002-2005 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without Index: ILpointf.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/devil/ILpointf.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ILpointf.java 9 Jan 2005 23:59:33 -0000 1.2 +++ ILpointf.java 4 Nov 2005 19:22:18 -0000 1.3 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2004 LWJGL Project + * Copyright (c) 2002-2005 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without --- NEW FILE: ILNative.java --- /* * Copyright (c) 2002-2005 LWJGL 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 'LWJGL' 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.devil; import org.lwjgl.LWJGLException; import org.lwjgl.LWJGLUtil; /** * $Id: ILNative.java,v 1.1 2005/11/04 19:22:18 matzon Exp $ * <p> * Native interface for DevIL * </p> * * @author Brian Matzon <br...@ma...> * @version $Revision: 1.1 $ */ class ILNative { static { System.loadLibrary("lwjgl-devil"); } // IL // =========================================================== static native void initNativeStubsIL(Class clazz) throws LWJGLException; static native void resetNativeStubsIL(Class clazz); static native void nCreateIL(String[] ilPaths) throws LWJGLException; static native void nDestroyIL(); static void createIL() throws LWJGLException { String[] illPaths = LWJGLUtil.getLibraryPaths(new String[]{ "DevIL", "DevIL.dll", "IL", "libIL.so", "IL", "libIL.dylib"}, IL.class.getClassLoader()); ILNative.nCreateIL(illPaths); try { ILNative.initNativeStubsIL(IL.class); IL.ilInit(); } catch (LWJGLException e) { IL.destroy(); throw e; } } public static void destroyIL() { ILNative.resetNativeStubsIL(IL.class); ILNative.nDestroyIL(); } // ----------------------------------------------------------- // ILU // =========================================================== static native void initNativeStubsILU(Class clazz) throws LWJGLException; static native void resetNativeStubsILU(Class clazz); static native void nCreateILU(String[] iluPaths) throws LWJGLException; static native void nDestroyILU(); static void createILU() throws LWJGLException { String[] iluPaths = LWJGLUtil.getLibraryPaths(new String[]{ "ILU", "ILU.dll", "ILU", "libILU.so", "ILU", "libILU.dylib"}, ILU.class.getClassLoader()); ILNative.nCreateILU(iluPaths); try { ILNative.initNativeStubsILU(ILU.class); ILU.iluInit(); } catch (LWJGLException e) { ILU.destroy(); throw e; } } public static void destroyILU() { ILNative.resetNativeStubsILU(ILU.class); ILNative.nDestroyILU(); } // ----------------------------------------------------------- // ILU // =========================================================== static native void initNativeStubsILUT(Class clazz) throws LWJGLException; static native void resetNativeStubsILUT(Class clazz); static native void nCreateILUT(String[] ilutPaths) throws LWJGLException; static native void nDestroyILUT(); static void createILUT() throws LWJGLException { String[] ilutPaths = LWJGLUtil.getLibraryPaths(new String[]{ "ILUT", "ILUT.dll", "ILUT", "libILUT.so", "ILUT", "libILUT.dylib"}, ILUT.class.getClassLoader()); ILNative.nCreateILUT(ilutPaths); try { ILNative.initNativeStubsILUT(ILUT.class); ILUT.ilutInit(); } catch (LWJGLException e) { ILUT.destroy(); throw e; } } public static void destroyILUT() { ILNative.resetNativeStubsILUT(ILUT.class); ILNative.nDestroyILUT(); } // ----------------------------------------------------------- } Index: ILinfo.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/devil/ILinfo.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ILinfo.java 9 Jan 2005 23:59:32 -0000 1.2 +++ ILinfo.java 4 Nov 2005 19:22:18 -0000 1.3 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2004 LWJGL Project + * Copyright (c) 2002-2005 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,16 +41,16 @@ */ public class ILinfo { public int id; // the image's id - public byte data[]; // the image's data + public byte data[]; // the image's data public int width; // the image's width public int height; // the image's height public int depth; // the image's depth - public byte bpp; // bytes per pixel (not bits) of the image + public byte bpp; // bytes per pixel (not bits) of the image public int sizeOfData; // the total size of the data (in bytes) public int format; // image format (in IL enum style) public int type; // image type (in IL enum style) public int origin; // origin of the image - public byte palette[]; // the image's palette + public byte palette[]; // the image's palette public int palType; // palette type public int palSize; // palette size public int cubeFlags; // flags for what cube map sides are present |