From: Carsten W. <ca...@us...> - 2008-03-02 16:01:33
|
Update of /cvsroot/jake2/jake2/src/jake2/render In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv7508/src/jake2/render Modified Files: Renderer.java RenderAPI.java Log Message: formatted Index: RenderAPI.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/RenderAPI.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RenderAPI.java 22 Nov 2006 15:05:39 -0000 1.3 --- RenderAPI.java 2 Mar 2008 16:01:28 -0000 1.4 *************** *** 50,54 **** void R_BeginFrame(float camera_separation); ! void GL_ScreenShot_f(); } --- 50,54 ---- void R_BeginFrame(float camera_separation); ! void GL_ScreenShot_f(); } Index: Renderer.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/Renderer.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Renderer.java 2 Mar 2008 15:40:27 -0000 1.12 --- Renderer.java 2 Mar 2008 16:01:27 -0000 1.13 *************** *** 6,27 **** */ /* ! Copyright (C) 1997-2001 Id Software, Inc. ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ! See the GNU General Public License for more details. ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ package jake2.render; --- 6,27 ---- */ /* ! Copyright (C) 1997-2001 Id Software, Inc. ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ! See the GNU General Public License for more details. ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ package jake2.render; *************** *** 36,81 **** */ public class Renderer { ! static RenderAPI fastRenderer = new jake2.render.fast.Misc(); static RenderAPI basicRenderer = new jake2.render.basic.Misc(); ! static Vector drivers = new Vector(3); ! static { ! try { ! try { ! Class.forName("net.java.games.jogl.GL"); ! Class.forName("jake2.render.JoglRenderer"); ! } catch (ClassNotFoundException e) { ! // ignore the oldjogl drivers if runtime not in classpath ! } ! try { ! Class.forName("org.lwjgl.opengl.GL11"); ! Class.forName("jake2.render.LwjglRenderer"); ! } catch (ClassNotFoundException e) { ! // ignore the lwjgl driver if runtime not in classpath ! } ! try { ! Class.forName("javax.media.opengl.GL"); ! Class.forName("jake2.render.Jsr231Renderer"); ! } catch (ClassNotFoundException e) { ! // ignore the jnew ogl drivers if runtime not in classpath ! } ! } catch (Throwable e) { ! e.printStackTrace(); ! } ! }; ! public static void register(Ref impl) { ! if (impl == null) { ! throw new IllegalArgumentException("Ref implementation can't be null"); ! } ! if (!drivers.contains(impl)) { ! drivers.add(impl); ! } ! } /** * Factory method to get the Renderer implementation. * @return refexport_t (Renderer singleton) */ --- 36,83 ---- */ public class Renderer { ! static RenderAPI fastRenderer = new jake2.render.fast.Misc(); static RenderAPI basicRenderer = new jake2.render.basic.Misc(); ! static Vector drivers = new Vector(3); ! static { ! try { ! try { ! Class.forName("net.java.games.jogl.GL"); ! Class.forName("jake2.render.JoglRenderer"); ! } catch (ClassNotFoundException e) { ! // ignore the old jogl driver if runtime not in classpath ! } ! try { ! Class.forName("org.lwjgl.opengl.GL11"); ! Class.forName("jake2.render.LwjglRenderer"); ! } catch (ClassNotFoundException e) { ! // ignore the lwjgl driver if runtime not in classpath ! } ! try { ! Class.forName("javax.media.opengl.GL"); ! Class.forName("jake2.render.Jsr231Renderer"); ! } catch (ClassNotFoundException e) { ! // ignore the new jogl driver if runtime not in classpath ! } ! } catch (Throwable e) { ! e.printStackTrace(); ! } ! }; ! public static void register(Ref impl) { ! if (impl == null) { ! throw new IllegalArgumentException( ! "Ref implementation can't be null"); ! } ! if (!drivers.contains(impl)) { ! drivers.add(impl); ! } ! } /** * Factory method to get the Renderer implementation. + * * @return refexport_t (Renderer singleton) */ *************** *** 85,122 **** /** ! * Factory method to get the Renderer implementation. ! * @return refexport_t (Renderer singleton) ! */ ! public static refexport_t getDriver(String driverName, boolean fast) { ! // find a driver ! Ref driver = null; ! int count = drivers.size(); ! for (int i = 0; i < count; i++) { ! driver = (Ref) drivers.get(i); ! if (driver.getName().equals(driverName)) { ! return driver.GetRefAPI((fast) ? fastRenderer : basicRenderer); ! } ! } ! // null if driver not found ! return null; ! } ! ! public static String getDefaultName() { ! return (drivers.isEmpty()) ? null : ((Ref) drivers.firstElement()).getName(); ! } ! public static String getPreferedName() { ! return (drivers.isEmpty()) ? null : ((Ref) drivers.lastElement()).getName(); ! } ! public static String[] getDriverNames() { ! if (drivers.isEmpty()) return null; ! int count = drivers.size(); ! String[] names = new String[count]; ! for (int i = 0; i < count; i++) { ! names[i] = ((Ref) drivers.get(i)).getName(); ! } ! return names; ! } } \ No newline at end of file --- 87,129 ---- /** ! * Factory method to get the Renderer implementation. ! * ! * @return refexport_t (Renderer singleton) ! */ ! public static refexport_t getDriver(String driverName, boolean fast) { ! // find a driver ! Ref driver = null; ! int count = drivers.size(); ! for (int i = 0; i < count; i++) { ! driver = (Ref) drivers.get(i); ! if (driver.getName().equals(driverName)) { ! return driver.GetRefAPI((fast) ? fastRenderer : basicRenderer); ! } ! } ! // null if driver not found ! return null; ! } ! public static String getDefaultName() { ! return (drivers.isEmpty()) ? null : ((Ref) drivers.firstElement()) ! .getName(); ! } ! public static String getPreferedName() { ! return (drivers.isEmpty()) ? null : ((Ref) drivers.lastElement()) ! .getName(); ! } ! ! public static String[] getDriverNames() { ! if (drivers.isEmpty()) ! return null; ! ! int count = drivers.size(); ! String[] names = new String[count]; ! for (int i = 0; i < count; i++) { ! names[i] = ((Ref) drivers.get(i)).getName(); ! } ! return names; ! } } \ No newline at end of file |