You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(52) |
Aug
(34) |
Sep
(99) |
Oct
(110) |
Nov
(21) |
Dec
(69) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(117) |
Feb
(90) |
Mar
(1) |
Apr
(22) |
May
(96) |
Jun
(25) |
Jul
(22) |
Aug
|
Sep
|
Oct
(18) |
Nov
(43) |
Dec
(71) |
2006 |
Jan
(20) |
Feb
(10) |
Mar
|
Apr
(4) |
May
(2) |
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
(60) |
Nov
(63) |
Dec
(35) |
2007 |
Jan
(18) |
Feb
(40) |
Mar
(14) |
Apr
(18) |
May
(33) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2008 |
Jan
|
Feb
(1) |
Mar
(25) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(5) |
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(15) |
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Carsten W. <ca...@us...> - 2006-11-21 00:52:53
|
Update of /cvsroot/jake2/jake2/src/jake2/render/common In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv16840/src/jake2/render/common Removed Files: Base.java Polygon.java Image.java Surf.java Warp.java Anorms.java Draw.java Main.java Light.java Mesh.java Model.java Misc.java GenericGL.java Log Message: merge render-refactoring branch into the HEAD --- Base.java DELETED --- --- Image.java DELETED --- --- Surf.java DELETED --- --- GenericGL.java DELETED --- --- Light.java DELETED --- --- Mesh.java DELETED --- --- Model.java DELETED --- --- Main.java DELETED --- --- Polygon.java DELETED --- --- Warp.java DELETED --- --- Anorms.java DELETED --- --- Draw.java DELETED --- --- Misc.java DELETED --- |
From: Carsten W. <ca...@us...> - 2006-11-21 00:52:53
|
Update of /cvsroot/jake2/jake2/src/jake2/render/lwjgl In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv16840/src/jake2/render/lwjgl Removed Files: GLWrapLWJGL.java Misc.java Main.java Image.java LWJGLBase.java Log Message: merge render-refactoring branch into the HEAD --- Image.java DELETED --- --- Main.java DELETED --- --- LWJGLBase.java DELETED --- --- GLWrapLWJGL.java DELETED --- --- Misc.java DELETED --- |
From: Carsten W. <ca...@us...> - 2006-11-21 00:52:53
|
Update of /cvsroot/jake2/jake2/src/jake2/render/fastjogl In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv16840/src/jake2/render/fastjogl Removed Files: Misc.java GLWrapJogl.java Image.java Main.java Log Message: merge render-refactoring branch into the HEAD --- Image.java DELETED --- --- Main.java DELETED --- --- GLWrapJogl.java DELETED --- --- Misc.java DELETED --- |
From: Carsten W. <ca...@us...> - 2006-11-21 00:51:42
|
Update of /cvsroot/jake2/jake2/src/jake2/client In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv16456/src/jake2/client Modified Files: VID.java Log Message: merge render-refactoring branch into the HEAD Index: VID.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/VID.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** VID.java 13 Nov 2005 13:36:00 -0000 1.17 --- VID.java 21 Nov 2006 00:51:39 -0000 1.18 *************** *** 168,172 **** ============== */ ! static boolean LoadRefresh( String name ) { --- 168,172 ---- ============== */ ! static boolean LoadRefresh( String name, boolean fast ) { *************** *** 198,202 **** Com.Printf( "LoadLibrary(\"" + name +"\")\n" ); ! Globals.re = Renderer.getDriver(name); if (Globals.re == null) --- 198,202 ---- Com.Printf( "LoadLibrary(\"" + name +"\")\n" ); ! Globals.re = Renderer.getDriver(name, fast); if (Globals.re == null) *************** *** 257,261 **** ! if ( !LoadRefresh( vid_ref.string ) ) { String renderer; --- 257,261 ---- ! if ( !LoadRefresh( vid_ref.string, true ) ) { String renderer; *************** *** 274,278 **** Com.Printf("Trying mode 0\n"); Cvar.SetValue("gl_mode", 0); ! if ( !LoadRefresh( vid_ref.string ) ) Com.Error(Defines.ERR_FATAL, "Couldn't fall back to " + renderer +" refresh!"); } else --- 274,278 ---- Com.Printf("Trying mode 0\n"); Cvar.SetValue("gl_mode", 0); ! if ( !LoadRefresh( vid_ref.string, false ) ) Com.Error(Defines.ERR_FATAL, "Couldn't fall back to " + renderer +" refresh!"); } else |
From: Carsten W. <ca...@us...> - 2006-11-21 00:51:26
|
Update of /cvsroot/jake2/jake2/src/jake2/render In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv16436/src/jake2/render Modified Files: Renderer.java glconfig_t.java Ref.java Added Files: JoglRenderer.java LwjglRenderer.java Jsr231Renderer.java RenderAPI.java Base.java Removed Files: JoglBase.java LWJGLRenderer.java FastJoglRenderer.java Log Message: merge render-refactoring branch into the HEAD --- NEW FILE: RenderAPI.java --- package jake2.render; import jake2.client.refdef_t; import jake2.render.opengl.GLDriver; import java.awt.Dimension; public interface RenderAPI { void setGLDriver(GLDriver impl); boolean R_Init(int vid_xpos, int vid_ypos); boolean R_Init2(); void R_Shutdown(); void R_BeginRegistration(String map); model_t R_RegisterModel(String name); image_t R_RegisterSkin(String name); image_t Draw_FindPic(String name); void R_SetSky(String name, float rotate, float[] axis); void R_EndRegistration(); void R_RenderFrame(refdef_t fd); void Draw_GetPicSize(Dimension dim, String name); void Draw_Pic(int x, int y, String name); void Draw_StretchPic(int x, int y, int w, int h, String name); void Draw_Char(int x, int y, int num); void Draw_TileClear(int x, int y, int w, int h, String name); void Draw_Fill(int x, int y, int w, int h, int c); void Draw_FadeScreen(); void Draw_StretchRaw(int x, int y, int w, int h, int cols, int rows, byte[] data); void R_SetPalette(byte[] palette); void R_BeginFrame(float camera_separation); } --- NEW FILE: Jsr231Renderer.java --- /* * Jsr231Renderer.java * Copyright (C) 2004 * * $Id: Jsr231Renderer.java,v 1.2 2006/11/21 00:51:22 cawe Exp $ */ /* 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; import jake2.Defines; import jake2.client.refdef_t; import jake2.client.refexport_t; import jake2.render.opengl.Jsr231Driver; import jake2.sys.JOGLKBD; import jake2.sys.KBD; import java.awt.Dimension; /** * Jsr231Renderer * * @author dsanders/cwei */ final class Jsr231Renderer extends Jsr231Driver implements refexport_t, Ref { public static final String DRIVER_NAME = "jsr231"; private KBD kbd = new JOGLKBD(); // is set from Renderer factory private RenderAPI impl; static { Renderer.register(new Jsr231Renderer()); }; private Jsr231Renderer() { // singleton } // ============================================================================ // public interface for Renderer implementations // // refexport_t (ref.h) // ============================================================================ /** * @see jake2.client.refexport_t#Init() */ public boolean Init(int vid_xpos, int vid_ypos) { // init the OpenGL drivers impl.setGLDriver(this); // pre init if (!impl.R_Init(vid_xpos, vid_ypos)) return false; // activates the OpenGL context activate(); // post init return impl.R_Init2(); } /** * @see jake2.client.refexport_t#Shutdown() */ public void Shutdown() { impl.R_Shutdown(); } /** * @see jake2.client.refexport_t#BeginRegistration(java.lang.String) */ public final void BeginRegistration(String map) { activate(); impl.R_BeginRegistration(map); } /** * @see jake2.client.refexport_t#RegisterModel(java.lang.String) */ public final model_t RegisterModel(String name) { activate(); return impl.R_RegisterModel(name); } /** * @see jake2.client.refexport_t#RegisterSkin(java.lang.String) */ public final image_t RegisterSkin(String name) { activate(); return impl.R_RegisterSkin(name); } /** * @see jake2.client.refexport_t#RegisterPic(java.lang.String) */ public final image_t RegisterPic(String name) { activate(); return impl.Draw_FindPic(name); } /** * @see jake2.client.refexport_t#SetSky(java.lang.String, float, float[]) */ public final void SetSky(String name, float rotate, float[] axis) { activate(); impl.R_SetSky(name, rotate, axis); } /** * @see jake2.client.refexport_t#EndRegistration() */ public final void EndRegistration() { activate(); impl.R_EndRegistration(); } /** * @see jake2.client.refexport_t#RenderFrame(jake2.client.refdef_t) */ public final void RenderFrame(refdef_t fd) { impl.R_RenderFrame(fd); } /** * @see jake2.client.refexport_t#DrawGetPicSize(java.awt.Dimension, java.lang.String) */ public final void DrawGetPicSize(Dimension dim, String name) { impl.Draw_GetPicSize(dim, name); } /** * @see jake2.client.refexport_t#DrawPic(int, int, java.lang.String) */ public final void DrawPic(int x, int y, String name) { impl.Draw_Pic(x, y, name); } /** * @see jake2.client.refexport_t#DrawStretchPic(int, int, int, int, java.lang.String) */ public final void DrawStretchPic(int x, int y, int w, int h, String name) { impl.Draw_StretchPic(x, y, w, h, name); } /** * @see jake2.client.refexport_t#DrawChar(int, int, int) */ public final void DrawChar(int x, int y, int num) { activate(); impl.Draw_Char(x, y, num); } /** * @see jake2.client.refexport_t#DrawTileClear(int, int, int, int, java.lang.String) */ public final void DrawTileClear(int x, int y, int w, int h, String name) { impl.Draw_TileClear(x, y, w, h, name); } /** * @see jake2.client.refexport_t#DrawFill(int, int, int, int, int) */ public final void DrawFill(int x, int y, int w, int h, int c) { impl.Draw_Fill(x, y, w, h, c); } /** * @see jake2.client.refexport_t#DrawFadeScreen() */ public final void DrawFadeScreen() { impl.Draw_FadeScreen(); } /** * @see jake2.client.refexport_t#DrawStretchRaw(int, int, int, int, int, int, byte[]) */ public final void DrawStretchRaw(int x, int y, int w, int h, int cols, int rows, byte[] data) { impl.Draw_StretchRaw(x, y, w, h, cols, rows, data); } /** * @see jake2.client.refexport_t#CinematicSetPalette(byte[]) */ public final void CinematicSetPalette(byte[] palette) { impl.R_SetPalette(palette); } /** * @see jake2.client.refexport_t#BeginFrame(float) */ public final void BeginFrame(float camera_separation) { impl.R_BeginFrame(camera_separation); } /** * @see jake2.client.refexport_t#EndFrame() */ public final void EndFrame() { endFrame(); } /** * @see jake2.client.refexport_t#AppActivate(boolean) */ public final void AppActivate(boolean activate) { appActivate(activate); } public final int apiVersion() { return Defines.API_VERSION; } public KBD getKeyboardHandler() { return kbd; } // ============================================================================ // Ref interface // ============================================================================ public final String getName() { return DRIVER_NAME; } public final String toString() { return DRIVER_NAME; } public final refexport_t GetRefAPI(RenderAPI renderer) { this.impl = renderer; return this; } } --- FastJoglRenderer.java DELETED --- --- NEW FILE: LwjglRenderer.java --- /* * LwjglRenderer.java * Copyright (C) 2004 * * $Id: LwjglRenderer.java,v 1.2 2006/11/21 00:51:22 cawe Exp $ */ /* 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; import jake2.Defines; import jake2.client.*; import jake2.qcommon.xcommand_t; import jake2.render.opengl.LwjglDriver; import jake2.sys.*; import java.awt.Dimension; import java.awt.DisplayMode; /** * LwjglRenderer * * @author dsanders/cwei */ final class LwjglRenderer extends LwjglDriver implements refexport_t, Ref { public static final String DRIVER_NAME = "lwjgl"; private KBD kbd = new LWJGLKBD(); // is set from Renderer factory private RenderAPI impl; static { Renderer.register(new LwjglRenderer()); }; private LwjglRenderer() { } // ============================================================================ // public interface for Renderer implementations // // refexport_t (ref.h) // ============================================================================ /** * @see jake2.client.refexport_t#Init() */ public boolean Init(int vid_xpos, int vid_ypos) { // init the OpenGL drivers impl.setGLDriver(this); // pre init if (!impl.R_Init(vid_xpos, vid_ypos)) return false; // post init return impl.R_Init2(); } /** * @see jake2.client.refexport_t#Shutdown() */ public void Shutdown() { impl.R_Shutdown(); } /** * @see jake2.client.refexport_t#BeginRegistration(java.lang.String) */ public final void BeginRegistration(String map) { impl.R_BeginRegistration(map); } /** * @see jake2.client.refexport_t#RegisterModel(java.lang.String) */ public final model_t RegisterModel(String name) { return impl.R_RegisterModel(name); } /** * @see jake2.client.refexport_t#RegisterSkin(java.lang.String) */ public final image_t RegisterSkin(String name) { return impl.R_RegisterSkin(name); } /** * @see jake2.client.refexport_t#RegisterPic(java.lang.String) */ public final image_t RegisterPic(String name) { return impl.Draw_FindPic(name); } /** * @see jake2.client.refexport_t#SetSky(java.lang.String, float, float[]) */ public final void SetSky(String name, float rotate, float[] axis) { impl.R_SetSky(name, rotate, axis); } /** * @see jake2.client.refexport_t#EndRegistration() */ public final void EndRegistration() { impl.R_EndRegistration(); } /** * @see jake2.client.refexport_t#RenderFrame(jake2.client.refdef_t) */ public final void RenderFrame(refdef_t fd) { impl.R_RenderFrame(fd); } /** * @see jake2.client.refexport_t#DrawGetPicSize(java.awt.Dimension, java.lang.String) */ public final void DrawGetPicSize(Dimension dim, String name) { impl.Draw_GetPicSize(dim, name); } /** * @see jake2.client.refexport_t#DrawPic(int, int, java.lang.String) */ public final void DrawPic(int x, int y, String name) { impl.Draw_Pic(x, y, name); } /** * @see jake2.client.refexport_t#DrawStretchPic(int, int, int, int, java.lang.String) */ public final void DrawStretchPic(int x, int y, int w, int h, String name) { impl.Draw_StretchPic(x, y, w, h, name); } /** * @see jake2.client.refexport_t#DrawChar(int, int, int) */ public final void DrawChar(int x, int y, int num) { impl.Draw_Char(x, y, num); } /** * @see jake2.client.refexport_t#DrawTileClear(int, int, int, int, java.lang.String) */ public final void DrawTileClear(int x, int y, int w, int h, String name) { impl.Draw_TileClear(x, y, w, h, name); } /** * @see jake2.client.refexport_t#DrawFill(int, int, int, int, int) */ public final void DrawFill(int x, int y, int w, int h, int c) { impl.Draw_Fill(x, y, w, h, c); } /** * @see jake2.client.refexport_t#DrawFadeScreen() */ public final void DrawFadeScreen() { impl.Draw_FadeScreen(); } /** * @see jake2.client.refexport_t#DrawStretchRaw(int, int, int, int, int, int, byte[]) */ public final void DrawStretchRaw(int x, int y, int w, int h, int cols, int rows, byte[] data) { impl.Draw_StretchRaw(x, y, w, h, cols, rows, data); } /** * @see jake2.client.refexport_t#CinematicSetPalette(byte[]) */ public final void CinematicSetPalette(byte[] palette) { impl.R_SetPalette(palette); } /** * @see jake2.client.refexport_t#BeginFrame(float) */ public final void BeginFrame(float camera_separation) { impl.R_BeginFrame(camera_separation); } /** * @see jake2.client.refexport_t#EndFrame() */ public final void EndFrame() { endFrame(); /* try { Thread.sleep(1); } catch (InterruptedException e) { }*/ } /** * @see jake2.client.refexport_t#AppActivate(boolean) */ public final void AppActivate(boolean activate) { appActivate(activate); } public final int apiVersion() { return Defines.API_VERSION; } public KBD getKeyboardHandler() { return kbd; } // ============================================================================ // Ref interface // ============================================================================ public final String getName() { return DRIVER_NAME; } public final String toString() { return DRIVER_NAME; } public final refexport_t GetRefAPI(RenderAPI renderer) { this.impl = renderer; return this; } } --- LWJGLRenderer.java DELETED --- --- NEW FILE: JoglRenderer.java --- /* * JoglRenderer.java * Copyright (C) 2003 * * $Id: JoglRenderer.java,v 1.8 2006/11/21 00:51:22 cawe Exp $ */ /* 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; import jake2.Defines; import jake2.client.refdef_t; import jake2.client.refexport_t; import jake2.qcommon.xcommand_t; import jake2.render.opengl.JoglDriver; import jake2.sys.JOGLKBD; import jake2.sys.KBD; import java.awt.Dimension; /** * JoglRenderer * * @author cwei */ final class JoglRenderer extends JoglDriver implements refexport_t, Ref { public static final String DRIVER_NAME = "jogl"; private KBD kbd = new JOGLKBD(); // is set from Renderer factory private RenderAPI impl; static { Renderer.register(new JoglRenderer()); }; private JoglRenderer() { // singleton } // ============================================================================ // public interface for Renderer implementations // // refexport_t (ref.h) // ============================================================================ private boolean post_init = false; /** * @see jake2.client.refexport_t#Init() */ public boolean Init(int vid_xpos, int vid_ypos) { // init the OpenGL drivers impl.setGLDriver(this); // pre init if (!impl.R_Init(vid_xpos, vid_ypos)) return false; // calls the R_Init2() internally updateScreen(new xcommand_t() { public void execute() { JoglRenderer.this.post_init = impl.R_Init2(); } }); // the result from R_Init2() return post_init; } /** * @see jake2.client.refexport_t#Shutdown() */ public void Shutdown() { impl.R_Shutdown(); } /** * @see jake2.client.refexport_t#BeginRegistration(java.lang.String) */ public void BeginRegistration(String map) { if (contextInUse) { impl.R_BeginRegistration(map); return; } this.name = map; updateScreen(new xcommand_t() { public void execute() { impl.R_BeginRegistration(JoglRenderer.this.name); } }); } private model_t model = null; private String name = null; /** * @see jake2.client.refexport_t#RegisterModel(java.lang.String) */ public model_t RegisterModel(String name) { if (contextInUse) return impl.R_RegisterModel(name); model = null; this.name = name; updateScreen(new xcommand_t() { public void execute() { JoglRenderer.this.model = impl.R_RegisterModel(JoglRenderer.this.name); } }); return model; } /** * @see jake2.client.refexport_t#RegisterSkin(java.lang.String) */ public image_t RegisterSkin(String name) { if (contextInUse) return impl.R_RegisterSkin(name); this.image = null; this.name = name; updateScreen(new xcommand_t() { public void execute() { JoglRenderer.this.image = impl.R_RegisterSkin(JoglRenderer.this.name); } }); return image; } private image_t image = null; /** * @see jake2.client.refexport_t#RegisterPic(java.lang.String) */ public image_t RegisterPic(String name) { if (contextInUse) return impl.Draw_FindPic(name); this.image = null; this.name = name; updateScreen(new xcommand_t() { public void execute() { JoglRenderer.this.image = impl.Draw_FindPic(JoglRenderer.this.name); } }); return image; } private float[] axis; private float rotate; /** * @see jake2.client.refexport_t#SetSky(java.lang.String, float, float[]) */ public void SetSky(String name, float rotate, float[] axis) { if (contextInUse) { impl.R_SetSky(name, rotate, axis); return; } this.name = name; this.rotate = rotate; this.axis = axis; updateScreen(new xcommand_t() { public void execute() { impl.R_SetSky(JoglRenderer.this.name, JoglRenderer.this.rotate, JoglRenderer.this.axis); } }); } /** * @see jake2.client.refexport_t#EndRegistration() */ public void EndRegistration() { if (contextInUse) { impl.R_EndRegistration(); return; } updateScreen(new xcommand_t() { public void execute() { impl.R_EndRegistration(); } }); } /** * @see jake2.client.refexport_t#RenderFrame(jake2.client.refdef_t) */ public void RenderFrame(refdef_t fd) { impl.R_RenderFrame(fd); } /** * @see jake2.client.refexport_t#DrawGetPicSize(java.awt.Dimension, java.lang.String) */ public void DrawGetPicSize(Dimension dim, String name) { impl.Draw_GetPicSize(dim, name); } /** * @see jake2.client.refexport_t#DrawPic(int, int, java.lang.String) */ public void DrawPic(int x, int y, String name) { impl.Draw_Pic(x, y, name); } /** * @see jake2.client.refexport_t#DrawStretchPic(int, int, int, int, java.lang.String) */ public void DrawStretchPic(int x, int y, int w, int h, String name) { impl.Draw_StretchPic(x, y, w, h, name); } private int x, y, num; /** * @see jake2.client.refexport_t#DrawChar(int, int, int) */ public void DrawChar(int x, int y, int num) { if (contextInUse) { impl.Draw_Char(x, y, num);; return; } this.x = x; this.y = y; this.num = num; updateScreen(new xcommand_t() { public void execute() { impl.Draw_Char(JoglRenderer.this.x, JoglRenderer.this.y, JoglRenderer.this.num); } }); } /** * @see jake2.client.refexport_t#DrawTileClear(int, int, int, int, java.lang.String) */ public void DrawTileClear(int x, int y, int w, int h, String name) { impl.Draw_TileClear(x, y, w, h, name); } /** * @see jake2.client.refexport_t#DrawFill(int, int, int, int, int) */ public void DrawFill(int x, int y, int w, int h, int c) { impl.Draw_Fill(x, y, w, h, c); } /** * @see jake2.client.refexport_t#DrawFadeScreen() */ public void DrawFadeScreen() { impl.Draw_FadeScreen(); } /** * @see jake2.client.refexport_t#DrawStretchRaw(int, int, int, int, int, int, byte[]) */ public void DrawStretchRaw(int x, int y, int w, int h, int cols, int rows, byte[] data) { impl.Draw_StretchRaw(x, y, w, h, cols, rows, data); } /** * @see jake2.client.refexport_t#CinematicSetPalette(byte[]) */ public void CinematicSetPalette(byte[] palette) { impl.R_SetPalette(palette); } /** * @see jake2.client.refexport_t#BeginFrame(float) */ public void BeginFrame(float camera_separation) { impl.R_BeginFrame(camera_separation); } /** * @see jake2.client.refexport_t#EndFrame() */ public void EndFrame() { endFrame(); } /** * @see jake2.client.refexport_t#AppActivate(boolean) */ public void AppActivate(boolean activate) { appActivate(activate); } public int apiVersion() { return Defines.API_VERSION; } public KBD getKeyboardHandler() { return kbd; } // ============================================================================ // Ref interface // ============================================================================ public String getName() { return DRIVER_NAME; } public String toString() { return DRIVER_NAME; } public refexport_t GetRefAPI(RenderAPI renderer) { this.impl = renderer; return this; } } Index: Ref.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/Ref.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Ref.java 16 Jul 2004 10:11:34 -0000 1.2 --- Ref.java 21 Nov 2006 00:51:22 -0000 1.3 *************** *** 35,42 **** public interface Ref { ! // ============================================================================ ! // extensions (cwei) ! // ============================================================================ ! refexport_t GetRefAPI(); String getName(); } --- 35,39 ---- public interface Ref { ! refexport_t GetRefAPI(RenderAPI renderer); String getName(); } Index: glconfig_t.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/glconfig_t.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** glconfig_t.java 7 May 2005 18:23:26 -0000 1.2 --- glconfig_t.java 21 Nov 2006 00:51:22 -0000 1.3 *************** *** 37,41 **** public void parseOpenGLVersion() { ! version = Float.parseFloat(version_string.substring(0, 3)); } --- 37,45 ---- public void parseOpenGLVersion() { ! try { ! version = Float.parseFloat(version_string.substring(0, 3)); ! } catch (Exception e) { ! version = 1.1f; ! } } Index: Renderer.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/Renderer.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Renderer.java 12 Jan 2005 00:37:13 -0000 1.6 --- Renderer.java 21 Nov 2006 00:51:22 -0000 1.7 *************** *** 26,33 **** package jake2.render; - import java.util.Vector; - import jake2.client.refexport_t; /** * Renderer --- 26,33 ---- package jake2.render; import jake2.client.refexport_t; + import java.util.Vector; + /** * Renderer *************** *** 36,39 **** --- 36,42 ---- */ 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); *************** *** 41,62 **** static { try { ! try { ! Class.forName("net.java.games.jogl.GL"); ! Class.forName("jake2.render.JoglRenderer"); ! } catch (ClassNotFoundException e) { ! // ignore the jogl 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("net.java.games.jogl.GL"); ! Class.forName("jake2.render.FastJoglRenderer"); ! } catch (ClassNotFoundException e) { ! // ignore the fastjogl drivers if runtime not in classpath ! } } catch (Throwable e) { e.printStackTrace(); --- 44,65 ---- static { try { ! try { ! Class.forName("net.java.games.jogl.GL"); ! Class.forName("jake2.render.JoglRenderer"); ! } catch (ClassNotFoundException e) { ! // ignore the fastjogl 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 jogl drivers if runtime not in classpath ! } } catch (Throwable e) { e.printStackTrace(); *************** *** 73,81 **** } ! /** * Factory method to get the Renderer implementation. * @return refexport_t (Renderer singleton) */ ! public static refexport_t getDriver(String driverName) { // find a driver Ref driver = null; --- 76,92 ---- } ! /** ! * Factory method to get the Renderer implementation. ! * @return refexport_t (Renderer singleton) ! */ ! public static refexport_t getDriver(String driverName) { ! return getDriver(driverName, true); ! } ! ! /** * 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; *************** *** 84,88 **** driver = (Ref) drivers.get(i); if (driver.getName().equals(driverName)) { ! return driver.GetRefAPI(); } } --- 95,99 ---- driver = (Ref) drivers.get(i); if (driver.getName().equals(driverName)) { ! return driver.GetRefAPI((fast) ? fastRenderer : basicRenderer); } } *************** *** 108,110 **** --- 119,122 ---- return names; } + } \ No newline at end of file --- NEW FILE: Base.java --- /* * Base.java * Copyright (C) 2003 * * $Id: Base.java,v 1.2 2006/11/21 00:51:22 cawe Exp $ */ /* 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; import jake2.client.refexport_t; import jake2.client.viddef_t; import jake2.game.cvar_t; import jake2.render.*; import jake2.render.opengl.*; import java.awt.Dimension; /** * Base * * @author dsanders/cwei */ public abstract class Base implements QGLConst, RenderAPI { public static final int GL_COLOR_INDEX8_EXT = GL_COLOR_INDEX; public static final String REF_VERSION = "GL 0.01"; // up / down public static final int PITCH = 0; // left / right public static final int YAW = 1; // fall over public static final int ROLL = 2; /* * skins will be outline flood filled and mip mapped pics and sprites with * alpha will be outline flood filled pic won't be mip mapped * * model skin sprite frame wall texture pic */ // enum imagetype_t public static final int it_skin = 0; public static final int it_sprite = 1; public static final int it_wall = 2; public static final int it_pic = 3; public static final int it_sky = 4; // enum modtype_t public static final int mod_bad = 0; public static final int mod_brush = 1; public static final int mod_sprite = 2; public static final int mod_alias = 3; public static final int TEXNUM_LIGHTMAPS = 1024; public static final int TEXNUM_SCRAPS = 1152; public static final int TEXNUM_IMAGES = 1153; public static final int MAX_GLTEXTURES = 1024; public static final int MAX_LBM_HEIGHT = 480; public static final float BACKFACE_EPSILON = 0.01f; /* * * GL config stuff */ public static final int GL_RENDERER_VOODOO = 0x00000001; public static final int GL_RENDERER_VOODOO2 = 0x00000002; public static final int GL_RENDERER_VOODOO_RUSH = 0x00000004; public static final int GL_RENDERER_BANSHEE = 0x00000008; public static final int GL_RENDERER_3DFX = 0x0000000F; public static final int GL_RENDERER_PCX1 = 0x00000010; public static final int GL_RENDERER_PCX2 = 0x00000020; public static final int GL_RENDERER_PMX = 0x00000040; public static final int GL_RENDERER_POWERVR = 0x00000070; public static final int GL_RENDERER_PERMEDIA2 = 0x00000100; public static final int GL_RENDERER_GLINT_MX = 0x00000200; public static final int GL_RENDERER_GLINT_TX = 0x00000400; public static final int GL_RENDERER_3DLABS_MISC = 0x00000800; public static final int GL_RENDERER_3DLABS = 0x00000F00; public static final int GL_RENDERER_REALIZM = 0x00001000; public static final int GL_RENDERER_REALIZM2 = 0x00002000; public static final int GL_RENDERER_INTERGRAPH = 0x00003000; public static final int GL_RENDERER_3DPRO = 0x00004000; public static final int GL_RENDERER_REAL3D = 0x00008000; public static final int GL_RENDERER_RIVA128 = 0x00010000; public static final int GL_RENDERER_DYPIC = 0x00020000; public static final int GL_RENDERER_V1000 = 0x00040000; public static final int GL_RENDERER_V2100 = 0x00080000; public static final int GL_RENDERER_V2200 = 0x00100000; public static final int GL_RENDERER_RENDITION = 0x001C0000; public static final int GL_RENDERER_O2 = 0x00100000; public static final int GL_RENDERER_IMPACT = 0x00200000; public static final int GL_RENDERER_RE = 0x00400000; public static final int GL_RENDERER_IR = 0x00800000; public static final int GL_RENDERER_SGI = 0x00F00000; public static final int GL_RENDERER_MCD = 0x01000000; public static final int GL_RENDERER_OTHER = 0x80000000; // enum rserr_t public static final int rserr_ok = 0; public static final int rserr_invalid_fullscreen = 1; public static final int rserr_invalid_mode = 2; public static final int rserr_unknown = 3; /* * base members */ protected static viddef_t vid = new viddef_t(); protected cvar_t vid_fullscreen; protected QGL gl; protected GLDriver glImpl; public void setGLDriver(GLDriver driver) { glImpl = driver; gl = (QGL)driver; } public static void setVid(int width, int height) { vid.width = width; vid.height = height; } } --- JoglBase.java DELETED --- |
From: Carsten W. <ca...@us...> - 2006-11-21 00:50:49
|
Update of /cvsroot/jake2/jake2/src/jake2/render/basic In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv15997/src/jake2/render/basic Added Files: Model.java Misc.java Warp.java Main.java Image.java Mesh.java Surf.java Draw.java Light.java Anorms.java Polygon.java Log Message: merge render-refactoring branch into the HEAD --- NEW FILE: Image.java --- /* * Image.java * Copyright (C) 2003 * * $Id: Image.java,v 1.2 2006/11/21 00:50:46 cawe Exp $ */ /* 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. [...1625 lines suppressed...] /* * =============== GL_ShutdownImages =============== */ void GL_ShutdownImages() { image_t image; for (int i = 0; i < numgltextures; i++) { image = gltextures[i]; if (image.registration_sequence == 0) continue; // free image_t slot // free it texnum.put(0, image.texnum); gl.glDeleteTextures(texnum); image.clear(); } } } --- NEW FILE: Surf.java --- /* * Surf.java * Copyright (C) 2003 * * $Id: Surf.java,v 1.2 2006/11/21 00:50:46 cawe Exp $ */ /* 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. [...1651 lines suppressed...] // IntBuffer pix = ByteBuffer.wrap(buf).order(ByteOrder.LITTLE_ENDIAN).asIntBuffer(); // // int[] pixel = new int[w * h]; // // pix.get(pixel); // // BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_4BYTE_ABGR); // image.setRGB(0, 0, w, h, pixel, 0, w); // AffineTransformOp op = new AffineTransformOp(AffineTransform.getScaleInstance(scale, scale), AffineTransformOp.TYPE_NEAREST_NEIGHBOR); // BufferedImage tmp = op.filter(image, null); // // if (frame == null) { // frame = new ImageFrame(null); // frame.show(); // } // frame.showImage(tmp); // // } } --- NEW FILE: Light.java --- /* * Light.java * Copyright (C) 2003 * * $Id: Light.java,v 1.2 2006/11/21 00:50:46 cawe Exp $ */ /* 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.basic; import jake2.Defines; import jake2.Globals; import jake2.client.dlight_t; import jake2.client.lightstyle_t; import jake2.game.cplane_t; import jake2.qcommon.Com; import jake2.qcommon.longjmpException; import jake2.render.mnode_t; import jake2.render.msurface_t; import jake2.render.mtexinfo_t; import jake2.util.Math3D; import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.util.Arrays; /** * Light * * @author cwei */ public abstract class Light extends Warp { // r_light.c int r_dlightframecount; static final int DLIGHT_CUTOFF = 64; /* * ============================================================================= * * DYNAMIC LIGHTS BLEND RENDERING * * ============================================================================= */ void R_RenderDlight(dlight_t light) { int i, j; float a; float[] v = { 0, 0, 0 }; float rad; rad = light.intensity * 0.35f; Math3D.VectorSubtract(light.origin, r_origin, v); gl.glBegin(GL_TRIANGLE_FAN); gl.glColor3f(light.color[0] * 0.2f, light.color[1] * 0.2f, light.color[2] * 0.2f); for (i = 0; i < 3; i++) v[i] = light.origin[i] - vpn[i] * rad; gl.glVertex3f(v[0], v[1], v[2]); gl.glColor3f(0, 0, 0); for (i = 16; i >= 0; i--) { a = (float) (i / 16.0f * Math.PI * 2); for (j = 0; j < 3; j++) v[j] = (float) (light.origin[j] + vright[j] * Math.cos(a) * rad + vup[j] * Math.sin(a) * rad); gl.glVertex3f(v[0], v[1], v[2]); } gl.glEnd(); } /* * ============= R_RenderDlights ============= */ void R_RenderDlights() { int i; dlight_t l; if (gl_flashblend.value == 0) return; r_dlightframecount = r_framecount + 1; // because the count hasn't // advanced yet for this frame gl.glDepthMask(false); gl.glDisable(GL_TEXTURE_2D); gl.glShadeModel(GL_SMOOTH); gl.glEnable(GL_BLEND); gl.glBlendFunc(GL_ONE, GL_ONE); for (i = 0; i < r_newrefdef.num_dlights; i++) { l = r_newrefdef.dlights[i]; R_RenderDlight(l); } gl.glColor3f(1, 1, 1); gl.glDisable(GL_BLEND); gl.glEnable(GL_TEXTURE_2D); gl.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); gl.glDepthMask(true); } /* * ============================================================================= * * DYNAMIC LIGHTS * * ============================================================================= */ /* * ============= R_MarkLights ============= */ void R_MarkLights(dlight_t light, int bit, mnode_t node) { cplane_t splitplane; float dist; msurface_t surf; int i; int sidebit; if (node.contents != -1) return; splitplane = node.plane; dist = Math3D.DotProduct(light.origin, splitplane.normal) - splitplane.dist; if (dist > light.intensity - DLIGHT_CUTOFF) { R_MarkLights(light, bit, node.children[0]); return; } if (dist < -light.intensity + DLIGHT_CUTOFF) { R_MarkLights(light, bit, node.children[1]); return; } // mark the polygons for (i = 0; i < node.numsurfaces; i++) { surf = r_worldmodel.surfaces[node.firstsurface + i]; /* * cwei bugfix for dlight behind the walls */ dist = Math3D.DotProduct(light.origin, surf.plane.normal) - surf.plane.dist; sidebit = (dist >= 0) ? 0 : Defines.SURF_PLANEBACK; if ((surf.flags & Defines.SURF_PLANEBACK) != sidebit) continue; /* * cwei bugfix end */ if (surf.dlightframe != r_dlightframecount) { surf.dlightbits = 0; surf.dlightframe = r_dlightframecount; } surf.dlightbits |= bit; } R_MarkLights(light, bit, node.children[0]); R_MarkLights(light, bit, node.children[1]); } /* * ============= R_PushDlights ============= */ void R_PushDlights() { int i; dlight_t l; if (gl_flashblend.value != 0) return; r_dlightframecount = r_framecount + 1; // because the count hasn't // advanced yet for this frame for (i = 0; i < r_newrefdef.num_dlights; i++) { l = r_newrefdef.dlights[i]; R_MarkLights(l, 1 << i, r_worldmodel.nodes[0]); } } /* * ============================================================================= * * LIGHT SAMPLING * * ============================================================================= */ float[] pointcolor = { 0, 0, 0 }; // vec3_t cplane_t lightplane; // used as shadow plane float[] lightspot = { 0, 0, 0 }; // vec3_t int RecursiveLightPoint(mnode_t node, float[] start, float[] end) { if (node.contents != -1) return -1; // didn't hit anything msurface_t surf; int s, t, ds, dt; int i; mtexinfo_t tex; ByteBuffer lightmap; int maps; float[] mid = { 0, 0, 0 }; // calculate mid point // FIXME: optimize for axial cplane_t plane = node.plane; float front = Math3D.DotProduct(start, plane.normal) - plane.dist; float back = Math3D.DotProduct(end, plane.normal) - plane.dist; boolean side = (front < 0); int sideIndex = (side) ? 1 : 0; if ((back < 0) == side) return RecursiveLightPoint(node.children[sideIndex], start, end); float frac = front / (front - back); mid[0] = start[0] + (end[0] - start[0]) * frac; mid[1] = start[1] + (end[1] - start[1]) * frac; mid[2] = start[2] + (end[2] - start[2]) * frac; // go down front side int r = RecursiveLightPoint(node.children[sideIndex], start, mid); if (r >= 0) return r; // hit something if ((back < 0) == side) return -1; // didn't hit anuthing // check for impact on this node Math3D.VectorCopy(mid, lightspot); lightplane = plane; int surfIndex = node.firstsurface; float[] scale = { 0, 0, 0 }; for (i = 0; i < node.numsurfaces; i++, surfIndex++) { surf = r_worldmodel.surfaces[surfIndex]; if ((surf.flags & (Defines.SURF_DRAWTURB | Defines.SURF_DRAWSKY)) != 0) continue; // no lightmaps tex = surf.texinfo; s = (int) (Math3D.DotProduct(mid, tex.vecs[0]) + tex.vecs[0][3]); t = (int) (Math3D.DotProduct(mid, tex.vecs[1]) + tex.vecs[1][3]); if (s < surf.texturemins[0] || t < surf.texturemins[1]) continue; ds = s - surf.texturemins[0]; dt = t - surf.texturemins[1]; if (ds > surf.extents[0] || dt > surf.extents[1]) continue; if (surf.samples == null) return 0; ds >>= 4; dt >>= 4; lightmap = surf.samples; int lightmapIndex = 0; Math3D.VectorCopy(Globals.vec3_origin, pointcolor); if (lightmap != null) { //float[] scale = {0, 0, 0}; float[] rgb; lightmapIndex += 3 * (dt * ((surf.extents[0] >> 4) + 1) + ds); for (maps = 0; maps < Defines.MAXLIGHTMAPS && surf.styles[maps] != (byte) 255; maps++) { rgb = r_newrefdef.lightstyles[surf.styles[maps] & 0xFF].rgb; scale[0] = gl_modulate.value * rgb[0]; scale[1] = gl_modulate.value * rgb[1]; scale[2] = gl_modulate.value * rgb[2]; pointcolor[0] += (lightmap.get(lightmapIndex + 0) & 0xFF) * scale[0] * (1.0f / 255); pointcolor[1] += (lightmap.get(lightmapIndex + 1) & 0xFF) * scale[1] * (1.0f / 255); pointcolor[2] += (lightmap.get(lightmapIndex + 2) & 0xFF) * scale[2] * (1.0f / 255); lightmapIndex += 3 * ((surf.extents[0] >> 4) + 1) * ((surf.extents[1] >> 4) + 1); } } return 1; } // go down back side return RecursiveLightPoint(node.children[1 - sideIndex], mid, end); } /* * =============== R_LightPoint =============== */ void R_LightPoint(float[] p, float[] color) { assert (p.length == 3) : "vec3_t bug"; assert (color.length == 3) : "rgb bug"; float[] end = { 0, 0, 0 }; dlight_t dl; float add; if (r_worldmodel.lightdata == null) { color[0] = color[1] = color[2] = 1.0f; return; } end[0] = p[0]; end[1] = p[1]; end[2] = p[2] - 2048; float r = RecursiveLightPoint(r_worldmodel.nodes[0], p, end); if (r == -1) { Math3D.VectorCopy(Globals.vec3_origin, color); } else { Math3D.VectorCopy(pointcolor, color); } // // add dynamic lights // for (int lnum = 0; lnum < r_newrefdef.num_dlights; lnum++) { dl = r_newrefdef.dlights[lnum]; Math3D.VectorSubtract(currententity.origin, dl.origin, end); add = dl.intensity - Math3D.VectorLength(end); add *= (1.0f / 256); if (add > 0) { Math3D.VectorMA(color, add, dl.color, color); } } Math3D.VectorScale(color, gl_modulate.value, color); } // =================================================================== float[] s_blocklights = new float[34 * 34 * 3]; /* * =============== R_AddDynamicLights =============== */ void R_AddDynamicLights(msurface_t surf) { int lnum; int sd, td; float fdist, frad, fminlight; float[] impact = { 0, 0, 0 }; float[] local = { 0, 0, 0 }; int s, t; int i; int smax, tmax; mtexinfo_t tex; dlight_t dl; float[] pfBL; float fsacc, ftacc; smax = (surf.extents[0] >> 4) + 1; tmax = (surf.extents[1] >> 4) + 1; tex = surf.texinfo; for (lnum = 0; lnum < r_newrefdef.num_dlights; lnum++) { if ((surf.dlightbits & (1 << lnum)) == 0) continue; // not lit by this light dl = r_newrefdef.dlights[lnum]; frad = dl.intensity; fdist = Math3D.DotProduct(dl.origin, surf.plane.normal) - surf.plane.dist; frad -= Math.abs(fdist); // rad is now the highest intensity on the plane fminlight = DLIGHT_CUTOFF; // FIXME: make configurable? if (frad < fminlight) continue; fminlight = frad - fminlight; for (i = 0; i < 3; i++) { impact[i] = dl.origin[i] - surf.plane.normal[i] * fdist; } local[0] = Math3D.DotProduct(impact, tex.vecs[0]) + tex.vecs[0][3] - surf.texturemins[0]; local[1] = Math3D.DotProduct(impact, tex.vecs[1]) + tex.vecs[1][3] - surf.texturemins[1]; pfBL = s_blocklights; int pfBLindex = 0; for (t = 0, ftacc = 0; t < tmax; t++, ftacc += 16) { td = (int) (local[1] - ftacc); if (td < 0) td = -td; for (s = 0, fsacc = 0; s < smax; s++, fsacc += 16, pfBLindex += 3) { sd = (int) (local[0] - fsacc); if (sd < 0) sd = -sd; if (sd > td) fdist = sd + (td >> 1); else fdist = td + (sd >> 1); if (fdist < fminlight) { pfBL[pfBLindex + 0] += (frad - fdist) * dl.color[0]; pfBL[pfBLindex + 1] += (frad - fdist) * dl.color[1]; pfBL[pfBLindex + 2] += (frad - fdist) * dl.color[2]; } } } } } /* * * R_SetCacheState */ void R_SetCacheState(msurface_t surf) { int maps; for (maps = 0; maps < Defines.MAXLIGHTMAPS && surf.styles[maps] != (byte) 255; maps++) { surf.cached_light[maps] = r_newrefdef.lightstyles[surf.styles[maps] & 0xFF].white; } } /* * =============== R_BuildLightMap * * Combine and scale multiple lightmaps into the floating format in * blocklights =============== */ void R_BuildLightMap(msurface_t surf, IntBuffer dest, int stride) { int smax, tmax; int r, g, b, a, max; int i, j, size; ByteBuffer lightmap; float[] scale = { 0, 0, 0, 0 }; int nummaps; float[] bl; lightstyle_t style; int monolightmap; if ((surf.texinfo.flags & (Defines.SURF_SKY | Defines.SURF_TRANS33 | Defines.SURF_TRANS66 | Defines.SURF_WARP)) != 0) Com.Error(Defines.ERR_DROP, "R_BuildLightMap called for non-lit surface"); smax = (surf.extents[0] >> 4) + 1; tmax = (surf.extents[1] >> 4) + 1; size = smax * tmax; if (size > ((s_blocklights.length * Defines.SIZE_OF_FLOAT) >> 4)) Com.Error(Defines.ERR_DROP, "Bad s_blocklights size"); try { // set to full bright if no light data if (surf.samples == null) { int maps; for (i = 0; i < size * 3; i++) s_blocklights[i] = 255; for (maps = 0; maps < Defines.MAXLIGHTMAPS && surf.styles[maps] != (byte) 255; maps++) { style = r_newrefdef.lightstyles[surf.styles[maps] & 0xFF]; } // goto store; throw new longjmpException(); } // count the # of maps for (nummaps = 0; nummaps < Defines.MAXLIGHTMAPS && surf.styles[nummaps] != (byte) 255; nummaps++) ; lightmap = surf.samples; int lightmapIndex = 0; // add all the lightmaps if (nummaps == 1) { int maps; for (maps = 0; maps < Defines.MAXLIGHTMAPS && surf.styles[maps] != (byte) 255; maps++) { bl = s_blocklights; int blp = 0; for (i = 0; i < 3; i++) scale[i] = gl_modulate.value * r_newrefdef.lightstyles[surf.styles[maps] & 0xFF].rgb[i]; if (scale[0] == 1.0F && scale[1] == 1.0F && scale[2] == 1.0F) { for (i = 0; i < size; i++) { bl[blp++] = lightmap.get(lightmapIndex++) & 0xFF; bl[blp++] = lightmap.get(lightmapIndex++) & 0xFF; bl[blp++] = lightmap.get(lightmapIndex++) & 0xFF; } } else { for (i = 0; i < size; i++) { bl[blp++] = (lightmap.get(lightmapIndex++) & 0xFF) * scale[0]; bl[blp++] = (lightmap.get(lightmapIndex++) & 0xFF) * scale[1]; bl[blp++] = (lightmap.get(lightmapIndex++) & 0xFF) * scale[2]; } } //lightmap += size*3; // skip to next lightmap } } else { int maps; // memset( s_blocklights, 0, sizeof( s_blocklights[0] ) * size * // 3 ); Arrays.fill(s_blocklights, 0, size * 3, 0.0f); for (maps = 0; maps < Defines.MAXLIGHTMAPS && surf.styles[maps] != (byte) 255; maps++) { bl = s_blocklights; int blp = 0; for (i = 0; i < 3; i++) scale[i] = gl_modulate.value * r_newrefdef.lightstyles[surf.styles[maps] & 0xFF].rgb[i]; if (scale[0] == 1.0F && scale[1] == 1.0F && scale[2] == 1.0F) { for (i = 0; i < size; i++) { bl[blp++] += lightmap.get(lightmapIndex++) & 0xFF; bl[blp++] += lightmap.get(lightmapIndex++) & 0xFF; bl[blp++] += lightmap.get(lightmapIndex++) & 0xFF; } } else { for (i = 0; i < size; i++) { bl[blp++] += (lightmap.get(lightmapIndex++) & 0xFF) * scale[0]; bl[blp++] += (lightmap.get(lightmapIndex++) & 0xFF) * scale[1]; bl[blp++] += (lightmap.get(lightmapIndex++) & 0xFF) * scale[2]; } } //lightmap += size*3; // skip to next lightmap } } // add all the dynamic lights if (surf.dlightframe == r_framecount) R_AddDynamicLights(surf); // label store: } catch (longjmpException store) { } // put into texture format stride -= smax; bl = s_blocklights; int blp = 0; monolightmap = gl_monolightmap.string.charAt(0); int destp = 0; if (monolightmap == '0') { for (i = 0; i < tmax; i++, destp += stride) { for (j = 0; j < smax; j++) { r = (int) bl[blp++]; g = (int) bl[blp++]; b = (int) bl[blp++]; // catch negative lights if (r < 0) r = 0; if (g < 0) g = 0; if (b < 0) b = 0; /* * * determine the brightest of the three color components */ if (r > g) max = r; else max = g; if (b > max) max = b; /* * * alpha is ONLY used for the mono lightmap case. For this * reason * we set it to the brightest of the color * components so that * things don't get too dim. */ a = max; /* * * rescale all the color components if the intensity of * the greatest * channel exceeds 1.0 */ if (max > 255) { float t = 255.0F / max; r = (int) (r * t); g = (int) (g * t); b = (int) (b * t); a = (int) (a * t); } r &= 0xFF; g &= 0xFF; b &= 0xFF; a &= 0xFF; dest.put(destp++, (a << 24) | (b << 16) | (g << 8) | (r << 0)); } } } else { for (i = 0; i < tmax; i++, destp += stride) { for (j = 0; j < smax; j++) { r = (int) bl[blp++]; g = (int) bl[blp++]; b = (int) bl[blp++]; // catch negative lights if (r < 0) r = 0; if (g < 0) g = 0; if (b < 0) b = 0; /* * * determine the brightest of the three color components */ if (r > g) max = r; else max = g; if (b > max) max = b; /* * * alpha is ONLY used for the mono lightmap case. For this * reason * we set it to the brightest of the color * components so that * things don't get too dim. */ a = max; /* * * rescale all the color components if the intensity of * the greatest * channel exceeds 1.0 */ if (max > 255) { float t = 255.0F / max; r = (int) (r * t); g = (int) (g * t); b = (int) (b * t); a = (int) (a * t); } /* * * So if we are doing alpha lightmaps we need to set the * R, G, and B * components to 0 and we need to set alpha to * 1-alpha. */ switch (monolightmap) { case 'L': case 'I': r = a; g = b = 0; break; case 'C': // try faking colored lighting a = 255 - ((r + g + b) / 3); r *= a / 255.0f; g *= a / 255.0f; b *= a / 255.0f; break; case 'A': default: r = g = b = 0; a = 255 - a; break; } r &= 0xFF; g &= 0xFF; b &= 0xFF; a &= 0xFF; dest.put(destp++, (a << 24) | (b << 16) | (g << 8) | (r << 0)); } } } } } --- NEW FILE: Mesh.java --- /* * Mesh.java * Copyright (C) 2003 * * $Id: Mesh.java,v 1.2 2006/11/21 00:50:46 cawe Exp $ */ /* 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.basic; import jake2.Defines; import jake2.client.VID; import jake2.client.entity_t; import jake2.qcommon.qfiles; import jake2.render.image_t; import jake2.util.Lib; import jake2.util.Math3D; import java.nio.FloatBuffer; /** * Mesh * * @author cwei */ public abstract class Mesh extends Light { // g_mesh.c: triangle model functions /* * ============================================================= * * ALIAS MODELS * * ============================================================= */ static final int NUMVERTEXNORMALS = 162; float[][] r_avertexnormals = Anorms.VERTEXNORMALS; float[][] s_lerped = new float[qfiles.MAX_VERTS][4]; float[] shadevector = { 0, 0, 0 }; float[] shadelight = { 0, 0, 0 }; // precalculated dot products for quantized angles static final int SHADEDOT_QUANT = 16; float[][] r_avertexnormal_dots = Anorms.VERTEXNORMAL_DOTS; float[] shadedots = r_avertexnormal_dots[0]; void GL_LerpVerts(int nverts, int[] ov, int[] v, float[][] lerp, float[] move, float[] frontv, float[] backv) { int i; int lerpIndex = 0; int ovv, vv; //PMM -- added RF_SHELL_DOUBLE, RF_SHELL_HALF_DAM if ((currententity.flags & (Defines.RF_SHELL_RED | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0) { float[] normal; for (i = 0; i < nverts; i++ /* , v++, ov++, lerp+=4 */ ) { vv = v[i]; normal = r_avertexnormals[(vv >>> 24) & 0xFF]; ovv = ov[i]; lerp[i][0] = move[0] + (ovv & 0xFF) * backv[0] + (vv & 0xFF) * frontv[0] + normal[0] * Defines.POWERSUIT_SCALE; lerp[i][1] = move[1] + ((ovv >>> 8) & 0xFF) * backv[1] + ((vv >>> 8) & 0xFF) * frontv[1] + normal[1] * Defines.POWERSUIT_SCALE; lerp[i][2] = move[2] + ((ovv >>> 16) & 0xFF) * backv[2] + ((vv >>> 16) & 0xFF) * frontv[2] + normal[2] * Defines.POWERSUIT_SCALE; } } else { for (i = 0; i < nverts; i++ /* , v++, ov++, lerp+=4 */ ) { vv = v[i]; ovv = ov[i]; lerp[i][0] = move[0] + (ovv & 0xFF) * backv[0] + (vv & 0xFF) * frontv[0]; lerp[i][1] = move[1] + ((ovv >>> 8) & 0xFF) * backv[1] + ((vv >>> 8) & 0xFF) * frontv[1]; lerp[i][2] = move[2] + ((ovv >>> 16) & 0xFF) * backv[2] + ((vv >>> 16) & 0xFF) * frontv[2]; } } } void GL_LerpVerts(int nverts, int[] ov, int[] v, float[] move, float[] frontv, float[] backv) { int lerpIndex = 0; int ovv, vv; FloatBuffer lerp = vertexArrayBuf; //PMM -- added RF_SHELL_DOUBLE, RF_SHELL_HALF_DAM if ((currententity.flags & (Defines.RF_SHELL_RED | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0) { float[] normal; int j = 0; for (int i = 0; i < nverts; i++ /* , v++, ov++, lerp+=4 */ ) { vv = v[i]; normal = r_avertexnormals[(v[i] >>> 24) & 0xFF]; ovv = ov[i]; lerp.put(j, move[0] + (ovv & 0xFF) * backv[0] + (vv & 0xFF) * frontv[0] + normal[0] * Defines.POWERSUIT_SCALE); lerp.put(j + 1, move[1] + ((ovv >>> 8) & 0xFF) * backv[1] + ((vv >>> 8) & 0xFF) * frontv[1] + normal[1] * Defines.POWERSUIT_SCALE); lerp.put(j + 2, move[2] + ((ovv >>> 16) & 0xFF) * backv[2] + ((vv >>> 16) & 0xFF) * frontv[2] + normal[2] * Defines.POWERSUIT_SCALE); j += 3; } } else { int j = 0; for (int i = 0; i < nverts; i++ /* , v++, ov++, lerp+=4 */ ) { ovv = ov[i]; vv = v[i]; lerp.put(j, move[0] + (ovv & 0xFF) * backv[0] + (vv & 0xFF) * frontv[0]); lerp.put(j + 1, move[1] + ((ovv >>> 8) & 0xFF) * backv[1] + ((vv >>> 8) & 0xFF) * frontv[1]); lerp.put(j + 2, move[2] + ((ovv >>> 16) & 0xFF) * backv[2] + ((vv >>> 16) & 0xFF) * frontv[2]); j += 3; } } } FloatBuffer colorArrayBuf = Lib.newFloatBuffer(qfiles.MAX_VERTS * 4); FloatBuffer vertexArrayBuf = Lib.newFloatBuffer(qfiles.MAX_VERTS * 3); boolean isFilled = false; float[] tmpVec = { 0, 0, 0 }; /* * ============= GL_DrawAliasFrameLerp * * interpolates between two frames and origins FIXME: batch lerp all * vertexes ============= */ void GL_DrawAliasFrameLerp(qfiles.dmdl_t paliashdr, float backlerp) { float l; qfiles.daliasframe_t frame, oldframe; int[] v, ov; int[] order; int orderIndex = 0; int count; float frontlerp; float alpha; float[] move = { 0, 0, 0 }; // vec3_t float[][] vectors = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } // 3 mal // vec3_t }; float[] frontv = { 0, 0, 0 }; // vec3_t float[] backv = { 0, 0, 0 }; // vec3_t int i; int index_xyz; //float[][] lerp; frame = paliashdr.aliasFrames[currententity.frame]; v = frame.verts; oldframe = paliashdr.aliasFrames[currententity.oldframe]; ov = oldframe.verts; order = paliashdr.glCmds; if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0) alpha = currententity.alpha; else alpha = 1.0f; // PMM - added double shell if ((currententity.flags & (Defines.RF_SHELL_RED | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0) gl.glDisable(GL_TEXTURE_2D); frontlerp = 1.0f - backlerp; // move should be the delta back to the previous frame * backlerp Math3D.VectorSubtract(currententity.oldorigin, currententity.origin, frontv); Math3D.AngleVectors(currententity.angles, vectors[0], vectors[1], vectors[2]); move[0] = Math3D.DotProduct(frontv, vectors[0]); // forward move[1] = -Math3D.DotProduct(frontv, vectors[1]); // left move[2] = Math3D.DotProduct(frontv, vectors[2]); // up Math3D.VectorAdd(move, oldframe.translate, move); for (i = 0; i < 3; i++) { move[i] = backlerp * move[i] + frontlerp * frame.translate[i]; frontv[i] = frontlerp * frame.scale[i]; backv[i] = backlerp * oldframe.scale[i]; } if (gl_vertex_arrays.value != 0.0f) { GL_LerpVerts(paliashdr.num_xyz, ov, v, move, frontv, backv); gl.glEnableClientState(GL_VERTEX_ARRAY); gl.glVertexPointer(3, 0, vertexArrayBuf); // PMM - added double damage shell if ((currententity.flags & (Defines.RF_SHELL_RED | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0) { gl.glDisableClientState(GL_COLOR_ARRAY); gl.glColor4f(shadelight[0], shadelight[1], shadelight[2], alpha); } else { gl.glEnableClientState(GL_COLOR_ARRAY); gl.glColorPointer(4, 0, colorArrayBuf); // // pre light everything // FloatBuffer color = colorArrayBuf; int j = 0; for (i = 0; i < paliashdr.num_xyz; i++) { // light normal index l = shadedots[(v[i] >>> 24) & 0xFF]; color.put(j++, l * shadelight[0]); color.put(j++, l * shadelight[1]); color.put(j++, l * shadelight[2]); color.put(j++, alpha); } } if (qglLockArraysEXT) gl.glLockArraysEXT(0, paliashdr.num_xyz); while (true) { // get the vertex count and primitive type count = order[orderIndex++]; if (count == 0) break; // done if (count < 0) { count = -count; gl.glBegin(GL_TRIANGLE_FAN); } else { gl.glBegin(GL_TRIANGLE_STRIP); } // PMM - added double damage shell if ((currententity.flags & (Defines.RF_SHELL_RED | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0) { do { index_xyz = order[orderIndex + 2]; orderIndex += 3; /* * vertexArrayBuf.position(4 * index_xyz); * vertexArrayBuf.get(tmpVec); gl.glVertex3fv( tmpVec ); */ gl.glArrayElement(index_xyz); } while (--count != 0); } else { do { // texture coordinates come from the draw list gl.glTexCoord2f(Float .intBitsToFloat(order[orderIndex + 0]), Float .intBitsToFloat(order[orderIndex + 1])); index_xyz = order[orderIndex + 2]; orderIndex += 3; // normals and vertexes come from the frame list gl.glArrayElement(index_xyz); } while (--count != 0); } gl.glEnd(); } if (qglLockArraysEXT) gl.glUnlockArraysEXT(); } else { GL_LerpVerts(paliashdr.num_xyz, ov, v, s_lerped, move, frontv, backv); float[] tmp; while (true) { // get the vertex count and primitive type count = order[orderIndex++]; if (count == 0) break; // done if (count < 0) { count = -count; gl.glBegin(GL_TRIANGLE_FAN); } else { gl.glBegin(GL_TRIANGLE_STRIP); } if ((currententity.flags & (Defines.RF_SHELL_RED | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE)) != 0) { do { index_xyz = order[orderIndex + 2]; orderIndex += 3; gl.glColor4f(shadelight[0], shadelight[1], shadelight[2], alpha); tmp = s_lerped[index_xyz]; gl.glVertex3f(tmp[0], tmp[1], tmp[2]); } while (--count != 0); } else { do { // texture coordinates come from the draw list // gl.glTexCoord2f (((float *)order)[0], ((float // *)order)[1]); gl.glTexCoord2f(Float .intBitsToFloat(order[orderIndex + 0]), Float .intBitsToFloat(order[orderIndex + 1])); index_xyz = order[orderIndex + 2]; orderIndex += 3; // normals and vertexes come from the frame list l = shadedots[(v[index_xyz] >>> 24) & 0xFF]; gl.glColor4f(l * shadelight[0], l * shadelight[1], l * shadelight[2], alpha); tmp = s_lerped[index_xyz]; gl.glVertex3f(tmp[0], tmp[1], tmp[2]); } while (--count != 0); } gl.glEnd(); } } // PMM - added double damage shell if ((currententity.flags & (Defines.RF_SHELL_RED | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0) gl.glEnable(GL_TEXTURE_2D); } /* * ============= GL_DrawAliasShadow ============= */ void GL_DrawAliasShadow(qfiles.dmdl_t paliashdr, int posenum) { float[] point = { 0, 0, 0 }; int count; qfiles.daliasframe_t frame; float lheight = currententity.origin[2] - lightspot[2]; frame = paliashdr.aliasFrames[currententity.frame]; int[] order = paliashdr.glCmds; float height = -lheight + 1.0f; int orderIndex = 0; int index = 0; while (true) { // get the vertex count and primitive type count = order[orderIndex++]; if (count == 0) break; // done if (count < 0) { count = -count; gl.glBegin(GL_TRIANGLE_FAN); } else gl.glBegin(GL_TRIANGLE_STRIP); do { // normals and vertexes come from the frame list /* * point[0] = verts[order[2]].v[0] * frame.scale[0] + * frame.translate[0]; point[1] = verts[order[2]].v[1] * * frame.scale[1] + frame.translate[1]; point[2] = * verts[order[2]].v[2] * frame.scale[2] + frame.translate[2]; */ if (gl_vertex_arrays.value != 0.0f) { index = order[orderIndex + 2] * 3; point[0] = vertexArrayBuf.get(index); point[1] = vertexArrayBuf.get(index + 1); point[2] = vertexArrayBuf.get(index + 2); } else { Math3D.VectorCopy(s_lerped[order[orderIndex + 2]], point); } point[0] -= shadevector[0] * (point[2] + lheight); point[1] -= shadevector[1] * (point[2] + lheight); point[2] = height; gl.glVertex3f(point[0], point[1], point[2]); orderIndex += 3; } while (--count != 0); gl.glEnd(); } } /* * * R_CullAliasModel */ boolean R_CullAliasModel(float[][] bbox, entity_t e) { int i; float[] mins = { 0, 0, 0 }; float[] maxs = { 0, 0, 0 }; qfiles.dmdl_t paliashdr; float[][] vectors = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }; float[] thismins = { 0, 0, 0 }; float[] oldmins = { 0, 0, 0 }; float[] thismaxs = { 0, 0, 0 }; float[] oldmaxs = { 0, 0, 0 }; qfiles.daliasframe_t pframe, poldframe; float[] angles = { 0, 0, 0 }; paliashdr = (qfiles.dmdl_t) currentmodel.extradata; if ((e.frame >= paliashdr.num_frames) || (e.frame < 0)) { VID.Printf(Defines.PRINT_ALL, "R_CullAliasModel " + currentmodel.name + ": no such frame " + e.frame + '\n'); e.frame = 0; } if ((e.oldframe >= paliashdr.num_frames) || (e.oldframe < 0)) { VID.Printf(Defines.PRINT_ALL, "R_CullAliasModel " + currentmodel.name + ": no such oldframe " + e.oldframe + '\n'); e.oldframe = 0; } pframe = paliashdr.aliasFrames[e.frame]; poldframe = paliashdr.aliasFrames[e.oldframe]; /* * * compute axially aligned mins and maxs */ if (pframe == poldframe) { for (i = 0; i < 3; i++) { mins[i] = pframe.translate[i]; maxs[i] = mins[i] + pframe.scale[i] * 255; } } else { for (i = 0; i < 3; i++) { thismins[i] = pframe.translate[i]; thismaxs[i] = thismins[i] + pframe.scale[i] * 255; oldmins[i] = poldframe.translate[i]; oldmaxs[i] = oldmins[i] + poldframe.scale[i] * 255; if (thismins[i] < oldmins[i]) mins[i] = thismins[i]; else mins[i] = oldmins[i]; if (thismaxs[i] > oldmaxs[i]) maxs[i] = thismaxs[i]; else maxs[i] = oldmaxs[i]; } } /* * * compute a full bounding box */ for (i = 0; i < 8; i++) { float[] tmp = { 0, 0, 0 }; if ((i & 1) != 0) tmp[0] = mins[0]; else tmp[0] = maxs[0]; if ((i & 2) != 0) tmp[1] = mins[1]; else tmp[1] = maxs[1]; if ((i & 4) != 0) tmp[2] = mins[2]; else tmp[2] = maxs[2]; Math3D.VectorCopy(tmp, bbox[i]); } /* * * rotate the bounding box */ Math3D.VectorCopy(e.angles, angles); angles[YAW] = -angles[YAW]; Math3D.AngleVectors(angles, vectors[0], vectors[1], vectors[2]); for (i = 0; i < 8; i++) { float[] tmp = { 0, 0, 0 }; Math3D.VectorCopy(bbox[i], tmp); bbox[i][0] = Math3D.DotProduct(vectors[0], tmp); bbox[i][1] = -Math3D.DotProduct(vectors[1], tmp); bbox[i][2] = Math3D.DotProduct(vectors[2], tmp); Math3D.VectorAdd(e.origin, bbox[i], bbox[i]); } { int p, f; int aggregatemask = ~0; // 0xFFFFFFFF for (p = 0; p < 8; p++) { int mask = 0; for (f = 0; f < 4; f++) { float dp = Math3D.DotProduct(frustum[f].normal, bbox[p]); if ((dp - frustum[f].dist) < 0) { mask |= (1 << f); } } aggregatemask &= mask; } if (aggregatemask != 0) { return true; } return false; } } /* * ================= R_DrawAliasModel * * ================= */ void R_DrawAliasModel(entity_t e) { int i; qfiles.dmdl_t paliashdr; float an; // bounding box float[][] bbox = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }; image_t skin; if ((e.flags & Defines.RF_WEAPONMODEL) == 0) { if (R_CullAliasModel(bbox, e)) return; } if ((e.flags & Defines.RF_WEAPONMODEL) != 0) { if (r_lefthand.value == 2.0f) return; } paliashdr = (qfiles.dmdl_t) currentmodel.extradata; // // get lighting information // // PMM - rewrote, reordered to handle new shells & mixing // PMM - 3.20 code .. replaced with original way of doing it to keep mod // authors happy // if ((currententity.flags & (Defines.RF_SHELL_HALF_DAM | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_RED | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE)) != 0) { Math3D.VectorClear(shadelight); if ((currententity.flags & Defines.RF_SHELL_HALF_DAM) != 0) { shadelight[0] = 0.56f; shadelight[1] = 0.59f; shadelight[2] = 0.45f; } if ((currententity.flags & Defines.RF_SHELL_DOUBLE) != 0) { shadelight[0] = 0.9f; shadelight[1] = 0.7f; } if ((currententity.flags & Defines.RF_SHELL_RED) != 0) shadelight[0] = 1.0f; if ((currententity.flags & Defines.RF_SHELL_GREEN) != 0) shadelight[1] = 1.0f; if ((currententity.flags & Defines.RF_SHELL_BLUE) != 0) shadelight[2] = 1.0f; } else if ((currententity.flags & Defines.RF_FULLBRIGHT) != 0) { for (i = 0; i < 3; i++) shadelight[i] = 1.0f; } else { R_LightPoint(currententity.origin, shadelight); // player lighting hack for communication back to server // big hack! if ((currententity.flags & Defines.RF_WEAPONMODEL) != 0) { // pick the greatest component, which should be the same // as the mono value returned by software if (shadelight[0] > shadelight[1]) { if (shadelight[0] > shadelight[2]) r_lightlevel.value = 150 * shadelight[0]; else r_lightlevel.value = 150 * shadelight[2]; } else { if (shadelight[1] > shadelight[2]) r_lightlevel.value = 150 * shadelight[1]; else r_lightlevel.value = 150 * shadelight[2]; } } if (gl_monolightmap.string.charAt(0) != '0') { float s = shadelight[0]; if (s < shadelight[1]) s = shadelight[1]; if (s < shadelight[2]) s = shadelight[2]; shadelight[0] = s; shadelight[1] = s; shadelight[2] = s; } } if ((currententity.flags & Defines.RF_MINLIGHT) != 0) { for (i = 0; i < 3; i++) if (shadelight[i] > 0.1f) break; if (i == 3) { shadelight[0] = 0.1f; shadelight[1] = 0.1f; shadelight[2] = 0.1f; } } if ((currententity.flags & Defines.RF_GLOW) != 0) { // bonus items will // pulse with time float scale; float min; scale = (float) (0.1f * Math.sin(r_newrefdef.time * 7)); for (i = 0; i < 3; i++) { min = shadelight[i] * 0.8f; shadelight[i] += scale; if (shadelight[i] < min) shadelight[i] = min; } } // ================= // PGM ir goggles color override if ((r_newrefdef.rdflags & Defines.RDF_IRGOGGLES) != 0 && (currententity.flags & Defines.RF_IR_VISIBLE) != 0) { shadelight[0] = 1.0f; shadelight[1] = 0.0f; shadelight[2] = 0.0f; } // PGM // ================= shadedots = r_avertexnormal_dots[((int) (currententity.angles[1] * (SHADEDOT_QUANT / 360.0))) & (SHADEDOT_QUANT - 1)]; an = (float) (currententity.angles[1] / 180 * Math.PI); shadevector[0] = (float) Math.cos(-an); shadevector[1] = (float) Math.sin(-an); shadevector[2] = 1; Math3D.VectorNormalize(shadevector); // // locate the proper data // c_alias_polys += paliashdr.num_tris; // // draw all the triangles // if ((currententity.flags & Defines.RF_DEPTHHACK) != 0) // hack the depth range to prevent view model from poking into walls gl.glDepthRange(gldepthmin, gldepthmin + 0.3 * (gldepthmax - gldepthmin)); if ((currententity.flags & Defines.RF_WEAPONMODEL) != 0 && (r_lefthand.value == 1.0f)) { gl.glMatrixMode(GL_PROJECTION); gl.glPushMatrix(); gl.glLoadIdentity(); gl.glScalef(-1, 1, 1); MYgluPerspective(r_newrefdef.fov_y, (float) r_newrefdef.width / r_newrefdef.height, 4, 4096); gl.glMatrixMode(GL_MODELVIEW); gl.glCullFace(GL_BACK); } gl.glPushMatrix(); e.angles[PITCH] = -e.angles[PITCH]; // sigh. R_RotateForEntity(e); e.angles[PITCH] = -e.angles[PITCH]; // sigh. // select skin if (currententity.skin != null) skin = currententity.skin; // custom player skin else { if (currententity.skinnum >= qfiles.MAX_MD2SKINS) skin = currentmodel.skins[0]; else { skin = currentmodel.skins[currententity.skinnum]; if (skin == null) skin = currentmodel.skins[0]; } } if (skin == null) skin = r_notexture; // fallback... GL_Bind(skin.texnum); // draw it gl.glShadeModel(GL_SMOOTH); GL_TexEnv(GL_MODULATE); if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0) { gl.glEnable(GL_BLEND); } if ((currententity.frame >= paliashdr.num_frames) || (currententity.frame < 0)) { VID.Printf(Defines.PRINT_ALL, "R_DrawAliasModel " + currentmodel.name + ": no such frame " + currententity.frame + '\n'); currententity.frame = 0; currententity.oldframe = 0; } if ((currententity.oldframe >= paliashdr.num_frames) || (currententity.oldframe < 0)) { VID.Printf(Defines.PRINT_ALL, "R_DrawAliasModel " + currentmodel.name + ": no such oldframe " + currententity.oldframe + '\n'); currententity.frame = 0; currententity.oldframe = 0; } if (r_lerpmodels.value == 0.0f) currententity.backlerp = 0; GL_DrawAliasFrameLerp(paliashdr, currententity.backlerp); GL_TexEnv(GL_REPLACE); gl.glShadeModel(GL_FLAT); gl.glPopMatrix(); if ((currententity.flags & Defines.RF_WEAPONMODEL) != 0 && (r_lefthand.value == 1.0F)) { gl.glMatrixMode(GL_PROJECTION); gl.glPopMatrix(); gl.glMatrixMode(GL_MODELVIEW); gl.glCullFace(GL_FRONT); } if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0) { gl.glDisable(GL_BLEND); } if ((currententity.flags & Defines.RF_DEPTHHACK) != 0) gl.glDepthRange(gldepthmin, gldepthmax); if (gl_shadows.value != 0.0f && (currententity.flags & (Defines.RF_TRANSLUCENT | Defines.RF_WEAPONMODEL)) == 0) { gl.glPushMatrix(); R_RotateForEntity(e); gl.glDisable(GL_TEXTURE_2D); gl.glEnable(GL_BLEND); gl.glColor4f(0, 0, 0, 0.5f); GL_DrawAliasShadow(paliashdr, currententity.frame); gl.glEnable(GL_TEXTURE_2D); gl.glDisable(GL_BLEND); gl.glPopMatrix(); } gl.glColor4f(1, 1, 1, 1); } } --- NEW FILE: Model.java --- /* * Model.java * Copyright (C) 2003 * * $Id: Model.java,v 1.2 2006/11/21 00:50:46 cawe Exp $ */ /* 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. [...1228 lines suppressed...] { mod.clear(); } /* ================ Mod_FreeAll ================ */ void Mod_FreeAll() { for (int i=0 ; i<mod_numknown ; i++) { if (mod_known[i].extradata != null) Mod_Free(mod_known[i]); } } } --- NEW FILE: Main.java --- /* * Main.java * Copyright (C) 2003 * * $Id: Main.java,v 1.2 2006/11/21 00:50:46 cawe Exp $ */ /* 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. [...1547 lines suppressed...] float[] v; for (i = 0; i < NUM_BEAM_SEGS; i++) { v = start_points[i]; gl.glVertex3f(v[0], v[1], v[2]); v = end_points[i]; gl.glVertex3f(v[0], v[1], v[2]); v = start_points[(i + 1) % NUM_BEAM_SEGS]; gl.glVertex3f(v[0], v[1], v[2]); v = end_points[(i + 1) % NUM_BEAM_SEGS]; gl.glVertex3f(v[0], v[1], v[2]); } gl.glEnd(); gl.glEnable(GL_TEXTURE_2D); gl.glDisable(GL_BLEND); gl.glDepthMask(true); } } --- NEW FILE: Polygon.java --- /* * Polygon.java * Copyright (C) 2003 * * $Id: Polygon.java,v 1.2 2006/11/21 00:50:46 cawe Exp $ */ /* 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.basic; import jake2.render.glpoly_t; /** * Polygon * * @author cwei */ public final class Polygon extends glpoly_t { private final static int MAXPOLYS = 20000; private final static int MAX_BUFFER_VERTICES = 120000; private static float[] buffer = new float[MAX_BUFFER_VERTICES * STRIDE]; private static int bufferIndex = 0; private static int polyCount = 0; private static Polygon[] polyCache = new Polygon[MAXPOLYS]; static { for (int i = 0; i < polyCache.length; i++) { polyCache[i] = new Polygon(); } } public static glpoly_t create(int numverts) { Polygon poly = polyCache[polyCount++]; poly.clear(); poly.numverts = numverts; poly.pos = bufferIndex; bufferIndex += numverts; return poly; } public static void reset() { polyCount = 0; bufferIndex = 0; } private Polygon() { } private final void clear() { next = null; chain = null; numverts = 0; flags = 0; } public final float x(int index) { return buffer[offset(index)]; } public final void x(int index, float value) { buffer[offset(index)] = value; } public final float y(int index) { return buffer[offset(index) + 1]; } public final void y(int index, float value) { buffer[offset(index) + 1] = value; } public final float z(int index) { return buffer[offset(index) + 2]; } public final void z(int index, float value) { buffer[offset(index) + 2] = value; } public final float s1(int index) { return buffer[offset(index) + 3]; } public final void s1(int index, float value) { buffer[offset(index) + 3] = value; } public final float t1(int index) { return buffer[offset(index) + 4]; } public final void t1(int index, float value) { buffer[offset(index) + 4] = value; } public final float s2(int index) { return buffer[offset(index) + 5]; } public final void s2(int index, float value) { buffer[offset(index) + 5] = value; } public final float t2(int index) { return buffer[offset(index) + 6]; } public final void t2(int index, float value) { buffer[offset(index) + 6] = value; } public final void beginScrolling(float value) { // not in use } public final void endScrolling() { // not in use } private final int offset(int index) { return (index + pos) * STRIDE; } } --- NEW FILE: Warp.java --- /* * Warp.java * Copyright (C) 2003 * * $Id: Warp.java,v 1.2 2006/11/21 00:50:46 cawe Exp $ */ /* 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 ... [truncated message content] |
From: Carsten W. <ca...@us...> - 2006-11-21 00:50:49
|
Update of /cvsroot/jake2/jake2/src/jake2/render/fast In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv15997/src/jake2/render/fast Added Files: Misc.java Warp.java Anorms.java Light.java Polygon.java Model.java Mesh.java Surf.java Main.java Draw.java Image.java Log Message: merge render-refactoring branch into the HEAD --- NEW FILE: Image.java --- /* * Image.java * Copyright (C) 2003 * * $Id: Image.java,v 1.2 2006/11/21 00:50:46 cawe Exp $ */ /* 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. [...1638 lines suppressed...] image_t image; for (int i=0; i < numgltextures ; i++) { image = gltextures[i]; if (image.registration_sequence == 0) continue; // free image_t slot // free it texnumBuffer.clear(); texnumBuffer.put(0,image.texnum); gl.glDeleteTextures(texnumBuffer); imageCache.remove(image.name); image.clear(); } } } --- NEW FILE: Surf.java --- /* * Surf.java * Copyright (C) 2003 * * $Id: Surf.java,v 1.2 2006/11/21 00:50:46 cawe Exp $ */ /* 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. [...1294 lines suppressed...] // IntBuffer pix = ByteBuffer.wrap(buf).order(ByteOrder.LITTLE_ENDIAN).asIntBuffer(); // // int[] pixel = new int[w * h]; // // pix.get(pixel); // // BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_4BYTE_ABGR); // image.setRGB(0, 0, w, h, pixel, 0, w); // AffineTransformOp op = new AffineTransformOp(AffineTransform.getScaleInstance(scale, scale), AffineTransformOp.TYPE_NEAREST_NEIGHBOR); // BufferedImage tmp = op.filter(image, null); // // if (frame == null) { // frame = new ImageFrame(null); // frame.show(); // } // frame.showImage(tmp); // // } } --- NEW FILE: Light.java --- /* * Light.java * Copyright (C) 2003 * * $Id: Light.java,v 1.2 2006/11/21 00:50:46 cawe Exp $ */ /* 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.fast; import jake2.Defines; import jake2.Globals; import jake2.client.dlight_t; import jake2.game.cplane_t; import jake2.qcommon.Com; import jake2.render.*; import jake2.util.Math3D; import jake2.util.Vec3Cache; import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.util.Arrays; /** * Light * * @author cwei */ public abstract class Light extends Warp { // r_light.c int r_dlightframecount; static final int DLIGHT_CUTOFF = 64; /* ============================================================================= DYNAMIC LIGHTS BLEND RENDERING ============================================================================= */ // stack variable private final float[] v = {0, 0, 0}; /** * R_RenderDlight */ void R_RenderDlight(dlight_t light) { float rad = light.intensity * 0.35f; Math3D.VectorSubtract (light.origin, r_origin, v); gl.glBegin (GL_TRIANGLE_FAN); gl.glColor3f (light.color[0]*0.2f, light.color[1]*0.2f, light.color[2]*0.2f); int i; for (i=0 ; i<3 ; i++) v[i] = light.origin[i] - vpn[i]*rad; gl.glVertex3f(v[0], v[1], v[2]); gl.glColor3f (0,0,0); int j; float a; for (i=16 ; i>=0 ; i--) { a = (float)(i/16.0f * Math.PI*2); for (j=0 ; j<3 ; j++) v[j] = (float)(light.origin[j] + vright[j]*Math.cos(a)*rad + vup[j]*Math.sin(a)*rad); gl.glVertex3f(v[0], v[1], v[2]); } gl.glEnd (); } /** * R_RenderDlights */ void R_RenderDlights() { if (gl_flashblend.value == 0) return; r_dlightframecount = r_framecount + 1; // because the count hasn't // advanced yet for this frame gl.glDepthMask(false); gl.glDisable(GL_TEXTURE_2D); gl.glShadeModel (GL_SMOOTH); gl.glEnable (GL_BLEND); gl.glBlendFunc (GL_ONE, GL_ONE); for (int i=0 ; i<r_newrefdef.num_dlights ; i++) { R_RenderDlight(r_newrefdef.dlights[i]); } gl.glColor3f (1,1,1); gl.glDisable(GL_BLEND); gl.glEnable(GL_TEXTURE_2D); gl.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); gl.glDepthMask(true); } /* ============================================================================= DYNAMIC LIGHTS ============================================================================= */ /** * R_MarkLights */ void R_MarkLights (dlight_t light, int bit, mnode_t node) { if (node.contents != -1) return; cplane_t splitplane = node.plane; float dist = Math3D.DotProduct (light.origin, splitplane.normal) - splitplane.dist; if (dist > light.intensity - DLIGHT_CUTOFF) { R_MarkLights (light, bit, node.children[0]); return; } if (dist < -light.intensity + DLIGHT_CUTOFF) { R_MarkLights (light, bit, node.children[1]); return; } // mark the polygons msurface_t surf; int sidebit; for (int i=0 ; i<node.numsurfaces ; i++) { surf = r_worldmodel.surfaces[node.firstsurface + i]; /* * cwei * bugfix for dlight behind the walls */ dist = Math3D.DotProduct (light.origin, surf.plane.normal) - surf.plane.dist; sidebit = (dist >= 0) ? 0 : Defines.SURF_PLANEBACK; if ( (surf.flags & Defines.SURF_PLANEBACK) != sidebit ) continue; /* * cwei * bugfix end */ if (surf.dlightframe != r_dlightframecount) { surf.dlightbits = 0; surf.dlightframe = r_dlightframecount; } surf.dlightbits |= bit; } R_MarkLights (light, bit, node.children[0]); R_MarkLights (light, bit, node.children[1]); } /** * R_PushDlights */ void R_PushDlights() { if (gl_flashblend.value != 0) return; r_dlightframecount = r_framecount + 1; // because the count hasn't // advanced yet for this frame dlight_t l; for (int i=0 ; i<r_newrefdef.num_dlights ; i++) { l = r_newrefdef.dlights[i]; R_MarkLights( l, 1<<i, r_worldmodel.nodes[0] ); } } /* ============================================================================= LIGHT SAMPLING ============================================================================= */ float[] pointcolor = {0, 0, 0}; // vec3_t cplane_t lightplane; // used as shadow plane float[] lightspot = {0, 0, 0}; // vec3_t /** * RecursiveLightPoint * @param node * @param start * @param end * @return */ int RecursiveLightPoint (mnode_t node, float[] start, float[] end) { if (node.contents != -1) return -1; // didn't hit anything // calculate mid point // FIXME: optimize for axial cplane_t plane = node.plane; float front = Math3D.DotProduct (start, plane.normal) - plane.dist; float back = Math3D.DotProduct (end, plane.normal) - plane.dist; boolean side = (front < 0); int sideIndex = (side) ? 1 : 0; if ( (back < 0) == side) return RecursiveLightPoint (node.children[sideIndex], start, end); float frac = front / (front-back); float[] mid = Vec3Cache.get(); mid[0] = start[0] + (end[0] - start[0])*frac; mid[1] = start[1] + (end[1] - start[1])*frac; mid[2] = start[2] + (end[2] - start[2])*frac; // go down front side int r = RecursiveLightPoint (node.children[sideIndex], start, mid); if (r >= 0) { Vec3Cache.release(); // mid return r; // hit something } if ( (back < 0) == side ) { Vec3Cache.release(); // mid return -1; // didn't hit anuthing } // check for impact on this node Math3D.VectorCopy (mid, lightspot); lightplane = plane; int surfIndex = node.firstsurface; msurface_t surf; int s, t, ds, dt; mtexinfo_t tex; ByteBuffer lightmap; int maps; for (int i=0 ; i<node.numsurfaces ; i++, surfIndex++) { surf = r_worldmodel.surfaces[surfIndex]; if ((surf.flags & (Defines.SURF_DRAWTURB | Defines.SURF_DRAWSKY)) != 0) continue; // no lightmaps tex = surf.texinfo; s = (int)(Math3D.DotProduct (mid, tex.vecs[0]) + tex.vecs[0][3]); t = (int)(Math3D.DotProduct (mid, tex.vecs[1]) + tex.vecs[1][3]); if (s < surf.texturemins[0] || t < surf.texturemins[1]) continue; ds = s - surf.texturemins[0]; dt = t - surf.texturemins[1]; if ( ds > surf.extents[0] || dt > surf.extents[1] ) continue; if (surf.samples == null) return 0; ds >>= 4; dt >>= 4; lightmap = surf.samples; int lightmapIndex = 0; Math3D.VectorCopy (Globals.vec3_origin, pointcolor); if (lightmap != null) { float[] rgb; lightmapIndex += 3 * (dt * ((surf.extents[0] >> 4) + 1) + ds); float scale0, scale1, scale2; for (maps = 0 ; maps < Defines.MAXLIGHTMAPS && surf.styles[maps] != (byte)255; maps++) { rgb = r_newrefdef.lightstyles[surf.styles[maps] & 0xFF].rgb; scale0 = gl_modulate.value * rgb[0]; scale1 = gl_modulate.value * rgb[1]; scale2 = gl_modulate.value * rgb[2]; pointcolor[0] += (lightmap.get(lightmapIndex + 0) & 0xFF) * scale0 * (1.0f/255); pointcolor[1] += (lightmap.get(lightmapIndex + 1) & 0xFF) * scale1 * (1.0f/255); pointcolor[2] += (lightmap.get(lightmapIndex + 2) & 0xFF) * scale2 * (1.0f/255); lightmapIndex += 3 * ((surf.extents[0] >> 4) + 1) * ((surf.extents[1] >> 4) + 1); } } Vec3Cache.release(); // mid return 1; } // go down back side r = RecursiveLightPoint (node.children[1 - sideIndex], mid, end); Vec3Cache.release(); // mid return r; } // stack variable private final float[] end = {0, 0, 0}; /** * R_LightPoint */ void R_LightPoint (float[] p, float[] color) { assert (p.length == 3) : "vec3_t bug"; assert (color.length == 3) : "rgb bug"; if (r_worldmodel.lightdata == null) { color[0] = color[1] = color[2] = 1.0f; return; } end[0] = p[0]; end[1] = p[1]; end[2] = p[2] - 2048; float r = RecursiveLightPoint(r_worldmodel.nodes[0], p, end); if (r == -1) { Math3D.VectorCopy (Globals.vec3_origin, color); } else { Math3D.VectorCopy (pointcolor, color); } // // add dynamic lights // dlight_t dl; float add; for (int lnum=0 ; lnum<r_newrefdef.num_dlights ; lnum++) { dl = r_newrefdef.dlights[lnum]; Math3D.VectorSubtract (currententity.origin, dl.origin, end); add = dl.intensity - Math3D.VectorLength(end); add *= (1.0f/256); if (add > 0) { Math3D.VectorMA (color, add, dl.color, color); } } Math3D.VectorScale (color, gl_modulate.value, color); } // =================================================================== float[] s_blocklights = new float[34 * 34 * 3]; // TODO sync with jogl renderer. hoz private final float[] impact = {0, 0, 0}; /** * R_AddDynamicLights */ void R_AddDynamicLights(msurface_t surf) { int sd, td; float fdist, frad, fminlight; int s, t; dlight_t dl; float[] pfBL; float fsacc, ftacc; int smax = (surf.extents[0]>>4)+1; int tmax = (surf.extents[1]>>4)+1; mtexinfo_t tex = surf.texinfo; float local0, local1; for (int lnum=0 ; lnum<r_newrefdef.num_dlights ; lnum++) { if ( (surf.dlightbits & (1<<lnum)) == 0 ) continue; // not lit by this light dl = r_newrefdef.dlights[lnum]; frad = dl.intensity; fdist = Math3D.DotProduct (dl.origin, surf.plane.normal) - surf.plane.dist; frad -= Math.abs(fdist); // rad is now the highest intensity on the plane fminlight = DLIGHT_CUTOFF; // FIXME: make configurable? if (frad < fminlight) continue; fminlight = frad - fminlight; for (int i=0 ; i<3 ; i++) { impact[i] = dl.origin[i] - surf.plane.normal[i]*fdist; } local0 = Math3D.DotProduct (impact, tex.vecs[0]) + tex.vecs[0][3] - surf.texturemins[0]; local1 = Math3D.DotProduct (impact, tex.vecs[1]) + tex.vecs[1][3] - surf.texturemins[1]; pfBL = s_blocklights; int pfBLindex = 0; for (t = 0, ftacc = 0 ; t<tmax ; t++, ftacc += 16) { td = (int)(local1 - ftacc); if ( td < 0 ) td = -td; for (s=0, fsacc = 0 ; s<smax ; s++, fsacc += 16, pfBLindex += 3) { sd = (int)( local0 - fsacc ); if ( sd < 0 ) sd = -sd; if (sd > td) fdist = sd + (td>>1); else fdist = td + (sd>>1); if ( fdist < fminlight ) { pfBL[pfBLindex + 0] += ( frad - fdist ) * dl.color[0]; pfBL[pfBLindex + 1] += ( frad - fdist ) * dl.color[1]; pfBL[pfBLindex + 2] += ( frad - fdist ) * dl.color[2]; } } } } } /** * R_SetCacheState */ void R_SetCacheState( msurface_t surf ) { for (int maps = 0 ; maps < Defines.MAXLIGHTMAPS && surf.styles[maps] != (byte)255 ; maps++) { surf.cached_light[maps] = r_newrefdef.lightstyles[surf.styles[maps] & 0xFF].white; } } private Throwable gotoStore = new Throwable(); // TODO sync with jogl renderer. hoz /** * R_BuildLightMap * * Combine and scale multiple lightmaps into the floating format in blocklights */ void R_BuildLightMap(msurface_t surf, IntBuffer dest, int stride) { int r, g, b, a, max; int i, j; int nummaps; float[] bl; //lightstyle_t style; if ((surf.texinfo.flags & (Defines.SURF_SKY | Defines.SURF_TRANS33 | Defines.SURF_TRANS66 | Defines.SURF_WARP)) != 0) Com.Error(Defines.ERR_DROP, "R_BuildLightMap called for non-lit surface"); int smax = (surf.extents[0] >> 4) + 1; int tmax = (surf.extents[1] >> 4) + 1; int size = smax * tmax; if (size > ((s_blocklights.length * Defines.SIZE_OF_FLOAT) >> 4)) Com.Error(Defines.ERR_DROP, "Bad s_blocklights size"); try { // set to full bright if no light data if (surf.samples == null) { int maps; for (i = 0; i < size * 3; i++) s_blocklights[i] = 255; // TODO useless? hoz // for (maps = 0 ; maps < Defines.MAXLIGHTMAPS && // surf.styles[maps] != (byte)255; maps++) // { // style = r_newrefdef.lightstyles[surf.styles[maps] & 0xFF]; // } // goto store; throw gotoStore; } // count the # of maps for (nummaps = 0; nummaps < Defines.MAXLIGHTMAPS && surf.styles[nummaps] != (byte) 255; nummaps++) ; ByteBuffer lightmap = surf.samples; int lightmapIndex = 0; // add all the lightmaps float scale0; float scale1; float scale2; if (nummaps == 1) { int maps; for (maps = 0; maps < Defines.MAXLIGHTMAPS && surf.styles[maps] != (byte) 255; maps++) { bl = s_blocklights; int blp = 0; // for (i = 0; i < 3; i++) // scale[i] = gl_modulate.value // * r_newrefdef.lightstyles[surf.styles[maps] & 0xFF].rgb[i]; scale0 = gl_modulate.value * r_newrefdef.lightstyles[surf.styles[maps] & 0xFF].rgb[0]; scale1 = gl_modulate.value * r_newrefdef.lightstyles[surf.styles[maps] & 0xFF].rgb[1]; scale2 = gl_modulate.value * r_newrefdef.lightstyles[surf.styles[maps] & 0xFF].rgb[2]; if (scale0 == 1.0F && scale1 == 1.0F && scale2 == 1.0F) { for (i = 0; i < size; i++) { bl[blp++] = lightmap.get(lightmapIndex++) & 0xFF; bl[blp++] = lightmap.get(lightmapIndex++) & 0xFF; bl[blp++] = lightmap.get(lightmapIndex++) & 0xFF; } } else { for (i = 0; i < size; i++) { bl[blp++] = (lightmap.get(lightmapIndex++) & 0xFF) * scale0; bl[blp++] = (lightmap.get(lightmapIndex++) & 0xFF) * scale1; bl[blp++] = (lightmap.get(lightmapIndex++) & 0xFF) * scale2; } } //lightmap += size*3; // skip to next lightmap } } else { int maps; // memset( s_blocklights, 0, sizeof( s_blocklights[0] ) * size * // 3 ); Arrays.fill(s_blocklights, 0, size * 3, 0.0f); for (maps = 0; maps < Defines.MAXLIGHTMAPS && surf.styles[maps] != (byte) 255; maps++) { bl = s_blocklights; int blp = 0; // for (i = 0; i < 3; i++) // scale[i] = gl_modulate.value // * r_newrefdef.lightstyles[surf.styles[maps] & 0xFF].rgb[i]; scale0 = gl_modulate.value * r_newrefdef.lightstyles[surf.styles[maps] & 0xFF].rgb[0]; scale1 = gl_modulate.value * r_newrefdef.lightstyles[surf.styles[maps] & 0xFF].rgb[1]; scale2 = gl_modulate.value * r_newrefdef.lightstyles[surf.styles[maps] & 0xFF].rgb[2]; if (scale0 == 1.0F && scale1 == 1.0F && scale2 == 1.0F) { for (i = 0; i < size; i++) { bl[blp++] += lightmap.get(lightmapIndex++) & 0xFF; bl[blp++] += lightmap.get(lightmapIndex++) & 0xFF; bl[blp++] += lightmap.get(lightmapIndex++) & 0xFF; } } else { for (i = 0; i < size; i++) { bl[blp++] += (lightmap.get(lightmapIndex++) & 0xFF) * scale0; bl[blp++] += (lightmap.get(lightmapIndex++) & 0xFF) * scale1; bl[blp++] += (lightmap.get(lightmapIndex++) & 0xFF) * scale2; } } //lightmap += size*3; // skip to next lightmap } } // add all the dynamic lights if (surf.dlightframe == r_framecount) R_AddDynamicLights(surf); // label store: } catch (Throwable store) { } // put into texture format stride -= smax; bl = s_blocklights; int blp = 0; int monolightmap = gl_monolightmap.string.charAt(0); int destp = 0; if (monolightmap == '0') { for (i = 0; i < tmax; i++, destp += stride) { for (j = 0; j < smax; j++) { r = (int) bl[blp++]; g = (int) bl[blp++]; b = (int) bl[blp++]; // catch negative lights if (r < 0) r = 0; if (g < 0) g = 0; if (b < 0) b = 0; /* * * determine the brightest of the three color components */ if (r > g) max = r; else max = g; if (b > max) max = b; /* * * alpha is ONLY used for the mono lightmap case. For this * reason * we set it to the brightest of the color * components so that * things don't get too dim. */ a = max; /* * * rescale all the color components if the intensity of * the greatest * channel exceeds 1.0 */ if (max > 255) { float t = 255.0F / max; r = (int) (r * t); g = (int) (g * t); b = (int) (b * t); a = (int) (a * t); } //r &= 0xFF; g &= 0xFF; b &= 0xFF; a &= 0xFF; dest.put(destp++, (a << 24) | (b << 16) | (g << 8) | r); } } } else { for (i = 0; i < tmax; i++, destp += stride) { for (j = 0; j < smax; j++) { r = (int) bl[blp++]; g = (int) bl[blp++]; b = (int) bl[blp++]; // catch negative lights if (r < 0) r = 0; if (g < 0) g = 0; if (b < 0) b = 0; /* * * determine the brightest of the three color components */ if (r > g) max = r; else max = g; if (b > max) max = b; /* * * alpha is ONLY used for the mono lightmap case. For this * reason * we set it to the brightest of the color * components so that * things don't get too dim. */ a = max; /* * * rescale all the color components if the intensity of * the greatest * channel exceeds 1.0 */ if (max > 255) { float t = 255.0F / max; r = (int) (r * t); g = (int) (g * t); b = (int) (b * t); a = (int) (a * t); } /* * * So if we are doing alpha lightmaps we need to set the * R, G, and B * components to 0 and we need to set alpha to * 1-alpha. */ switch (monolightmap) { case 'L': case 'I': r = a; g = b = 0; break; case 'C': // try faking colored lighting a = 255 - ((r + g + b) / 3); float af = a / 255.0f; r *= af; g *= af; b *= af; break; case 'A': default: r = g = b = 0; a = 255 - a; break; } //r &= 0xFF; g &= 0xFF; b &= 0xFF; a &= 0xFF; dest.put(destp++, (a << 24) | (b << 16) | (g << 8) | r); } } } } } --- NEW FILE: Mesh.java --- /* * Mesh.java * Copyright (C) 2003 * * $Id: Mesh.java,v 1.2 2006/11/21 00:50:46 cawe Exp $ */ /* 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.fast; import jake2.Defines; import jake2.client.VID; import jake2.client.entity_t; import jake2.qcommon.qfiles; import jake2.render.image_t; import jake2.util.Lib; import jake2.util.Math3D; import java.nio.FloatBuffer; import java.nio.IntBuffer; /** * Mesh * * @author cwei */ public abstract class Mesh extends Light { // g_mesh.c: triangle model functions /* ============================================================= ALIAS MODELS ============================================================= */ static final int NUMVERTEXNORMALS = 162; float[][] r_avertexnormals = Anorms.VERTEXNORMALS; float[] shadevector = {0, 0, 0}; float[] shadelight = {0, 0, 0}; // precalculated dot products for quantized angles static final int SHADEDOT_QUANT = 16; float[][] r_avertexnormal_dots = Anorms.VERTEXNORMAL_DOTS; float[] shadedots = r_avertexnormal_dots[0]; /** * GL_LerpVerts * @param nverts * @param ov * @param verts * @param move * @param frontv * @param backv */ void GL_LerpVerts(int nverts, int[] ov, int[] v, float[] move, float[] frontv, float[] backv ) { FloatBuffer lerp = vertexArrayBuf; lerp.limit((nverts << 2) - nverts); // nverts * 3 int ovv, vv; //PMM -- added RF_SHELL_DOUBLE, RF_SHELL_HALF_DAM if ( (currententity.flags & ( Defines.RF_SHELL_RED | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0 ) { float[] normal; int j = 0; for (int i=0 ; i < nverts; i++/* , v++, ov++, lerp+=4 */) { vv = v[i]; normal = r_avertexnormals[(vv >>> 24 ) & 0xFF]; ovv = ov[i]; lerp.put(j, move[0] + (ovv & 0xFF)* backv[0] + (vv & 0xFF) * frontv[0] + normal[0] * Defines.POWERSUIT_SCALE); lerp.put(j + 1, move[1] + ((ovv >>> 8) & 0xFF) * backv[1] + ((vv >>> 8) & 0xFF) * frontv[1] + normal[1] * Defines.POWERSUIT_SCALE); lerp.put(j + 2, move[2] + ((ovv >>> 16) & 0xFF) * backv[2] + ((vv >>> 16) & 0xFF) * frontv[2] + normal[2] * Defines.POWERSUIT_SCALE); j += 3; } } else { int j = 0; for (int i=0 ; i < nverts; i++ /* , v++, ov++, lerp+=4 */) { ovv = ov[i]; vv = v[i]; lerp.put(j, move[0] + (ovv & 0xFF)* backv[0] + (vv & 0xFF)*frontv[0]); lerp.put(j + 1, move[1] + ((ovv >>> 8) & 0xFF)* backv[1] + ((vv >>> 8) & 0xFF)*frontv[1]); lerp.put(j + 2, move[2] + ((ovv >>> 16) & 0xFF)* backv[2] + ((vv >>> 16) & 0xFF)*frontv[2]); j += 3; } } } FloatBuffer colorArrayBuf = Lib.newFloatBuffer(qfiles.MAX_VERTS * 4); FloatBuffer vertexArrayBuf = Lib.newFloatBuffer(qfiles.MAX_VERTS * 3); FloatBuffer textureArrayBuf = Lib.newFloatBuffer(qfiles.MAX_VERTS * 2); boolean isFilled = false; float[] tmpVec = {0, 0, 0}; float[][] vectors = { {0, 0, 0}, {0, 0, 0}, {0, 0, 0} // 3 mal vec3_t }; // stack variable private final float[] move = {0, 0, 0}; // vec3_t private final float[] frontv = {0, 0, 0}; // vec3_t private final float[] backv = {0, 0, 0}; // vec3_t /** * GL_DrawAliasFrameLerp * * interpolates between two frames and origins * FIXME: batch lerp all vertexes */ void GL_DrawAliasFrameLerp(qfiles.dmdl_t paliashdr, float backlerp) { qfiles.daliasframe_t frame = paliashdr.aliasFrames[currententity.frame]; int[] verts = frame.verts; qfiles.daliasframe_t oldframe = paliashdr.aliasFrames[currententity.oldframe]; int[] ov = oldframe.verts; float alpha; if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0) alpha = currententity.alpha; else alpha = 1.0f; // PMM - added double shell if ( (currententity.flags & ( Defines.RF_SHELL_RED | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0) gl.glDisable( GL_TEXTURE_2D ); float frontlerp = 1.0f - backlerp; // move should be the delta back to the previous frame * backlerp Math3D.VectorSubtract (currententity.oldorigin, currententity.origin, frontv); Math3D.AngleVectors (currententity.angles, vectors[0], vectors[1], vectors[2]); move[0] = Math3D.DotProduct (frontv, vectors[0]); // forward move[1] = -Math3D.DotProduct (frontv, vectors[1]); // left move[2] = Math3D.DotProduct (frontv, vectors[2]); // up Math3D.VectorAdd (move, oldframe.translate, move); for (int i=0 ; i<3 ; i++) { move[i] = backlerp*move[i] + frontlerp*frame.translate[i]; frontv[i] = frontlerp*frame.scale[i]; backv[i] = backlerp*oldframe.scale[i]; } // ab hier wird optimiert GL_LerpVerts( paliashdr.num_xyz, ov, verts, move, frontv, backv ); //gl.gl.glEnableClientState( GL_VERTEX_ARRAY ); gl.glVertexPointer( 3, 0, vertexArrayBuf ); // PMM - added double damage shell if ( (currententity.flags & ( Defines.RF_SHELL_RED | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0) { gl.glColor4f( shadelight[0], shadelight[1], shadelight[2], alpha ); } else { gl.glEnableClientState( GL_COLOR_ARRAY ); gl.glColorPointer( 4, 0, colorArrayBuf ); // // pre light everything // FloatBuffer color = colorArrayBuf; float l; int size = paliashdr.num_xyz; int j = 0; for (int i = 0; i < size; i++ ) { l = shadedots[(verts[i] >>> 24) & 0xFF]; color.put(j, l * shadelight[0]); color.put(j + 1, l * shadelight[1]); color.put(j + 2, l * shadelight[2]); color.put(j + 3, alpha); j += 4; } } gl.glClientActiveTextureARB(TEXTURE0); gl.glTexCoordPointer( 2, 0, textureArrayBuf); //gl.gl.glEnableClientState( GL_TEXTURE_COORD_ARRAY); int pos = 0; int[] counts = paliashdr.counts; IntBuffer srcIndexBuf = null; FloatBuffer dstTextureCoords = textureArrayBuf; FloatBuffer srcTextureCoords = paliashdr.textureCoordBuf; int dstIndex = 0; int srcIndex = 0; int count; int mode; int size = counts.length; for (int j = 0; j < size; j++) { // get the vertex count and primitive type count = counts[j]; if (count == 0) break; // done srcIndexBuf = paliashdr.indexElements[j]; mode = GL_TRIANGLE_STRIP; if (count < 0) { mode = GL_TRIANGLE_FAN; count = -count; } srcIndex = pos << 1; srcIndex--; for (int k = 0; k < count; k++) { dstIndex = srcIndexBuf.get(k) << 1; dstTextureCoords.put(dstIndex, srcTextureCoords.get(++srcIndex)); dstTextureCoords.put(++dstIndex, srcTextureCoords.get(++srcIndex)); } gl.glDrawElements(mode, srcIndexBuf); pos += count; } // PMM - added double damage shell if ( (currententity.flags & ( Defines.RF_SHELL_RED | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0 ) gl.glEnable( GL_TEXTURE_2D ); gl.glDisableClientState( GL_COLOR_ARRAY ); } private final float[] point = {0, 0, 0}; /** * GL_DrawAliasShadow */ void GL_DrawAliasShadow(qfiles.dmdl_t paliashdr, int posenum) { float lheight = currententity.origin[2] - lightspot[2]; qfiles.daliasframe_t frame = paliashdr.aliasFrames[currententity.frame]; int[] order = paliashdr.glCmds; float height = -lheight + 1.0f; int orderIndex = 0; int index = 0; // TODO shadow drawing with vertex arrays int count; while (true) { // get the vertex count and primitive type count = order[orderIndex++]; if (count == 0) break; // done if (count < 0) { count = -count; gl.glBegin (GL_TRIANGLE_FAN); } else gl.glBegin (GL_TRIANGLE_STRIP); do { index = order[orderIndex + 2] * 3; point[0] = vertexArrayBuf.get(index); point[1] = vertexArrayBuf.get(index + 1); point[2] = vertexArrayBuf.get(index + 2); point[0] -= shadevector[0]*(point[2]+lheight); point[1] -= shadevector[1]*(point[2]+lheight); point[2] = height; gl.glVertex3f(point[0], point[1], point[2]); orderIndex += 3; } while (--count != 0); gl.glEnd (); } } // TODO sync with jogl renderer. hoz // stack variable private final float[] mins = { 0, 0, 0 }; private final float[] maxs = { 0, 0, 0 }; /** * R_CullAliasModel */ boolean R_CullAliasModel(entity_t e) { qfiles.dmdl_t paliashdr = (qfiles.dmdl_t) currentmodel.extradata; if ((e.frame >= paliashdr.num_frames) || (e.frame < 0)) { VID.Printf(Defines.PRINT_ALL, "R_CullAliasModel " + currentmodel.name + ": no such frame " + e.frame + '\n'); e.frame = 0; } if ((e.oldframe >= paliashdr.num_frames) || (e.oldframe < 0)) { VID.Printf(Defines.PRINT_ALL, "R_CullAliasModel " + currentmodel.name + ": no such oldframe " + e.oldframe + '\n'); e.oldframe = 0; } qfiles.daliasframe_t pframe = paliashdr.aliasFrames[e.frame]; qfiles.daliasframe_t poldframe = paliashdr.aliasFrames[e.oldframe]; /* ** compute axially aligned mins and maxs */ if (pframe == poldframe) { for (int i = 0; i < 3; i++) { mins[i] = pframe.translate[i]; maxs[i] = mins[i] + pframe.scale[i] * 255; } } else { float thismaxs, oldmaxs; for (int i = 0; i < 3; i++) { thismaxs = pframe.translate[i] + pframe.scale[i] * 255; oldmaxs = poldframe.translate[i] + poldframe.scale[i] * 255; if (pframe.translate[i] < poldframe.translate[i]) mins[i] = pframe.translate[i]; else mins[i] = poldframe.translate[i]; if (thismaxs > oldmaxs) maxs[i] = thismaxs; else maxs[i] = oldmaxs; } } /* ** compute a full bounding box */ float[] tmp; for (int i = 0; i < 8; i++) { tmp = bbox[i]; if ((i & 1) != 0) tmp[0] = mins[0]; else tmp[0] = maxs[0]; if ((i & 2) != 0) tmp[1] = mins[1]; else tmp[1] = maxs[1]; if ((i & 4) != 0) tmp[2] = mins[2]; else tmp[2] = maxs[2]; } /* ** rotate the bounding box */ tmp = mins; Math3D.VectorCopy(e.angles, tmp); tmp[YAW] = -tmp[YAW]; Math3D.AngleVectors(tmp, vectors[0], vectors[1], vectors[2]); for (int i = 0; i < 8; i++) { Math3D.VectorCopy(bbox[i], tmp); bbox[i][0] = Math3D.DotProduct(vectors[0], tmp); bbox[i][1] = -Math3D.DotProduct(vectors[1], tmp); bbox[i][2] = Math3D.DotProduct(vectors[2], tmp); Math3D.VectorAdd(e.origin, bbox[i], bbox[i]); } int f, mask; int aggregatemask = ~0; // 0xFFFFFFFF for (int p = 0; p < 8; p++) { mask = 0; for (f = 0; f < 4; f++) { float dp = Math3D.DotProduct(frustum[f].normal, bbox[p]); if ((dp - frustum[f].dist) < 0) { mask |= (1 << f); } } aggregatemask &= mask; } if (aggregatemask != 0) { return true; } return false; } // bounding box float[][] bbox = { {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0} }; // TODO sync with jogl renderer. hoz /** * R_DrawAliasModel */ void R_DrawAliasModel(entity_t e) { if ( ( e.flags & Defines.RF_WEAPONMODEL ) == 0) { if ( R_CullAliasModel(e) ) return; } if ( (e.flags & Defines.RF_WEAPONMODEL) != 0 ) { if ( r_lefthand.value == 2.0f ) return; } qfiles.dmdl_t paliashdr = (qfiles.dmdl_t)currentmodel.extradata; // // get lighting information // // PMM - rewrote, reordered to handle new shells & mixing // PMM - 3.20 code .. replaced with original way of doing it to keep mod authors happy // int i; if ( (currententity.flags & ( Defines.RF_SHELL_HALF_DAM | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_RED | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE )) != 0 ) { Math3D.VectorClear(shadelight); if ((currententity.flags & Defines.RF_SHELL_HALF_DAM) != 0) { shadelight[0] = 0.56f; shadelight[1] = 0.59f; shadelight[2] = 0.45f; } if ( (currententity.flags & Defines.RF_SHELL_DOUBLE) != 0 ) { shadelight[0] = 0.9f; shadelight[1] = 0.7f; } if ( (currententity.flags & Defines.RF_SHELL_RED) != 0 ) shadelight[0] = 1.0f; if ( (currententity.flags & Defines.RF_SHELL_GREEN) != 0 ) shadelight[1] = 1.0f; if ( (currententity.flags & Defines.RF_SHELL_BLUE) != 0 ) shadelight[2] = 1.0f; } else if ( (currententity.flags & Defines.RF_FULLBRIGHT) != 0 ) { for (i=0 ; i<3 ; i++) shadelight[i] = 1.0f; } else { R_LightPoint (currententity.origin, shadelight); // player lighting hack for communication back to server // big hack! if ( (currententity.flags & Defines.RF_WEAPONMODEL) != 0 ) { // pick the greatest component, which should be the same // as the mono value returned by software if (shadelight[0] > shadelight[1]) { if (shadelight[0] > shadelight[2]) r_lightlevel.value = 150*shadelight[0]; else r_lightlevel.value = 150*shadelight[2]; } else { if (shadelight[1] > shadelight[2]) r_lightlevel.value = 150*shadelight[1]; else r_lightlevel.value = 150*shadelight[2]; } } if ( gl_monolightmap.string.charAt(0) != '0' ) { float s = shadelight[0]; if ( s < shadelight[1] ) s = shadelight[1]; if ( s < shadelight[2] ) s = shadelight[2]; shadelight[0] = s; shadelight[1] = s; shadelight[2] = s; } } if ( (currententity.flags & Defines.RF_MINLIGHT) != 0 ) { for (i=0 ; i<3 ; i++) if (shadelight[i] > 0.1f) break; if (i == 3) { shadelight[0] = 0.1f; shadelight[1] = 0.1f; shadelight[2] = 0.1f; } } if ( (currententity.flags & Defines.RF_GLOW) != 0 ) { // bonus items will pulse with time float scale; float min; scale = (float)(0.1f * Math.sin(r_newrefdef.time*7)); for (i=0 ; i<3 ; i++) { min = shadelight[i] * 0.8f; shadelight[i] += scale; if (shadelight[i] < min) shadelight[i] = min; } } // ================= // PGM ir goggles color override if ( (r_newrefdef.rdflags & Defines.RDF_IRGOGGLES) != 0 && (currententity.flags & Defines.RF_IR_VISIBLE) != 0) { shadelight[0] = 1.0f; shadelight[1] = 0.0f; shadelight[2] = 0.0f; } // PGM // ================= shadedots = r_avertexnormal_dots[((int)(currententity.angles[1] * (SHADEDOT_QUANT / 360.0))) & (SHADEDOT_QUANT - 1)]; float an = (float)(currententity.angles[1]/180*Math.PI); shadevector[0] = (float)Math.cos(-an); shadevector[1] = (float)Math.sin(-an); shadevector[2] = 1; Math3D.VectorNormalize(shadevector); // // locate the proper data // c_alias_polys += paliashdr.num_tris; // // draw all the triangles // if ( (currententity.flags & Defines.RF_DEPTHHACK) != 0) // hack the depth range to prevent view model from poking into walls gl.glDepthRange(gldepthmin, gldepthmin + 0.3*(gldepthmax-gldepthmin)); if ( (currententity.flags & Defines.RF_WEAPONMODEL) != 0 && (r_lefthand.value == 1.0f) ) { gl.glMatrixMode( GL_PROJECTION ); gl.glPushMatrix(); gl.glLoadIdentity(); gl.glScalef( -1, 1, 1 ); MYgluPerspective( r_newrefdef.fov_y, ( float ) r_newrefdef.width / r_newrefdef.height, 4, 4096); gl.glMatrixMode( GL_MODELVIEW ); gl.glCullFace( GL_BACK ); } gl.glPushMatrix (); e.angles[PITCH] = -e.angles[PITCH]; // sigh. R_RotateForEntity (e); e.angles[PITCH] = -e.angles[PITCH]; // sigh. image_t skin; // select skin if (currententity.skin != null) skin = currententity.skin; // custom player skin else { if (currententity.skinnum >= qfiles.MAX_MD2SKINS) skin = currentmodel.skins[0]; else { skin = currentmodel.skins[currententity.skinnum]; if (skin == null) skin = currentmodel.skins[0]; } } if (skin == null) skin = r_notexture; // fallback... GL_Bind(skin.texnum); // draw it gl.glShadeModel (GL_SMOOTH); GL_TexEnv( GL_MODULATE ); if ( (currententity.flags & Defines.RF_TRANSLUCENT) != 0 ) { gl.glEnable (GL_BLEND); } if ( (currententity.frame >= paliashdr.num_frames) || (currententity.frame < 0) ) { VID.Printf (Defines.PRINT_ALL, "R_DrawAliasModel " + currentmodel.name +": no such frame " + currententity.frame + '\n'); currententity.frame = 0; currententity.oldframe = 0; } if ( (currententity.oldframe >= paliashdr.num_frames) || (currententity.oldframe < 0)) { VID.Printf (Defines.PRINT_ALL, "R_DrawAliasModel " + currentmodel.name +": no such oldframe " + currententity.oldframe + '\n'); currententity.frame = 0; currententity.oldframe = 0; } if ( r_lerpmodels.value == 0.0f) currententity.backlerp = 0; GL_DrawAliasFrameLerp(paliashdr, currententity.backlerp); GL_TexEnv( GL_REPLACE ); gl.glShadeModel (GL_FLAT); gl.glPopMatrix (); if ( ( currententity.flags & Defines.RF_WEAPONMODEL ) != 0 && ( r_lefthand.value == 1.0F ) ) { gl.glMatrixMode( GL_PROJECTION ); gl.glPopMatrix(); gl.glMatrixMode( GL_MODELVIEW ); gl.glCullFace( GL_FRONT ); } if ( (currententity.flags & Defines.RF_TRANSLUCENT) != 0 ) { gl.glDisable (GL_BLEND); } if ( (currententity.flags & Defines.RF_DEPTHHACK) != 0) gl.glDepthRange (gldepthmin, gldepthmax); if ( gl_shadows.value != 0.0f && (currententity.flags & (Defines.RF_TRANSLUCENT | Defines.RF_WEAPONMODEL)) == 0) { gl.glPushMatrix (); R_RotateForEntity (e); gl.glDisable (GL_TEXTURE_2D); gl.glEnable (GL_BLEND); gl.glColor4f (0,0,0,0.5f); GL_DrawAliasShadow (paliashdr, currententity.frame ); gl.glEnable (GL_TEXTURE_2D); gl.glDisable (GL_BLEND); gl.glPopMatrix (); } gl.glColor4f (1,1,1,1); } } --- NEW FILE: Model.java --- /* * Model.java * Copyright (C) 2003 * * $Id: Model.java,v 1.2 2006/11/21 00:50:46 cawe Exp $ */ /* 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. [...1319 lines suppressed...] count = ((Integer)tmp.get(i)).intValue(); model.counts[i] = count; count = (count < 0) ? -count : count; model.vertexIndexBuf.position(pos); model.indexElements[i] = model.vertexIndexBuf.slice(); model.indexElements[i].limit(count); pos += count; } } static void resetModelArrays() { globalModelTextureCoordBuf.rewind(); globalModelVertexIndexBuf.rewind(); } static void modelMemoryUsage() { System.out.println("AliasModels: globalVertexBuffer size " + globalModelVertexIndexBuf.position()); } } --- NEW FILE: Main.java --- /* * Main.java * Copyright (C) 2003 * * $Id: Main.java,v 1.2 2006/11/21 00:50:46 cawe Exp $ */ /* 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. [...1487 lines suppressed...] float[] v; for (int i = 0; i < NUM_BEAM_SEGS; i++) { v = start_points[i]; gl.glVertex3f(v[0], v[1], v[2]); v = end_points[i]; gl.glVertex3f(v[0], v[1], v[2]); v = start_points[(i + 1) % NUM_BEAM_SEGS]; gl.glVertex3f(v[0], v[1], v[2]); v = end_points[(i + 1) % NUM_BEAM_SEGS]; gl.glVertex3f(v[0], v[1], v[2]); } gl.glEnd(); gl.glEnable(GL_TEXTURE_2D); gl.glDisable(GL_BLEND); gl.glDepthMask(true); } } --- NEW FILE: Polygon.java --- /* * Polygon.java * Copyright (C) 2003 * * $Id: Polygon.java,v 1.2 2006/11/21 00:50:46 cawe Exp $ */ /* 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.fast; import jake2.render.glpoly_t; import jake2.util.Lib; import java.nio.FloatBuffer; /** * Polygon * * @author cwei */ public final class Polygon extends glpoly_t { private final static int MAX_POLYS = 20000; private final static int MAX_BUFFER_VERTICES = 120000; // backup for s1 scrolling private static float[] s1_old = new float[MAX_VERTICES]; private static FloatBuffer buffer = Lib.newFloatBuffer(MAX_BUFFER_VERTICES * STRIDE); private static int bufferIndex = 0; private static int polyCount = 0; private static Polygon[] polyCache = new Polygon[MAX_POLYS]; static { for (int i = 0; i < polyCache.length; i++) { polyCache[i] = new Polygon(); } } static glpoly_t create(int numverts) { Polygon poly = polyCache[polyCount++]; poly.clear(); poly.numverts = numverts; poly.pos = bufferIndex; bufferIndex += numverts; return poly; } static void reset() { polyCount = 0; bufferIndex = 0; } static FloatBuffer getInterleavedBuffer() { return (FloatBuffer) buffer.rewind(); } private Polygon() { } private final void clear() { next = null; chain = null; numverts = 0; flags = 0; } // the interleaved buffer has the format: // textureCoord0 (index 0, 1) // vertex (index 2, 3, 4) // textureCoord1 (index 5, 6) public final float s1(int index) { return buffer.get((index + pos) * STRIDE); } public final void s1(int index, float value) { buffer.put((index + pos) * STRIDE, value); } public final float t1(int index) { return buffer.get((index + pos) * STRIDE + 1); } public final void t1(int index, float value) { buffer.put((index + pos) * STRIDE + 1, value); } public final float x(int index) { return buffer.get((index + pos) * STRIDE + 2); } public final void x(int index, float value) { buffer.put((index + pos) * STRIDE + 2, value); } public final float y(int index) { return buffer.get((index + pos) * STRIDE + 3); } public final void y(int index, float value) { buffer.put((index + pos) * STRIDE + 3, value); } public final float z(int index) { return buffer.get((index + pos) * STRIDE + 4); } public final void z(int index, float value) { buffer.put((index + pos) * STRIDE + 4, value); } public final float s2(int index) { return buffer.get((index + pos) * STRIDE + 5); } public final void s2(int index, float value) { buffer.put((index + pos) * STRIDE + 5, value); } public final float t2(int index) { return buffer.get((index + pos) * STRIDE + 6); } public final void t2(int index, float value) { buffer.put((index + pos) * STRIDE + 6, value); } public final void beginScrolling(float scroll) { int index = pos * STRIDE; for (int i = 0; i < numverts; i++, index += STRIDE) { scroll += s1_old[i] = buffer.get(index); buffer.put(index, scroll); } } public final void endScrolling() { int index = pos * STRIDE; for (int i = 0; i < numverts; i++, index += STRIDE) { buffer.put(index, s1_old[i]); } } } --- NEW FILE: Warp.java --- /* * Warp.java * Copyright (C) 2003 * * $Id: Warp.java,v 1.2 2006/11/21 00:50:46 cawe Exp $ */ /* 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.fast; import jake2.Defines; import jake2.Globals; import jake2.qcommon.Com; import jake2.render.*; import jake2.util.Math3D; import jake2.util.Vec3Cache; /** * Warp * * @author cwei */ public abstract class Warp extends Model { // warpsin.h public static final float[] SIN = { 0f, 0.19633f, 0.392541f, 0.588517f, 0.784137f, 0.979285f, 1.17384f, 1.3677f, 1.56072f, 1.75281f, 1.94384f, 2.1337f, 2.32228f, 2.50945f, 2.69512f, 2.87916f, 3.06147f, 3.24193f, 3.42044f, 3.59689f, 3.77117f, 3.94319f, 4.11282f, 4.27998f, 4.44456f, 4.60647f, 4.76559f, 4.92185f, 5.07515f, 5.22538f, 5.37247f, 5.51632f, 5.65685f, 5.79398f, 5.92761f, 6.05767f, 6.18408f, 6.30677f, 6.42566f, 6.54068f, 6.65176f, 6.75883f, 6.86183f, 6.9607f, 7.05537f, 7.14579f, 7.23191f, 7.31368f, 7.39104f, 7.46394f, 7.53235f, 7.59623f, 7.65552f, 7.71021f, 7.76025f, 7.80562f, 7.84628f, 7.88222f, 7.91341f, 7.93984f, 7.96148f, 7.97832f, 7.99036f, 7.99759f, 8f, 7.99759f, 7.99036f, 7.97832f, 7.96148f, 7.93984f, 7.91341f, 7.88222f, 7.84628f, 7.80562f, 7.76025f, 7.71021f, 7.65552f, 7.59623f, 7.53235f, 7.46394f, 7.39104f, 7.31368f, 7.23191f, 7.14579f, 7.05537f, 6.9607f, 6.86183f, 6.75883f, 6.65176f, 6.54068f, 6.42566f, 6.30677f, 6.18408f, 6.05767f, 5.92761f, 5.79398f, 5.65685f, 5.51632f, 5.37247f, 5.22538f, 5.07515f, 4.92185f, 4.76559f, 4.60647f, 4.44456f, 4.27998f, 4.11282f, 3.94319f, 3.77117f, 3.59689f, 3.42044f, 3.24193f, 3.06147f, 2.87916f, 2.69512f, 2.50945f, 2.32228f, 2.1337f, 1.94384f, 1.75281f, 1.56072f, 1.3677f, 1.17384f, 0.979285f, 0.784137f, 0.588517f, 0.392541f, 0.19633f, 9.79717e-16f, -0.19633f, -0.392541f, -0.588517f, -0.784137f, -0.979285f, -1.17384f, -1.3677f, -1.56072f, -1.75281f, -1.94384f, -2.1337f, -2.32228f, -2.50945f, -2.69512f, -2.87916f, -3.06147f, -3.24193f, -3.42044f, -3.59689f, -3.77117f, -3.94319f, -4.11282f, -4.27998f, -4.44456f, -4.60647f, -4.76559f, -4.92185f, -5.07515f, -5.22538f, -5.37247f, -5.51632f, -5.65685f, -5.79398f, -5.92761f, -6.05767f, -6.18408f, -6.30677f, -6.42566f, -6.54068f, -6.65176f, -6.75883f, -6.86183f, -6.9607f, -7.05537f, -7.14579f, -7.23191f, -7.31368f, -7.39104f, -7.46394f, -7.53235f, -7.59623f, -7.65552f, -7.71021f, -7.76025f, -7.80562f, -7.84628f, -7.88222f, -7.91341f, -7.93984f, -7.96148f, -7.97832f, -7.99036f, -7.99759f, -8f, -7.99759f, -7.99036f, -7.97832f, -7.96148f, -7.93984f, -7.91341f, -7.88222f, -7.84628f, -7.80562f, -7.76025f, -7.71021f, -7.65552f, -7.59623f, -7.53235f, -7.46394f, -7.39104f, -7.31368f, -7.23191f, -7.14579f, -7.05537f, -6.9607f, -6.86183f, -6.75883f, -6.65176f, -6.54068f, -6.42566f, -6.30677f, -6.18408f, -6.05767f, -5.92761f, -5.79398f, -5.65685f, -5.51632f, -5.37247f, -5.22538f, -5.07515f, -4.92185f, -4.76559f, -4.60647f, -4.44456f, -4.27998f, -4.11282f, -3.94319f, -3.77117f, -3.59689f, -3.42044f, -3.24193f, -3.06147f, -2.87916f, -2.69512f, -2.50945f, -2.32228f, -2.1337f, -1.94384f, -1.75281f, -1.56072f, -1.3677f, -1.17384f, -0.979285f, -0.784137f, -0.588517f, -0.392541f, -0.19633f }; String skyname; float skyrotate; float[] skyaxis = {0, 0, 0}; image_t[] sky_images = new image_t[6]; msurface_t warpface; static final int SUBDIVIDE_SIZE = 64; /** * BoundPoly * @param numverts * @param verts * @param mins * @param maxs */ void BoundPoly(int numverts, float[][] verts, float[] mins, float[] maxs) { mins[0] = mins[1] = mins[2] = 9999; maxs[0] = maxs[1] = maxs[2] = -9999; int j; float[] v; for (int i=0 ; i<numverts ; i++) { v = verts[i]; for (j=0 ; j<3 ; j++) { if (v[j] < mins[j]) mins[j] = v[j]; if (v[j] > maxs[j]) maxs[j] = v[j]; } } } /** * SubdividePolygon * @param numverts * @param verts */ void SubdividePolygon(int numverts, float[][] verts) { int i, j, k; float m; float[][] front = new float[64][3]; float[][] back = new float[64][3]; int f, b; float[] dist = new float[64]; float frac; if (numverts > 60) Com.Error(Defines.ERR_DROP, "numverts = " + numverts); float[] mins = Vec3Cache.get(); float[] maxs = Vec3Cache.get(); BoundPoly(numverts, verts, mins, maxs); float[] v; // x,y und z for (i=0 ; i<3 ; i++) { m = (mins[i] + maxs[i]) * 0.5f; m = SUBDIVIDE_SIZE * (float)Math.floor(m / SUBDIVIDE_SIZE + 0.5f); if (maxs[i] - m < 8) continue; if (m - mins[i] < 8) continue; // cut it for (j=0 ; j<numverts ; j++) { dist[j] = verts[j][i] - m; } // wrap cases dist[j] = dist[0]; Math3D.VectorCopy(verts[0], verts[numverts]); f = b = 0; for (j=0 ; j<numverts ; j++) { v = verts[j]; if (dist[j] >= 0) { Math3D.VectorCopy(v, front[f]); f++; } if (dist[j] <= 0) { Math3D.VectorCopy(v, back[b]); b++; } if (dist[j] == 0 || dist[j+1] == 0) continue; if ( (dist[j] > 0) != (dist[j+1] > 0) ) { // clip point frac = dist[j] / (dist[j] - dist[j+1]); for (k=0 ; k<3 ; k++) front[f][k] = back[b][k] = v[k] + frac*(verts[j+1][k] - v[k]); f++; b++; } } SubdividePolygon(f, front); SubdividePolygon(b, back); Vec3Cache.release(2); // mins, maxs return; } Vec3Cache.release(2); // mins, maxs // add a point in the center to help keep warp valid // wird im Konstruktor erschlagen // poly = Hunk_Alloc (sizeof(glpoly_t) + ((numverts-4)+2) * VERTEXSIZE*sizeof(float)); // init polys glpoly_t poly = Polygon.create(numverts + 2); poly.next = warpface.polys; warpface.polys = poly; float[] total = Vec3Cache.get(); Math3D.VectorClear(total); float total_s = 0; float total_t = 0; float s, t; for (i = 0; i < numverts; i++) { poly.x(i + 1, verts[i][0]); poly.y(i + 1, verts[i][1]); poly.z(i + 1, verts[i][2]); s = Math3D.DotProduct(verts[i], warpface.texinfo.vecs[0]); t = Math3D.DotProduct(verts[i], warpface.texinfo.vecs[1]); total_s += s; total_t += t; Math3D.VectorAdd(total, verts[i], total); poly.s1(i + 1, s); poly.t1(i + 1, t); } float scale = 1.0f / numverts; poly.x(0, total[0] * scale); poly.y(0, total[1] * scale); poly.z(0, total[2] * scale); poly.s1(0, total_s * scale); poly.t1(0, total_t * scale); poly.x(i + 1, poly.x(1)); poly.y(i + 1, poly.y(1)); poly.z(i + 1, poly.z(1)); poly.s1(i + 1, poly.s1(1)); poly.t1(i + 1, poly.t1(1)); poly.s2(i + 1, poly.s2(1)); poly.t2(i + 1, poly.t2(1)); Vec3Cache.release(); // total } private final float[][] tmpVerts = new float[64][3]; /** * GL_SubdivideSurface * Breaks a polygon up along axial 64 unit * boundaries so that turbulent and sky warps * can be done reasonably. */ void GL_SubdivideSurface(msurface_t fa) { float[][] verts = tmpVerts; float[] vec; warpface = fa; // // convert edges back to a normal polygon // int numverts = 0; for (int i = 0; i < fa.numedges; i++) { int lindex = loadmodel.surfedges[fa.firstedge + i]; if (lindex > 0) vec = loadmodel.vertexes[loadmodel.edges[lindex].v[0]].position; else vec = loadmodel.vertexes[loadmodel.edges[-lindex].v[1]].position; Math3D.VectorCopy(vec, verts[numverts]); numverts++; } SubdividePolygon(numverts, verts); } // ========================================================= static final float TURBSCALE = (float)(256.0f / (2 * Math.PI)); /** * EmitWaterPolys * Does a water warp on the pre-fragmented glpoly_t chain */ void EmitWaterPolys(msurface_t fa) { float rdt = r_newrefdef.time; float scroll; if ((fa.texinfo.flags & Defines.SURF_FLOWING) != 0) scroll = -64 * ( (r_newrefdef.time*0.5f) - (int)(r_newrefdef.time*0.5f) ); else scroll = 0; int i; float s, t, os, ot; glpoly_t p, bp; for (bp = fa.polys; bp != null; bp = bp.next) { p = bp; gl.glBegin(GL_TRIANGLE_FAN); for (i = 0; i < p.numverts; i++) { os = p.s1(i); ot = p.t1(i); s = os + Warp.SIN[(int) ((ot * 0.125f + r_newrefdef.time) * TURBSCALE) & 255]; s += scroll; s *= (1.0f / 64); t = ot + Warp.SIN[(int) ((os * 0.125f + rdt) * TURBSCALE) & 255]; t *= (1.0f / 64); gl.glTexCoord2f(s, t); gl.glVertex3f(p.x(i), p.y(i), p.z(i)); } gl.glEnd(); } } // =================================================================== float[][] skyclip = { { 1, 1, 0}, { 1, -1, 0}, { 0, -1, 1}, { 0, 1, 1}, { 1, 0, 1}, {-1, 0, 1} }; int c_sky; // 1 = s, 2 = t, 3 = 2048 int[][] st_to_vec = { {3,-1,2}, {-3,1,2}, {1,3,2}, {-1,-3,2}, {-2,-1,3}, // 0 degrees yaw, look straight up {2,-1,-3} // look straight down }; int[][] vec_to_st = { {-2,3,1}, {2,3,-1}, {1,3,2}, {-1,3,-2}, {-2,-1,3}, {-2,1,-3} }; float[][] skymins = new float[2][6]; float[][] skymaxs = new float[2][6]; float sky_min, sky_max; // stack variable private final float[] v = {0, 0, 0}; private final float[] av = {0, 0, 0}; /** * DrawSkyPolygon * @param nump * @param vecs */ void DrawSkyPolygon(int nump, float[][] vecs) { c_sky++; // decide which face it maps to Math3D.VectorCopy(Globals.vec3_origin, v); int i, axis; for (i=0; i<nump ; i++) { Math3D.VectorAdd(vecs[i], v, v); } av[0] = Math.abs(v[0]); av[1] = Math.abs(v[1]); av[2] = Math.abs(v[2]); if (av[0] > av[1] && av[0] > av[2]) { if (v[0] < 0) axis = 1; else axis = 0; } else if (av[1] > av[2] && av[1] > av[0]) { if (v[1] < 0) axis = 3; else axis = 2; } else { if (v[2] < 0) axis = 5; else axis = 4; } // project new texture coords float s, t, dv; int j; for (i=0 ; i<nump ; i++) { j = vec_to_st[axis][2]; if (j > 0) dv = vecs[i][j - 1]; else dv = -vecs[i][-j - 1]; if (dv < 0.001f) c... [truncated message content] |
From: Carsten W. <ca...@us...> - 2006-11-21 00:49:57
|
Update of /cvsroot/jake2/jake2/src/jake2/render/opengl In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv15569/src/jake2/render/opengl Added Files: JoglDriver.java Jsr231Driver.java Jsr231GL.java JoglGL.java GLDriver.java LwjglDriver.java LwjglGL.java CountGL.java QGL.java QGLConst.java DummyGL.java Log Message: merge render-refactoring branch into the HEAD --- NEW FILE: QGL.java --- package jake2.render.opengl; import java.nio.*; public interface QGL extends QGLConst { /* * a sub set of OpenGL for Jake2 */ void glActiveTextureARB(int texture); void glAlphaFunc(int func, float ref); void glArrayElement(int index); void glBegin(int mode); void glBindTexture(int target, int texture); void glBlendFunc(int sfactor, int dfactor); void glClear(int mask); void glClearColor(float red, float green, float blue, float alpha); void glClientActiveTextureARB(int texture); void glColor3f(float red, float green, float blue); void glColor3ub(byte red, byte green, byte blue); void glColor4f(float red, float green, float blue, float alpha); void glColor4ub(byte red, byte green, byte blue, byte alpha); void glColorPointer(int size, boolean unsigned, int stride, ByteBuffer pointer); void glColorPointer(int size, int stride, FloatBuffer pointer); void glColorTable(int target, int internalFormat, int width, int format, int type, ByteBuffer data); void glCullFace(int mode); void glDeleteTextures(IntBuffer textures); void glDepthFunc(int func); void glDepthMask(boolean flag); void glDepthRange(double zNear, double zFar); void glDisable(int cap); void glDisableClientState(int cap); void glDrawArrays(int mode, int first, int count); void glDrawBuffer(int mode); void glDrawElements(int mode, IntBuffer indices); void glEnable(int cap); void glEnableClientState(int cap); void glEnd(); void glFinish(); void glFlush(); void glFrustum(double left, double right, double bottom, double top, double zNear, double zFar); int glGetError(); void glGetFloat(int pname, FloatBuffer params); String glGetString(int name); void glInterleavedArrays(int format, int stride, FloatBuffer pointer); void glLockArraysEXT(int first, int count); void glLoadIdentity(); void glLoadMatrix(FloatBuffer m); void glMatrixMode(int mode); void glMultiTexCoord2f(int target, float s, float t); void glOrtho(double left, double right, double bottom, double top, double zNear, double zFar); void glPixelStorei(int pname, int param); void glPointParameterEXT(int pname, FloatBuffer pfParams); void glPointParameterfEXT(int pname, float param); void glPointSize(float size); void glPolygonMode(int face, int mode); void glPopMatrix(); void glPushMatrix(); void glReadPixels(int x, int y, int width, int height, int format, int type, ByteBuffer pixels); void glRotatef(float angle, float x, float y, float z); void glScalef(float x, float y, float z); void glScissor(int x, int y, int width, int height); void glShadeModel(int mode); void glTexCoord2f(float s, float t); void glTexCoordPointer(int size, int stride, FloatBuffer pointer); void glTexEnvi(int target, int pname, int param); void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, ByteBuffer pixels); void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, IntBuffer pixels); void glTexParameterf(int target, int pname, float param); void glTexParameteri(int target, int pname, int param); void glTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, IntBuffer pixels); void glTranslatef(float x, float y, float z); void glUnlockArraysEXT(); void glVertex2f(float x, float y); void glVertex3f(float x, float y, float z); void glVertexPointer(int size, int stride, FloatBuffer pointer); void glViewport(int x, int y, int width, int height); } --- NEW FILE: LwjglDriver.java --- /* * LWJGLBase.java * Copyright (C) 2004 * * $Id: LwjglDriver.java,v 1.2 2006/11/21 00:49:54 cawe Exp $ */ /* 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.opengl; import jake2.Defines; import jake2.client.VID; import jake2.qcommon.Com; import jake2.qcommon.xcommand_t; import jake2.render.Base; import java.awt.Dimension; import java.util.LinkedList; import org.lwjgl.LWJGLException; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.DisplayMode; /** * LWJGLBase * * @author dsanders/cwei */ public class LwjglDriver extends LwjglGL implements GLDriver { protected LwjglDriver() { // see LwjglRenderer } private DisplayMode oldDisplayMode; // window position on the screen int window_xpos, window_ypos; private java.awt.DisplayMode toAwtDisplayMode(DisplayMode m) { return new java.awt.DisplayMode(m.getWidth(), m.getHeight(), m .getBitsPerPixel(), m.getFrequency()); } public java.awt.DisplayMode[] getModeList() { DisplayMode[] modes; try { modes = Display.getAvailableDisplayModes(); } catch (LWJGLException e) { Com.Println(e.getMessage()); return new java.awt.DisplayMode[0]; } LinkedList l = new LinkedList(); l.add(toAwtDisplayMode(oldDisplayMode)); for (int i = 0; i < modes.length; i++) { DisplayMode m = modes[i]; if (m.getBitsPerPixel() != oldDisplayMode.getBitsPerPixel()) continue; if (m.getFrequency() > oldDisplayMode.getFrequency()) continue; if (m.getHeight() < 240 || m.getWidth() < 320) continue; int j = 0; java.awt.DisplayMode ml = null; for (j = 0; j < l.size(); j++) { ml = (java.awt.DisplayMode) l.get(j); if (ml.getWidth() > m.getWidth()) break; if (ml.getWidth() == m.getWidth() && ml.getHeight() >= m.getHeight()) break; } if (j == l.size()) { l.addLast(toAwtDisplayMode(m)); } else if (ml.getWidth() > m.getWidth() || ml.getHeight() > m.getHeight()) { l.add(j, toAwtDisplayMode(m)); } else if (m.getFrequency() > ml.getRefreshRate()) { l.remove(j); l.add(j, toAwtDisplayMode(m)); } } java.awt.DisplayMode[] ma = new java.awt.DisplayMode[l.size()]; l.toArray(ma); return ma; } public DisplayMode[] getLWJGLModeList() { DisplayMode[] modes; try { modes = Display.getAvailableDisplayModes(); } catch (LWJGLException e) { Com.Println(e.getMessage()); return new DisplayMode[0]; } LinkedList l = new LinkedList(); l.add(oldDisplayMode); for (int i = 0; i < modes.length; i++) { DisplayMode m = modes[i]; if (m.getBitsPerPixel() != oldDisplayMode.getBitsPerPixel()) continue; if (m.getFrequency() > oldDisplayMode.getFrequency()) continue; if (m.getHeight() < 240 || m.getWidth() < 320) continue; int j = 0; DisplayMode ml = null; for (j = 0; j < l.size(); j++) { ml = (DisplayMode) l.get(j); if (ml.getWidth() > m.getWidth()) break; if (ml.getWidth() == m.getWidth() && ml.getHeight() >= m.getHeight()) break; } if (j == l.size()) { l.addLast(m); } else if (ml.getWidth() > m.getWidth() || ml.getHeight() > m.getHeight()) { l.add(j, m); } else if (m.getFrequency() > ml.getFrequency()) { l.remove(j); l.add(j, m); } } DisplayMode[] ma = new DisplayMode[l.size()]; l.toArray(ma); return ma; } private DisplayMode findDisplayMode(Dimension dim) { DisplayMode mode = null; DisplayMode m = null; DisplayMode[] modes = getLWJGLModeList(); int w = dim.width; int h = dim.height; for (int i = 0; i < modes.length; i++) { m = modes[i]; if (m.getWidth() == w && m.getHeight() == h) { mode = m; break; } } if (mode == null) mode = oldDisplayMode; return mode; } String getModeString(DisplayMode m) { StringBuffer sb = new StringBuffer(); sb.append(m.getWidth()); sb.append('x'); sb.append(m.getHeight()); sb.append('x'); sb.append(m.getBitsPerPixel()); sb.append('@'); sb.append(m.getFrequency()); sb.append("Hz"); return sb.toString(); } /** * @param dim * @param mode * @param fullscreen * @return enum rserr_t */ public int setMode(Dimension dim, int mode, boolean fullscreen) { Dimension newDim = new Dimension(); VID.Printf(Defines.PRINT_ALL, "Initializing OpenGL display\n"); VID.Printf(Defines.PRINT_ALL, "...setting mode " + mode + ":"); /* * fullscreen handling */ if (oldDisplayMode == null) { oldDisplayMode = Display.getDisplayMode(); } if (!VID.GetModeInfo(newDim, mode)) { VID.Printf(Defines.PRINT_ALL, " invalid mode\n"); return Base.rserr_invalid_mode; } VID.Printf(Defines.PRINT_ALL, " " + newDim.width + " " + newDim.height + '\n'); // destroy the existing window shutdown(); Display.setTitle("Jake2 (lwjgl)"); Display.setLocation(0, 0); DisplayMode displayMode = findDisplayMode(newDim); newDim.width = displayMode.getWidth(); newDim.height = displayMode.getHeight(); if (fullscreen) { try { Display.setDisplayMode(displayMode); } catch (LWJGLException e) { return Base.rserr_invalid_mode; } Display.setLocation(0, 0); try { Display.setFullscreen(fullscreen); } catch (LWJGLException e) { return Base.rserr_invalid_fullscreen; } VID.Printf(Defines.PRINT_ALL, "...setting fullscreen " + getModeString(displayMode) + '\n'); } else { try { Display.setDisplayMode(displayMode); } catch (LWJGLException e) { return Base.rserr_invalid_mode; } try { Display.setFullscreen(false); } catch (LWJGLException e) { return Base.rserr_invalid_fullscreen; } Display.setLocation(window_xpos, window_ypos); } Base.setVid(newDim.width, newDim.height); // vid.width = newDim.width; // vid.height = newDim.height; try { Display.create(); } catch (LWJGLException e) { return Base.rserr_unknown; } // let the sound and input subsystems know about the new window VID.NewWindow(newDim.width, newDim.height); return Base.rserr_ok; } public void shutdown() { if (oldDisplayMode != null && Display.isFullscreen()) { try { Display.setDisplayMode(oldDisplayMode); } catch (Exception e) { e.printStackTrace(); } } while (Display.isCreated()) { Display.destroy(); } } /** * @return true */ public boolean init(int xpos, int ypos) { // do nothing window_xpos = xpos; window_ypos = ypos; return true; } public void beginFrame(float camera_separation) { // do nothing } public void endFrame() { glFlush(); // swap buffers Display.update(); } public void appActivate(boolean activate) { // do nothing } public void enableLogging(boolean enable) { // do nothing } public void logNewFrame() { // do nothing } /** * this is a hack for jogl renderers. * * @param callback */ public final void updateScreen(xcommand_t callback) { callback.execute(); } } --- NEW FILE: LwjglGL.java --- package jake2.render.opengl; import java.nio.*; import org.lwjgl.util.GL; public class LwjglGL implements QGL { LwjglGL() { // singleton } public final void glAlphaFunc(int func, float ref) { GL.glAlphaFunc(func, ref); } public final void glBegin(int mode) { GL.glBegin(mode); } public final void glBindTexture(int target, int texture) { GL.glBindTexture(target, texture); } public final void glBlendFunc(int sfactor, int dfactor) { GL.glBlendFunc(sfactor, dfactor); } public final void glClear(int mask) { GL.glClear(mask); } public final void glClearColor(float red, float green, float blue, float alpha) { GL.glClearColor(red, green, blue, alpha); } public final void glColor3f(float red, float green, float blue) { GL.glColor3f(red, green, blue); } public final void glColor3ub(byte red, byte green, byte blue) { GL.glColor3ub(red, green, blue); } public final void glColor4f(float red, float green, float blue, float alpha) { GL.glColor4f(red, green, blue, alpha); } public final void glColor4ub(byte red, byte green, byte blue, byte alpha) { GL.glColor4ub(red, green, blue, alpha); } public final void glColorPointer(int size, boolean unsigned, int stride, ByteBuffer pointer) { GL.glColorPointer(size, unsigned, stride, pointer); } public final void glColorPointer(int size, int stride, FloatBuffer pointer) { GL.glColorPointer(size, stride, pointer); } public final void glCullFace(int mode) { GL.glCullFace(mode); } public final void glDeleteTextures(IntBuffer textures) { GL.glDeleteTextures(textures); } public final void glDepthFunc(int func) { GL.glDepthFunc(func); } public final void glDepthMask(boolean flag) { GL.glDepthMask(flag); } public final void glDepthRange(double zNear, double zFar) { GL.glDepthRange(zNear, zFar); } public final void glDisable(int cap) { GL.glDisable(cap); } public final void glDisableClientState(int cap) { GL.glDisableClientState(cap); } public final void glDrawArrays(int mode, int first, int count) { GL.glDrawArrays(mode, first, count); } public final void glDrawBuffer(int mode) { GL.glDrawBuffer(mode); } public final void glDrawElements(int mode, IntBuffer indices) { GL.glDrawElements(mode, indices); } public final void glEnable(int cap) { GL.glEnable(cap); } public final void glEnableClientState(int cap) { GL.glEnableClientState(cap); } public final void glEnd() { GL.glEnd(); } public final void glFinish() { GL.glFinish(); } public final void glFlush() { GL.glFlush(); } public final void glFrustum(double left, double right, double bottom, double top, double zNear, double zFar) { GL.glFrustum(left, right, bottom, top, zNear, zFar); } public final int glGetError() { return GL.glGetError(); } public final void glGetFloat(int pname, FloatBuffer params) { GL.glGetFloat(pname, params); } public final String glGetString(int name) { return GL.glGetString(name); } public final void glInterleavedArrays(int format, int stride, FloatBuffer pointer) { GL.glInterleavedArrays(format, stride, pointer); } public final void glLoadIdentity() { GL.glLoadIdentity(); } public final void glLoadMatrix(FloatBuffer m) { GL.glLoadMatrix(m); } public final void glMatrixMode(int mode) { GL.glMatrixMode(mode); } public final void glOrtho(double left, double right, double bottom, double top, double zNear, double zFar) { GL.glOrtho(left, right, bottom, top, zNear, zFar); } public final void glPixelStorei(int pname, int param) { GL.glPixelStorei(pname, param); } public final void glPointSize(float size) { GL.glPointSize(size); } public final void glPolygonMode(int face, int mode) { GL.glPolygonMode(face, mode); } public final void glPopMatrix() { GL.glPopMatrix(); } public final void glPushMatrix() { GL.glPushMatrix(); } public final void glReadPixels(int x, int y, int width, int height, int format, int type, ByteBuffer pixels) { GL.glReadPixels(x, y, width, height, format, type, pixels); } public final void glRotatef(float angle, float x, float y, float z) { GL.glRotatef(angle, x, y, z); } public final void glScalef(float x, float y, float z) { GL.glScalef(x, y, z); } public final void glScissor(int x, int y, int width, int height) { GL.glScissor(x, y, width, height); } public final void glShadeModel(int mode) { GL.glShadeModel(mode); } public final void glTexCoord2f(float s, float t) { GL.glTexCoord2f(s, t); } public final void glTexCoordPointer(int size, int stride, FloatBuffer pointer) { GL.glTexCoordPointer(size, stride, pointer); } public final void glTexEnvi(int target, int pname, int param) { GL.glTexEnvi(target, pname, param); } public final void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, ByteBuffer pixels) { GL.glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); } public final void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, IntBuffer pixels) { GL.glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); } public final void glTexParameterf(int target, int pname, float param) { GL.glTexParameterf(target, pname, param); } public final void glTexParameteri(int target, int pname, int param) { GL.glTexParameteri(target, pname, param); } public final void glTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, IntBuffer pixels) { GL.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); } public final void glTranslatef(float x, float y, float z) { GL.glTranslatef(x, y, z); } public final void glVertex2f(float x, float y) { GL.glVertex2f(x, y); } public final void glVertex3f(float x, float y, float z) { GL.glVertex3f(x, y, z); } public final void glVertexPointer(int size, int stride, FloatBuffer pointer) { GL.glVertexPointer(size, stride, pointer); } public final void glViewport(int x, int y, int width, int height) { GL.glViewport(x, y, width, height); } public final void glColorTable(int target, int internalFormat, int width, int format, int type, ByteBuffer data) { GL.glColorTable(target, internalFormat, width, format, type, data); } public final void glActiveTextureARB(int texture) { GL.glActiveTextureARB(texture); } public final void glClientActiveTextureARB(int texture) { GL.glClientActiveTextureARB(texture); } public final void glPointParameterEXT(int pname, FloatBuffer pfParams) { GL.glPointParameterEXT(pname, pfParams); } public final void glPointParameterfEXT(int pname, float param) { GL.glPointParameterfEXT(pname, param); } public final void glLockArraysEXT(int first, int count) { GL.glLockArraysEXT(first, count); } public final void glArrayElement(int index) { GL.glArrayElement(index); } public final void glUnlockArraysEXT() { GL.glUnlockArraysEXT(); } public final void glMultiTexCoord2f(int target, float s, float t) { GL.glMultiTexCoord2f(target, s, t); } } --- NEW FILE: DummyGL.java --- package jake2.render.opengl; import java.nio.*; public class DummyGL implements QGL { private static QGL self = new DummyGL(); private DummyGL() { // singleton } public static QGL getInstance() { return self; } public void glAlphaFunc(int func, float ref) { // do nothing } public void glBegin(int mode) { // do nothing } public void glBindTexture(int target, int texture) { // do nothing } public void glBlendFunc(int sfactor, int dfactor) { // do nothing } public void glClear(int mask) { // do nothing } public void glClearColor(float red, float green, float blue, float alpha) { // do nothing } public void glColor3f(float red, float green, float blue) { // do nothing } public void glColor3ub(byte red, byte green, byte blue) { // do nothing } public void glColor4f(float red, float green, float blue, float alpha) { // do nothing } public void glColor4ub(byte red, byte green, byte blue, byte alpha) { // do nothing } public void glColorPointer(int size, boolean unsigned, int stride, ByteBuffer pointer) { // do nothing } public void glColorPointer(int size, int stride, FloatBuffer pointer) { // do nothing } public void glCullFace(int mode) { // do nothing } public void glDeleteTextures(IntBuffer textures) { // do nothing } public void glDepthFunc(int func) { // do nothing } public void glDepthMask(boolean flag) { // do nothing } public void glDepthRange(double zNear, double zFar) { // do nothing } public void glDisable(int cap) { // do nothing } public void glDisableClientState(int cap) { // do nothing } public void glDrawArrays(int mode, int first, int count) { // do nothing } public void glDrawBuffer(int mode) { // do nothing } public void glDrawElements(int mode, IntBuffer indices) { // do nothing } public void glEnable(int cap) { // do nothing } public void glEnableClientState(int cap) { // do nothing } public void glEnd() { // do nothing } public void glFinish() { // do nothing } public void glFlush() { // do nothing } public void glFrustum(double left, double right, double bottom, double top, double zNear, double zFar) { // do nothing } public int glGetError() { return GL_NO_ERROR; } public void glGetFloat(int pname, FloatBuffer params) { // do nothing } public String glGetString(int name) { switch (name) { case GL_EXTENSIONS: return "GL_ARB_multitexture"; default: return ""; } } public void glInterleavedArrays(int format, int stride, FloatBuffer pointer) { // do nothing } public void glLoadIdentity() { // do nothing } public void glLoadMatrix(FloatBuffer m) { // do nothing } public void glMatrixMode(int mode) { // do nothing } public void glOrtho(double left, double right, double bottom, double top, double zNear, double zFar) { // do nothing } public void glPixelStorei(int pname, int param) { // do nothing } public void glPointSize(float size) { // do nothing } public void glPolygonMode(int face, int mode) { // do nothing } public void glPopMatrix() { // do nothing } public void glPushMatrix() { // do nothing } public void glReadPixels(int x, int y, int width, int height, int format, int type, ByteBuffer pixels) { // do nothing } public void glRotatef(float angle, float x, float y, float z) { // do nothing } public void glScalef(float x, float y, float z) { // do nothing } public void glScissor(int x, int y, int width, int height) { // do nothing } public void glShadeModel(int mode) { // do nothing } public void glTexCoord2f(float s, float t) { // do nothing } public void glTexCoordPointer(int size, int stride, FloatBuffer pointer) { // do nothing } public void glTexEnvi(int target, int pname, int param) { // do nothing } public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, ByteBuffer pixels) { // do nothing } public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, IntBuffer pixels) { // do nothing } public void glTexParameterf(int target, int pname, float param) { // do nothing } public void glTexParameteri(int target, int pname, int param) { // do nothing } public void glTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, IntBuffer pixels) { // do nothing } public void glTranslatef(float x, float y, float z) { // do nothing } public void glVertex2f(float x, float y) { // do nothing } public void glVertex3f(float x, float y, float z) { // do nothing } public void glVertexPointer(int size, int stride, FloatBuffer pointer) { // do nothing } public void glViewport(int x, int y, int width, int height) { // do nothing } public void glColorTable(int target, int internalFormat, int width, int format, int type, ByteBuffer data) { // do nothing } public void glActiveTextureARB(int texture) { // do nothing } public void glClientActiveTextureARB(int texture) { // do nothing } public void glPointParameterEXT(int pname, FloatBuffer pfParams) { // do nothing } public void glPointParameterfEXT(int pname, float param) { // do nothing } public void glLockArraysEXT(int first, int count) { // do nothing } public void glArrayElement(int index) { // do nothing } public void glUnlockArraysEXT() { // do nothing } public void glMultiTexCoord2f(int target, float s, float t) { // do nothing } } --- NEW FILE: JoglGL.java --- package jake2.render.opengl; import java.nio.*; import net.java.games.jogl.GL; public class JoglGL implements QGL { private GL jogl; JoglGL() { // singleton } void setGL(GL context) { this.jogl = context; } public void glAlphaFunc(int func, float ref) { jogl.glAlphaFunc(func, ref); } public void glBegin(int mode) { jogl.glBegin(mode); } public void glBindTexture(int target, int texture) { jogl.glBindTexture(target, texture); } public void glBlendFunc(int sfactor, int dfactor) { jogl.glBlendFunc(sfactor, dfactor); } public void glClear(int mask) { jogl.glClear(mask); } public void glClearColor(float red, float green, float blue, float alpha) { jogl.glClearColor(red, green, blue, alpha); } public void glColor3f(float red, float green, float blue) { jogl.glColor3f(red, green, blue); } public void glColor3ub(byte red, byte green, byte blue) { jogl.glColor3ub(red, green, blue); } public void glColor4f(float red, float green, float blue, float alpha) { jogl.glColor4f(red, green, blue, alpha); } public void glColor4ub(byte red, byte green, byte blue, byte alpha) { jogl.glColor4ub(red, green, blue, alpha); } public void glColorPointer(int size, boolean unsigned, int stride, ByteBuffer pointer) { jogl.glColorPointer(size, GL_UNSIGNED_BYTE, stride, pointer); } public void glColorPointer(int size, int stride, FloatBuffer pointer) { jogl.glColorPointer(size, GL_FLOAT, stride, pointer); } public void glCullFace(int mode) { jogl.glCullFace(mode); } public void glDeleteTextures(IntBuffer textures) { jogl.glDeleteTextures(textures.limit(), textures); } public void glDepthFunc(int func) { jogl.glDepthFunc(func); } public void glDepthMask(boolean flag) { jogl.glDepthMask(flag); } public void glDepthRange(double zNear, double zFar) { jogl.glDepthRange(zNear, zFar); } public void glDisable(int cap) { jogl.glDisable(cap); } public void glDisableClientState(int cap) { jogl.glDisableClientState(cap); } public void glDrawArrays(int mode, int first, int count) { jogl.glDrawArrays(mode, first, count); } public void glDrawBuffer(int mode) { jogl.glDrawBuffer(mode); } public void glDrawElements(int mode, IntBuffer indices) { jogl.glDrawElements(mode, indices.limit(), GL_UNSIGNED_INT, indices); } public void glEnable(int cap) { jogl.glEnable(cap); } public void glEnableClientState(int cap) { jogl.glEnableClientState(cap); } public void glEnd() { jogl.glEnd(); } public void glFinish() { jogl.glFinish(); } public void glFlush() { jogl.glFlush(); } public void glFrustum(double left, double right, double bottom, double top, double zNear, double zFar) { jogl.glFrustum(left, right, bottom, top, zNear, zFar); } public int glGetError() { return jogl.glGetError(); } public void glGetFloat(int pname, FloatBuffer params) { jogl.glGetFloatv(pname, params); } public String glGetString(int name) { return jogl.glGetString(name); } public void glInterleavedArrays(int format, int stride, FloatBuffer pointer) { jogl.glInterleavedArrays(format, stride, pointer); } public void glLoadIdentity() { jogl.glLoadIdentity(); } public void glLoadMatrix(FloatBuffer m) { jogl.glLoadMatrixf(m); } public void glMatrixMode(int mode) { jogl.glMatrixMode(mode); } public void glOrtho(double left, double right, double bottom, double top, double zNear, double zFar) { jogl.glOrtho(left, right, bottom, top, zNear, zFar); } public void glPixelStorei(int pname, int param) { jogl.glPixelStorei(pname, param); } public void glPointSize(float size) { jogl.glPointSize(size); } public void glPolygonMode(int face, int mode) { jogl.glPolygonMode(face, mode); } public void glPopMatrix() { jogl.glPopMatrix(); } public void glPushMatrix() { jogl.glPushMatrix(); } public void glReadPixels(int x, int y, int width, int height, int format, int type, ByteBuffer pixels) { jogl.glReadPixels(x, y, width, height, format, type, pixels); } public void glRotatef(float angle, float x, float y, float z) { jogl.glRotatef(angle, x, y, z); } public void glScalef(float x, float y, float z) { jogl.glScalef(x, y, z); } public void glScissor(int x, int y, int width, int height) { jogl.glScissor(x, y, width, height); } public void glShadeModel(int mode) { jogl.glShadeModel(mode); } public void glTexCoord2f(float s, float t) { jogl.glTexCoord2f(s, t); } public void glTexCoordPointer(int size, int stride, FloatBuffer pointer) { jogl.glTexCoordPointer(size, GL_FLOAT, stride, pointer); } public void glTexEnvi(int target, int pname, int param) { jogl.glTexEnvi(target, pname, param); } public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, ByteBuffer pixels) { jogl.glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); } public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, IntBuffer pixels) { jogl.glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); } public void glTexParameterf(int target, int pname, float param) { jogl.glTexParameterf(target, pname, param); } public void glTexParameteri(int target, int pname, int param) { jogl.glTexParameteri(target, pname, param); } public void glTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, IntBuffer pixels) { jogl.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); } public void glTranslatef(float x, float y, float z) { jogl.glTranslatef(x, y, z); } public void glVertex2f(float x, float y) { jogl.glVertex2f(x, y); } public void glVertex3f(float x, float y, float z) { jogl.glVertex3f(x, y, z); } public void glVertexPointer(int size, int stride, FloatBuffer pointer) { jogl.glVertexPointer(size, GL_FLOAT, stride, pointer); } public void glViewport(int x, int y, int width, int height) { jogl.glViewport(x, y, width, height); } public void glColorTable(int target, int internalFormat, int width, int format, int type, ByteBuffer data) { jogl.glColorTable(target, internalFormat, width, format, type, data); } public void glActiveTextureARB(int texture) { jogl.glActiveTextureARB(texture); } public void glClientActiveTextureARB(int texture) { jogl.glClientActiveTextureARB(texture); } public void glPointParameterEXT(int pname, FloatBuffer pfParams) { jogl.glPointParameterfvEXT(pname, pfParams); } public void glPointParameterfEXT(int pname, float param) { jogl.glPointParameterfEXT(pname, param); } public void glLockArraysEXT(int first, int count) { jogl.glLockArraysEXT(first, count); } public void glArrayElement(int index) { jogl.glArrayElement(index); } public void glUnlockArraysEXT() { jogl.glUnlockArraysEXT(); } public void glMultiTexCoord2f(int target, float s, float t) { jogl.glMultiTexCoord2f(target, s, t); } } --- NEW FILE: Jsr231GL.java --- package jake2.render.opengl; import java.nio.*; import javax.media.opengl.GL; public class Jsr231GL implements QGL { private GL gl; Jsr231GL() { // singleton } void setGL(GL gl) { this.gl = gl; } public void glAlphaFunc(int func, float ref) { gl.glAlphaFunc(func, ref); } public void glBegin(int mode) { gl.glBegin(mode); } public void glBindTexture(int target, int texture) { gl.glBindTexture(target, texture); } public void glBlendFunc(int sfactor, int dfactor) { gl.glBlendFunc(sfactor, dfactor); } public void glClear(int mask) { gl.glClear(mask); } public void glClearColor(float red, float green, float blue, float alpha) { gl.glClearColor(red, green, blue, alpha); } public void glColor3f(float red, float green, float blue) { gl.glColor3f(red, green, blue); } public void glColor3ub(byte red, byte green, byte blue) { gl.glColor3ub(red, green, blue); } public void glColor4f(float red, float green, float blue, float alpha) { gl.glColor4f(red, green, blue, alpha); } public void glColor4ub(byte red, byte green, byte blue, byte alpha) { gl.glColor4ub(red, green, blue, alpha); } public void glColorPointer(int size, boolean unsigned, int stride, ByteBuffer pointer) { gl.glColorPointer(size, GL_UNSIGNED_BYTE, stride, pointer); } public void glColorPointer(int size, int stride, FloatBuffer pointer) { gl.glColorPointer(size, GL_FLOAT, stride, pointer); } public void glCullFace(int mode) { gl.glCullFace(mode); } public void glDeleteTextures(IntBuffer textures) { gl.glDeleteTextures(textures.limit(), textures); } public void glDepthFunc(int func) { gl.glDepthFunc(func); } public void glDepthMask(boolean flag) { gl.glDepthMask(flag); } public void glDepthRange(double zNear, double zFar) { gl.glDepthRange(zNear, zFar); } public void glDisable(int cap) { gl.glDisable(cap); } public void glDisableClientState(int cap) { gl.glDisableClientState(cap); } public void glDrawArrays(int mode, int first, int count) { gl.glDrawArrays(mode, first, count); } public void glDrawBuffer(int mode) { gl.glDrawBuffer(mode); } public void glDrawElements(int mode, IntBuffer indices) { gl.glDrawElements(mode, indices.limit(), GL_UNSIGNED_INT, indices); } public void glEnable(int cap) { gl.glEnable(cap); } public void glEnableClientState(int cap) { gl.glEnableClientState(cap); } public void glEnd() { gl.glEnd(); } public void glFinish() { gl.glFinish(); } public void glFlush() { gl.glFlush(); } public void glFrustum(double left, double right, double bottom, double top, double zNear, double zFar) { gl.glFrustum(left, right, bottom, top, zNear, zFar); } public int glGetError() { return gl.glGetError(); } public void glGetFloat(int pname, FloatBuffer params) { gl.glGetFloatv(pname, params); } public String glGetString(int name) { return gl.glGetString(name); } public void glInterleavedArrays(int format, int stride, FloatBuffer pointer) { gl.glInterleavedArrays(format, stride, pointer); } public void glLoadIdentity() { gl.glLoadIdentity(); } public void glLoadMatrix(FloatBuffer m) { gl.glLoadMatrixf(m); } public void glMatrixMode(int mode) { gl.glMatrixMode(mode); } public void glOrtho(double left, double right, double bottom, double top, double zNear, double zFar) { gl.glOrtho(left, right, bottom, top, zNear, zFar); } public void glPixelStorei(int pname, int param) { gl.glPixelStorei(pname, param); } public void glPointSize(float size) { gl.glPointSize(size); } public void glPolygonMode(int face, int mode) { gl.glPolygonMode(face, mode); } public void glPopMatrix() { gl.glPopMatrix(); } public void glPushMatrix() { gl.glPushMatrix(); } public void glReadPixels(int x, int y, int width, int height, int format, int type, ByteBuffer pixels) { gl.glReadPixels(x, y, width, height, format, type, pixels); } public void glRotatef(float angle, float x, float y, float z) { gl.glRotatef(angle, x, y, z); } public void glScalef(float x, float y, float z) { gl.glScalef(x, y, z); } public void glScissor(int x, int y, int width, int height) { gl.glScissor(x, y, width, height); } public void glShadeModel(int mode) { gl.glShadeModel(mode); } public void glTexCoord2f(float s, float t) { gl.glTexCoord2f(s, t); } public void glTexCoordPointer(int size, int stride, FloatBuffer pointer) { gl.glTexCoordPointer(size, GL_FLOAT, stride, pointer); } public void glTexEnvi(int target, int pname, int param) { gl.glTexEnvi(target, pname, param); } public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, ByteBuffer pixels) { gl.glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); } public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, IntBuffer pixels) { gl.glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); } public void glTexParameterf(int target, int pname, float param) { gl.glTexParameterf(target, pname, param); } public void glTexParameteri(int target, int pname, int param) { gl.glTexParameteri(target, pname, param); } public void glTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, IntBuffer pixels) { gl.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); } public void glTranslatef(float x, float y, float z) { gl.glTranslatef(x, y, z); } public void glVertex2f(float x, float y) { gl.glVertex2f(x, y); } public void glVertex3f(float x, float y, float z) { gl.glVertex3f(x, y, z); } public void glVertexPointer(int size, int stride, FloatBuffer pointer) { gl.glVertexPointer(size, GL_FLOAT, stride, pointer); } public void glViewport(int x, int y, int width, int height) { gl.glViewport(x, y, width, height); } public void glColorTable(int target, int internalFormat, int width, int format, int type, ByteBuffer data) { gl.glColorTable(target, internalFormat, width, format, type, data); } public void glActiveTextureARB(int texture) { gl.glActiveTexture(texture); } public void glClientActiveTextureARB(int texture) { gl.glClientActiveTexture(texture); } public void glPointParameterEXT(int pname, FloatBuffer pfParams) { gl.glPointParameterfvEXT(pname, pfParams); } public void glPointParameterfEXT(int pname, float param) { gl.glPointParameterfEXT(pname, param); } public void glLockArraysEXT(int first, int count) { gl.glLockArraysEXT(first, count); } public void glArrayElement(int index) { gl.glArrayElement(index); } public void glUnlockArraysEXT() { gl.glUnlockArraysEXT(); } public void glMultiTexCoord2f(int target, float s, float t) { gl.glMultiTexCoord2f(target, s, t); } } --- NEW FILE: QGLConst.java --- package jake2.render.opengl; public interface QGLConst { /* * alpha functions */ public static final int GL_NEVER = 0x0200; public static final int GL_LESS = 0x0201; public static final int GL_EQUAL = 0x0202; public static final int GL_LEQUAL = 0x0203; public static final int GL_GREATER = 0x0204; public static final int GL_NOTEQUAL = 0x0205; public static final int GL_GEQUAL = 0x0206; public static final int GL_ALWAYS = 0x0207; /* * attribute masks */ public static final int GL_DEPTH_BUFFER_BIT = 0x00000100; public static final int GL_STENCIL_BUFFER_BIT = 0x00000400; public static final int GL_COLOR_BUFFER_BIT = 0x00004000; /* * begin modes */ public static final int GL_POINTS = 0x0000; public static final int GL_LINES = 0x0001; public static final int GL_LINE_LOOP = 0x0002; public static final int GL_LINE_STRIP = 0x0003; public static final int GL_TRIANGLES = 0x0004; public static final int GL_TRIANGLE_STRIP = 0x0005; public static final int GL_TRIANGLE_FAN = 0x0006; public static final int GL_QUADS = 0x0007; public static final int GL_QUAD_STRIP = 0x0008; public static final int GL_POLYGON = 0x0009; /* * blending factors */ public static final int GL_ZERO = 0; public static final int GL_ONE = 1; public static final int GL_SRC_COLOR = 0x0300; public static final int GL_ONE_MINUS_SRC_COLOR = 0x0301; public static final int GL_SRC_ALPHA = 0x0302; public static final int GL_ONE_MINUS_SRC_ALPHA = 0x0303; public static final int GL_DST_ALPHA = 0x0304; public static final int GL_ONE_MINUS_DST_ALPHA = 0x0305; /* * boolean */ public static final int GL_TRUE = 1; public static final int GL_FALSE = 0; /* * data types */ public static final int GL_BYTE = 0x1400; public static final int GL_UNSIGNED_BYTE = 0x1401; public static final int GL_SHORT = 0x1402; public static final int GL_UNSIGNED_SHORT = 0x1403; public static final int GL_INT = 0x1404; public static final int GL_UNSIGNED_INT = 0x1405; public static final int GL_FLOAT = 0x1406; /* * draw buffer modes */ public static final int GL_FRONT = 0x0404; public static final int GL_BACK = 0x0405; public static final int GL_FRONT_AND_BACK = 0x0408; /* * errors */ public static final int GL_NO_ERROR = 0; public static final int GL_POINT_SMOOTH = 0x0B10; public static final int GL_CULL_FACE = 0x0B44; public static final int GL_DEPTH_TEST = 0x0B71; public static final int GL_MODELVIEW_MATRIX = 0x0BA6; public static final int GL_ALPHA_TEST = 0x0BC0; public static final int GL_BLEND = 0x0BE2; public static final int GL_SCISSOR_TEST = 0x0C11; public static final int GL_PACK_ALIGNMENT = 0x0D05; public static final int GL_TEXTURE_2D = 0x0DE1; /* * hint modes */ public static final int GL_DONT_CARE = 0x1100; public static final int GL_FASTEST = 0x1101; public static final int GL_NICEST = 0x1102; /* * matrix modes */ public static final int GL_MODELVIEW = 0x1700; public static final int GL_PROJECTION = 0x1701; /* * pixel formats */ public static final int GL_COLOR_INDEX = 0x1900; public static final int GL_RED = 0x1903; public static final int GL_GREEN = 0x1904; public static final int GL_BLUE = 0x1905; public static final int GL_ALPHA = 0x1906; public static final int GL_RGB = 0x1907; public static final int GL_RGBA = 0x1908; public static final int GL_LUMINANCE = 0x1909; public static final int GL_LUMINANCE_ALPHA = 0x190A; /* * polygon modes */ public static final int GL_POINT = 0x1B00; public static final int GL_LINE = 0x1B01; public static final int GL_FILL = 0x1B02; /* * shading models */ public static final int GL_FLAT = 0x1D00; public static final int GL_SMOOTH = 0x1D01; public static final int GL_REPLACE = 0x1E01; /* * string names */ public static final int GL_VENDOR = 0x1F00; public static final int GL_RENDERER = 0x1F01; public static final int GL_VERSION = 0x1F02; public static final int GL_EXTENSIONS = 0x1F03; /* * TextureEnvMode */ public static final int GL_MODULATE = 0x2100; /* * TextureEnvParameter */ public static final int GL_TEXTURE_ENV_MODE = 0x2200; public static final int GL_TEXTURE_ENV_COLOR = 0x2201; /* * TextureEnvTarget */ public static final int GL_TEXTURE_ENV = 0x2300; public static final int GL_NEAREST = 0x2600; public static final int GL_LINEAR = 0x2601; public static final int GL_NEAREST_MIPMAP_NEAREST = 0x2700; public static final int GL_LINEAR_MIPMAP_NEAREST = 0x2701; public static final int GL_NEAREST_MIPMAP_LINEAR = 0x2702; public static final int GL_LINEAR_MIPMAP_LINEAR = 0x2703; /* * TextureParameterName */ public static final int GL_TEXTURE_MAG_FILTER = 0x2800; public static final int GL_TEXTURE_MIN_FILTER = 0x2801; public static final int GL_TEXTURE_WRAP_S = 0x2802; public static final int GL_TEXTURE_WRAP_T = 0x2803; /* * TextureWrapMode */ public static final int GL_CLAMP = 0x2900; public static final int GL_REPEAT = 0x2901; /* * texture */ public static final int GL_LUMINANCE8 = 0x8040; public static final int GL_INTENSITY8 = 0x804B; public static final int GL_R3_G3_B2 = 0x2A10; public static final int GL_RGB4 = 0x804F; public static final int GL_RGB5 = 0x8050; public static final int GL_RGB8 = 0x8051; public static final int GL_RGBA2 = 0x8055; public static final int GL_RGBA4 = 0x8056; public static final int GL_RGB5_A1 = 0x8057; public static final int GL_RGBA8 = 0x8058; /* * vertex arrays */ public static final int GL_VERTEX_ARRAY = 0x8074; public static final int GL_COLOR_ARRAY = 0x8076; public static final int GL_TEXTURE_COORD_ARRAY = 0x8078; public static final int GL_T2F_V3F = 0x2A27; /* * OpenGL 1.2, 1.3 constants */ public static final int GL_SHARED_TEXTURE_PALETTE_EXT = 0x81FB; public static final int GL_TEXTURE0 = 0x84C0; public static final int GL_TEXTURE1 = 0x84C1; public static final int GL_TEXTURE0_ARB = 0x84C0; public static final int GL_TEXTURE1_ARB = 0x84C1; public static final int GL_BGR = 0x80E0; public static final int GL_BGRA = 0x80E1; /* * point parameters */ public static final int GL_POINT_SIZE_MIN_EXT = 0x8126; public static final int GL_POINT_SIZE_MAX_EXT = 0x8127; public static final int GL_POINT_FADE_THRESHOLD_SIZE_EXT = 0x8128; public static final int GL_DISTANCE_ATTENUATION_EXT = 0x8129; } --- NEW FILE: CountGL.java --- package jake2.render.opengl; import java.nio.*; public class CountGL implements QGL { private static int count = 0; private static QGL self = new CountGL(); private CountGL() { // singleton } public static QGL getInstance() { return self; } public void glAlphaFunc(int func, float ref) { count++; } public void glBegin(int mode) { count++; } public void glBindTexture(int target, int texture) { count++; } public void glBlendFunc(int sfactor, int dfactor) { count++; } public void glClear(int mask) { count++; } public void glClearColor(float red, float green, float blue, float alpha) { count++; } public void glColor3f(float red, float green, float blue) { count++; } public void glColor3ub(byte red, byte green, byte blue) { count++; } public void glColor4f(float red, float green, float blue, float alpha) { count++; } public void glColor4ub(byte red, byte green, byte blue, byte alpha) { count++; } public void glColorPointer(int size, boolean unsigned, int stride, ByteBuffer pointer) { count++; } public void glColorPointer(int size, int stride, FloatBuffer pointer) { count++; } public void glCullFace(int mode) { count++; } public void glDeleteTextures(IntBuffer textures) { count++; } public void glDepthFunc(int func) { count++; } public void glDepthMask(boolean flag) { count++; } public void glDepthRange(double zNear, double zFar) { count++; } public void glDisable(int cap) { count++; } public void glDisableClientState(int cap) { count++; } public void glDrawArrays(int mode, int first, int count) { count++; } public void glDrawBuffer(int mode) { count++; } public void glDrawElements(int mode, IntBuffer indices) { count++; } public void glEnable(int cap) { count++; } public void glEnableClientState(int cap) { count++; } public void glEnd() { count++; } public void glFinish() { count++; } public void glFlush() { System.err.println("GL calls/frame: " + (++count)); count = 0; } public void glFrustum(double left, double right, double bottom, double top, double zNear, double zFar) { count++; } public int glGetError() { return GL_NO_ERROR; } public void glGetFloat(int pname, FloatBuffer params) { count++; } public String glGetString(int name) { switch (name) { case GL_EXTENSIONS: return "GL_ARB_multitexture"; default: return ""; } } public void glInterleavedArrays(int format, int stride, FloatBuffer pointer) { count++; } public void glLoadIdentity() { count++; } public void glLoadMatrix(FloatBuffer m) { count++; } public void glMatrixMode(int mode) { count++; } public void glOrtho(double left, double right, double bottom, double top, double zNear, double zFar) { count++; } public void glPixelStorei(int pname, int param) { count++; } public void glPointSize(float size) { count++; } public void glPolygonMode(int face, int mode) { count++; } public void glPopMatrix() { count++; } public void glPushMatrix() { count++; } public void glReadPixels(int x, int y, int width, int height, int format, int type, ByteBuffer pixels) { count++; } public void glRotatef(float angle, float x, float y, float z) { count++; } public void glScalef(float x, float y, float z) { count++; } public void glScissor(int x, int y, int width, int height) { count++; } public void glShadeModel(int mode) { count++; } public void glTexCoord2f(float s, float t) { count++; } public void glTexCoordPointer(int size, int stride, FloatBuffer pointer) { count++; } public void glTexEnvi(int target, int pname, int param) { count++; } public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, ByteBuffer pixels) { count++; } public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, IntBuffer pixels) { count++; } public void glTexParameterf(int target, int pname, float param) { count++; } public void glTexParameteri(int target, int pname, int param) { count++; } public void glTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, IntBuffer pixels) { count++; } public void glTranslatef(float x, float y, float z) { count++; } public void glVertex2f(float x, float y) { count++; } public void glVertex3f(float x, float y, float z) { count++; } public void glVertexPointer(int size, int stride, FloatBuffer pointer) { count++; } public void glViewport(int x, int y, int width, int height) { count++; } public void glColorTable(int target, int internalFormat, int width, int format, int type, ByteBuffer data) { count++; } public void glActiveTextureARB(int texture) { count++; } public void glClientActiveTextureARB(int texture) { count++; } public void glPointParameterEXT(int pname, FloatBuffer pfParams) { count++; } public void glPointParameterfEXT(int pname, float param) { count++; } public void glLockArraysEXT(int first, int count) { count++; } public void glArrayElement(int index) { count++; } public void glUnlockArraysEXT() { count++; } public void glMultiTexCoord2f(int target, float s, float t) { count++; } } --- NEW FILE: Jsr231Driver.java --- /* * JoglCommon.java * Copyright (C) 2004 * * $Id: Jsr231Driver.java,v 1.2 2006/11/21 00:49:54 cawe Exp $ */ /* 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.opengl; import jake2.Defines; import jake2.client.VID; import jake2.qcommon.Cbuf; import jake2.qcommon.xcommand_t; import jake2.render.Base; import jake2.sys.JOGLKBD; import java.awt.*; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.LinkedList; import javax.media.opengl.*; import javax.swing.ImageIcon; import javax.swing.JFrame; /** * JoglCommon */ public class Jsr231Driver extends Jsr231GL implements GLDriver { protected Jsr231Driver() { // singleton } private GraphicsDevice device; private DisplayMode oldDisplayMode; private Display display; JFrame window; // window position on the screen int window_xpos, window_ypos; public DisplayMode[] getModeList() { DisplayMode[] modes = device.getDisplayModes(); LinkedList l = new LinkedList(); l.add(oldDisplayMode); for (int i = 0; i < modes.length; i++) { DisplayMode m = modes[i]; if (m.getBitDepth() != oldDisplayMode.getBitDepth()) continue; if (m.getRefreshRate() > oldDisplayMode.getRefreshRate()) continue; if (m.getHeight() < 240 || m.getWidth() < 320) continue; int j = 0; DisplayMode ml = null; for (j = 0; j < l.size(); j++) { ml = (DisplayMode)l.get(j); if (ml.getWidth() > m.getWidth()) break; if (ml.getWidth() == m.getWidth() && ml.getHeight() >= m.getHeight()) break; } if (j == l.size()) { l.a... [truncated message content] |
From: Carsten W. <ca...@us...> - 2006-11-21 00:48:16
|
Update of /cvsroot/jake2/jake2/test/jake2/render In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv15164/test/jake2/render Modified Files: DancingQueens.java TestMap.java Log Message: merge render-refactoring branch into the HEAD Index: TestMap.java =================================================================== RCS file: /cvsroot/jake2/jake2/test/jake2/render/TestMap.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TestMap.java 14 Dec 2004 01:08:32 -0000 1.6 --- TestMap.java 21 Nov 2006 00:48:14 -0000 1.7 *************** *** 28,31 **** --- 28,32 ---- import jake2.Defines; import jake2.Globals; + import jake2.Jake2; import jake2.client.*; import jake2.game.Cmd; *************** *** 72,81 **** void init() { ! Qcommon.Init(new String[] { "TestMap $Id$" }); // sehr wichtig !!! VID.Shutdown(); ! this.re = Renderer.getDriver("jogl"); re.Init(0, 0); --- 73,90 ---- void init() { ! Globals.dedicated = Cvar.Get("dedicated", "0", Qcommon.CVAR_NOSET); ! // open the q2dialog, if we are not in dedicated mode. ! if (Globals.dedicated.value != 1.0f) ! { ! Jake2.Q2Dialog = new Q2DataDialog(); ! Locale.setDefault(Locale.US); ! Jake2.Q2Dialog.setVisible(true); ! } ! Qcommon.Init(new String[] { "TestMap $Id$" }); // sehr wichtig !!! VID.Shutdown(); ! Globals.re = this.re = Renderer.getDriver("jsr231", false); re.Init(0, 0); Index: DancingQueens.java =================================================================== RCS file: /cvsroot/jake2/jake2/test/jake2/render/DancingQueens.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** DancingQueens.java 10 Jan 2006 14:34:00 -0000 1.9 --- DancingQueens.java 21 Nov 2006 00:48:14 -0000 1.10 *************** *** 80,84 **** System.out.println("Registered Drivers: " + Arrays.asList(names)); ! this.re = Renderer.getDriver("fastjogl"); Globals.re = this.re; --- 80,84 ---- System.out.println("Registered Drivers: " + Arrays.asList(names)); ! this.re = Renderer.getDriver("jsr231"); Globals.re = this.re; |
From: Carsten W. <ca...@us...> - 2006-11-21 00:47:56
|
Update of /cvsroot/jake2/jake2 In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv14791 Modified Files: .classpath Log Message: merge render-refactoring branch into the HEAD Index: .classpath =================================================================== RCS file: /cvsroot/jake2/jake2/.classpath,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** .classpath 24 Oct 2006 22:51:21 -0000 1.7 --- .classpath 21 Nov 2006 00:47:52 -0000 1.8 *************** *** 7,13 **** <classpathentry kind="lib" path="lib/joal/gluegen-rt.jar"/> <classpathentry kind="lib" path="lib/jogl/jogl.jar"/> ! <classpathentry kind="lib" path="resources"/> <classpathentry kind="lib" path="lib/lwjgl/lwjgl_util.jar"/> <classpathentry kind="lib" path="lib/lwjgl/lwjgl.jar"/> <classpathentry kind="output" path="build"/> </classpath> --- 7,14 ---- <classpathentry kind="lib" path="lib/joal/gluegen-rt.jar"/> <classpathentry kind="lib" path="lib/jogl/jogl.jar"/> ! <classpathentry kind="lib" path="lib/jsr231/jogl.jar"/> <classpathentry kind="lib" path="lib/lwjgl/lwjgl_util.jar"/> <classpathentry kind="lib" path="lib/lwjgl/lwjgl.jar"/> + <classpathentry kind="lib" path="resources"/> <classpathentry kind="output" path="build"/> </classpath> |
From: Carsten W. <ca...@us...> - 2006-11-21 00:41:10
|
Update of /cvsroot/jake2/jake2/lib/jsr231 In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv10953/lib/jsr231 Added Files: jogl.jar Log Message: merge render-refactoring branch into the HEAD --- NEW FILE: jogl.jar --- (This appears to be a binary file; contents omitted.) |
From: Carsten W. <ca...@us...> - 2006-11-21 00:41:10
|
Update of /cvsroot/jake2/jake2/lib/jsr231/osx In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv10953/lib/jsr231/osx Added Files: libjogl_awt.jnilib libjogl.jnilib libjogl_cg.jnilib Log Message: merge render-refactoring branch into the HEAD --- NEW FILE: libjogl.jnilib --- (This appears to be a binary file; contents omitted.) --- NEW FILE: libjogl_awt.jnilib --- (This appears to be a binary file; contents omitted.) --- NEW FILE: libjogl_cg.jnilib --- (This appears to be a binary file; contents omitted.) |
From: Carsten W. <ca...@us...> - 2006-11-21 00:41:09
|
Update of /cvsroot/jake2/jake2/lib/jsr231/linux In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv10953/lib/jsr231/linux Added Files: libjogl.so libjogl_drihack.so libjogl_awt.so libjogl_cg.so Log Message: merge render-refactoring branch into the HEAD --- NEW FILE: libjogl.so --- (This appears to be a binary file; contents omitted.) --- NEW FILE: libjogl_cg.so --- (This appears to be a binary file; contents omitted.) --- NEW FILE: libjogl_awt.so --- (This appears to be a binary file; contents omitted.) --- NEW FILE: libjogl_drihack.so --- (This appears to be a binary file; contents omitted.) |
From: Carsten W. <ca...@us...> - 2006-11-21 00:41:09
|
Update of /cvsroot/jake2/jake2/lib/jsr231/windows In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv10953/lib/jsr231/windows Added Files: jogl_awt.dll jogl_cg.dll jogl.dll Log Message: merge render-refactoring branch into the HEAD --- NEW FILE: jogl_awt.dll --- (This appears to be a binary file; contents omitted.) --- NEW FILE: jogl_cg.dll --- (This appears to be a binary file; contents omitted.) --- NEW FILE: jogl.dll --- (This appears to be a binary file; contents omitted.) |
From: Carsten W. <ca...@us...> - 2006-11-20 23:36:27
|
Update of /cvsroot/jake2/jake2/test/jake2/render In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv19705/test/jake2/render Modified Files: Tag: render-refactoring TestMap.java Log Message: update to run with new APIs Index: TestMap.java =================================================================== RCS file: /cvsroot/jake2/jake2/test/jake2/render/TestMap.java,v retrieving revision 1.6 retrieving revision 1.6.8.1 diff -C2 -d -r1.6 -r1.6.8.1 *** TestMap.java 14 Dec 2004 01:08:32 -0000 1.6 --- TestMap.java 20 Nov 2006 23:36:24 -0000 1.6.8.1 *************** *** 28,31 **** --- 28,32 ---- import jake2.Defines; import jake2.Globals; + import jake2.Jake2; import jake2.client.*; import jake2.game.Cmd; *************** *** 72,81 **** void init() { ! Qcommon.Init(new String[] { "TestMap $Id$" }); // sehr wichtig !!! VID.Shutdown(); ! this.re = Renderer.getDriver("jogl"); re.Init(0, 0); --- 73,90 ---- void init() { ! Globals.dedicated = Cvar.Get("dedicated", "0", Qcommon.CVAR_NOSET); ! // open the q2dialog, if we are not in dedicated mode. ! if (Globals.dedicated.value != 1.0f) ! { ! Jake2.Q2Dialog = new Q2DataDialog(); ! Locale.setDefault(Locale.US); ! Jake2.Q2Dialog.setVisible(true); ! } ! Qcommon.Init(new String[] { "TestMap $Id$" }); // sehr wichtig !!! VID.Shutdown(); ! Globals.re = this.re = Renderer.getDriver("jsr231", false); re.Init(0, 0); |
From: Carsten W. <ca...@us...> - 2006-11-20 23:16:08
|
Update of /cvsroot/jake2/jake2/test/jake2/render In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv11776/test/jake2/render Modified Files: Tag: render-refactoring DancingQueens.java Log Message: update to run with new APIs Index: DancingQueens.java =================================================================== RCS file: /cvsroot/jake2/jake2/test/jake2/render/DancingQueens.java,v retrieving revision 1.8 retrieving revision 1.8.4.1 diff -C2 -d -r1.8 -r1.8.4.1 *** DancingQueens.java 11 Jun 2005 19:43:48 -0000 1.8 --- DancingQueens.java 20 Nov 2006 23:16:05 -0000 1.8.4.1 *************** *** 28,33 **** --- 28,35 ---- import jake2.Defines; import jake2.Globals; + import jake2.Jake2; import jake2.client.*; import jake2.game.Cmd; + import jake2.game.cvar_t; import jake2.qcommon.*; import jake2.sys.IN; *************** *** 36,39 **** --- 38,42 ---- import java.util.Arrays; + import java.util.Locale; /** *************** *** 66,71 **** void init() { Qcommon.Init(new String[] { "DancingQueens", "+set", "gl_mode", "5", ! "+set", "vid_fullscreen", "0" }); // sehr wichtig !!! VID.Shutdown(); --- 69,83 ---- void init() { + Globals.dedicated = Cvar.Get("dedicated", "0", Qcommon.CVAR_NOSET); + // open the q2dialog, if we are not in dedicated mode. + if (Globals.dedicated.value != 1.0f) + { + Jake2.Q2Dialog = new Q2DataDialog(); + Locale.setDefault(Locale.US); + Jake2.Q2Dialog.setVisible(true); + } + Qcommon.Init(new String[] { "DancingQueens", "+set", "gl_mode", "5", ! "+set", "vid_fullscreen", "0", "+set", "dedicated", "0" }); // sehr wichtig !!! VID.Shutdown(); *************** *** 74,78 **** System.out.println("Registered Drivers: " + Arrays.asList(names)); ! this.re = Renderer.getDriver("fastjogl"); System.out.println("Use driver: " + re); --- 86,90 ---- System.out.println("Registered Drivers: " + Arrays.asList(names)); ! this.re = Renderer.getDriver("jsr231"); System.out.println("Use driver: " + re); |
From: Carsten W. <ca...@us...> - 2006-11-20 23:15:16
|
Update of /cvsroot/jake2/jake2/src/jake2/render In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv11492/src/jake2/render Modified Files: Tag: render-refactoring Renderer.java Ref.java JoglRenderer.java Jsr231Renderer.java LwjglRenderer.java Log Message: the Renderer factory sets the right RenderAPI (fast or basic) for driver impls Index: JoglRenderer.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/Attic/JoglRenderer.java,v retrieving revision 1.6.8.5 retrieving revision 1.6.8.6 diff -C2 -d -r1.6.8.5 -r1.6.8.6 *** JoglRenderer.java 20 Nov 2006 21:27:57 -0000 1.6.8.5 --- JoglRenderer.java 20 Nov 2006 23:15:13 -0000 1.6.8.6 *************** *** 45,52 **** public static final String DRIVER_NAME = "jogl"; ! private KBD kbd = new JOGLKBD(); ! // TODO extract a interface from render code ! private RenderAPI impl = new jake2.render.fast.Misc(); static { --- 45,52 ---- public static final String DRIVER_NAME = "jogl"; ! private KBD kbd = new JOGLKBD(); ! // is set from Renderer factory ! private RenderAPI impl; static { *************** *** 335,340 **** } ! public refexport_t GetRefAPI() { return this; } } \ No newline at end of file --- 335,342 ---- } ! public refexport_t GetRefAPI(RenderAPI renderer) { ! this.impl = renderer; return this; } + } \ No newline at end of file Index: Ref.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/Ref.java,v retrieving revision 1.2 retrieving revision 1.2.12.1 diff -C2 -d -r1.2 -r1.2.12.1 *** Ref.java 16 Jul 2004 10:11:34 -0000 1.2 --- Ref.java 20 Nov 2006 23:15:13 -0000 1.2.12.1 *************** *** 35,42 **** public interface Ref { ! // ============================================================================ ! // extensions (cwei) ! // ============================================================================ ! refexport_t GetRefAPI(); String getName(); } --- 35,39 ---- public interface Ref { ! refexport_t GetRefAPI(RenderAPI renderer); String getName(); } Index: Renderer.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/Renderer.java,v retrieving revision 1.6.6.1 retrieving revision 1.6.6.2 diff -C2 -d -r1.6.6.1 -r1.6.6.2 *** Renderer.java 14 Nov 2005 23:59:00 -0000 1.6.6.1 --- Renderer.java 20 Nov 2006 23:15:13 -0000 1.6.6.2 *************** *** 26,33 **** package jake2.render; - import java.util.Vector; - import jake2.client.refexport_t; /** * Renderer --- 26,33 ---- package jake2.render; import jake2.client.refexport_t; + import java.util.Vector; + /** * Renderer *************** *** 36,39 **** --- 36,42 ---- */ 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); *************** *** 73,81 **** } ! /** * Factory method to get the Renderer implementation. * @return refexport_t (Renderer singleton) */ ! public static refexport_t getDriver(String driverName) { // find a driver Ref driver = null; --- 76,92 ---- } ! /** ! * Factory method to get the Renderer implementation. ! * @return refexport_t (Renderer singleton) ! */ ! public static refexport_t getDriver(String driverName) { ! return getDriver(driverName, true); ! } ! ! /** * 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; *************** *** 84,88 **** driver = (Ref) drivers.get(i); if (driver.getName().equals(driverName)) { ! return driver.GetRefAPI(); } } --- 95,99 ---- driver = (Ref) drivers.get(i); if (driver.getName().equals(driverName)) { ! return driver.GetRefAPI((fast) ? fastRenderer : basicRenderer); } } *************** *** 108,110 **** --- 119,122 ---- return names; } + } \ No newline at end of file Index: LwjglRenderer.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/Attic/LwjglRenderer.java,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** LwjglRenderer.java 20 Nov 2006 21:27:57 -0000 1.1.2.3 --- LwjglRenderer.java 20 Nov 2006 23:15:13 -0000 1.1.2.4 *************** *** 42,51 **** final class LwjglRenderer extends LwjglDriver implements refexport_t, Ref { ! public static final String DRIVER_NAME = "lwjgl"; ! private KBD kbd = new LWJGLKBD(); ! // TODO extract a interface from render code ! private RenderAPI impl = new jake2.render.fast.Misc(); static { --- 42,51 ---- final class LwjglRenderer extends LwjglDriver implements refexport_t, Ref { ! public static final String DRIVER_NAME = "lwjgl"; ! private KBD kbd = new LWJGLKBD(); ! // is set from Renderer factory ! private RenderAPI impl; static { *************** *** 238,242 **** } ! public final refexport_t GetRefAPI() { return this; } --- 238,243 ---- } ! public final refexport_t GetRefAPI(RenderAPI renderer) { ! this.impl = renderer; return this; } Index: Jsr231Renderer.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/Attic/Jsr231Renderer.java,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** Jsr231Renderer.java 20 Nov 2006 21:27:57 -0000 1.1.2.3 --- Jsr231Renderer.java 20 Nov 2006 23:15:13 -0000 1.1.2.4 *************** *** 42,53 **** final class Jsr231Renderer extends Jsr231Driver implements refexport_t, Ref { ! public static final String DRIVER_NAME = "jsr231"; ! private KBD kbd = new JOGLKBD(); ! // TODO extract a interface from render code ! private RenderAPI impl = new jake2.render.fast.Misc(); ! static { Renderer.register(new Jsr231Renderer()); }; --- 42,53 ---- final class Jsr231Renderer extends Jsr231Driver implements refexport_t, Ref { ! public static final String DRIVER_NAME = "jsr231"; ! private KBD kbd = new JOGLKBD(); ! // is set from Renderer factory ! private RenderAPI impl; ! static { Renderer.register(new Jsr231Renderer()); }; *************** *** 242,247 **** } ! public final refexport_t GetRefAPI() { ! return this; } } \ No newline at end of file --- 242,248 ---- } ! public final refexport_t GetRefAPI(RenderAPI renderer) { ! this.impl = renderer; ! return this; } } \ No newline at end of file |
From: Carsten W. <ca...@us...> - 2006-11-20 23:15:16
|
Update of /cvsroot/jake2/jake2/src/jake2/client In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv11492/src/jake2/client Modified Files: Tag: render-refactoring VID.java Log Message: the Renderer factory sets the right RenderAPI (fast or basic) for driver impls Index: VID.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/client/VID.java,v retrieving revision 1.16.4.2 retrieving revision 1.16.4.3 diff -C2 -d -r1.16.4.2 -r1.16.4.3 *** VID.java 25 Dec 2005 18:11:24 -0000 1.16.4.2 --- VID.java 20 Nov 2006 23:15:13 -0000 1.16.4.3 *************** *** 168,172 **** ============== */ ! static boolean LoadRefresh( String name ) { --- 168,172 ---- ============== */ ! static boolean LoadRefresh( String name, boolean fast ) { *************** *** 198,202 **** Com.Printf( "LoadLibrary(\"" + name +"\")\n" ); ! Globals.re = Renderer.getDriver(name); if (Globals.re == null) --- 198,202 ---- Com.Printf( "LoadLibrary(\"" + name +"\")\n" ); ! Globals.re = Renderer.getDriver(name, fast); if (Globals.re == null) *************** *** 257,261 **** ! if ( !LoadRefresh( vid_ref.string ) ) { String renderer; --- 257,261 ---- ! if ( !LoadRefresh( vid_ref.string, true ) ) { String renderer; *************** *** 274,278 **** Com.Printf("Trying mode 0\n"); Cvar.SetValue("gl_mode", 0); ! if ( !LoadRefresh( vid_ref.string ) ) Com.Error(Defines.ERR_FATAL, "Couldn't fall back to " + renderer +" refresh!"); } else --- 274,278 ---- Com.Printf("Trying mode 0\n"); Cvar.SetValue("gl_mode", 0); ! if ( !LoadRefresh( vid_ref.string, false ) ) Com.Error(Defines.ERR_FATAL, "Couldn't fall back to " + renderer +" refresh!"); } else |
From: Carsten W. <ca...@us...> - 2006-11-20 21:30:47
|
Update of /cvsroot/jake2/jake2/src/jake2/render/opengl In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv1721/src/jake2/render/opengl Modified Files: Tag: render-refactoring QGL.java Log Message: sort functions Index: QGL.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/opengl/Attic/QGL.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** QGL.java 14 Nov 2005 23:49:40 -0000 1.1.2.1 --- QGL.java 20 Nov 2006 21:30:42 -0000 1.1.2.2 *************** *** 9,14 **** --- 9,18 ---- */ + void glActiveTextureARB(int texture); + void glAlphaFunc(int func, float ref); + void glArrayElement(int index); + void glBegin(int mode); *************** *** 21,24 **** --- 25,30 ---- void glClearColor(float red, float green, float blue, float alpha); + void glClientActiveTextureARB(int texture); + void glColor3f(float red, float green, float blue); *************** *** 34,37 **** --- 40,46 ---- void glColorPointer(int size, int stride, FloatBuffer pointer); + void glColorTable(int target, int internalFormat, int width, int format, + int type, ByteBuffer data); + void glCullFace(int mode); *************** *** 75,78 **** --- 84,89 ---- void glInterleavedArrays(int format, int stride, FloatBuffer pointer); + void glLockArraysEXT(int first, int count); + void glLoadIdentity(); *************** *** 81,84 **** --- 92,97 ---- void glMatrixMode(int mode); + void glMultiTexCoord2f(int target, float s, float t); + void glOrtho(double left, double right, double bottom, double top, double zNear, double zFar); *************** *** 86,89 **** --- 99,106 ---- void glPixelStorei(int pname, int param); + void glPointParameterEXT(int pname, FloatBuffer pfParams); + + void glPointParameterfEXT(int pname, float param); + void glPointSize(float size); *************** *** 126,129 **** --- 143,148 ---- void glTranslatef(float x, float y, float z); + void glUnlockArraysEXT(); + void glVertex2f(float x, float y); *************** *** 134,155 **** void glViewport(int x, int y, int width, int height); - void glColorTable(int target, int internalFormat, int width, int format, - int type, ByteBuffer data); - - void glActiveTextureARB(int texture); - - void glClientActiveTextureARB(int texture); - - void glPointParameterEXT(int pname, FloatBuffer pfParams); - - void glPointParameterfEXT(int pname, float param); - - void glLockArraysEXT(int first, int count); - - void glArrayElement(int index); - - void glUnlockArraysEXT(); - - void glMultiTexCoord2f(int target, float s, float t); - } \ No newline at end of file --- 153,155 ---- |
From: Carsten W. <ca...@us...> - 2006-11-20 21:29:54
|
Update of /cvsroot/jake2/jake2/src/jake2/render/fastj In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv1243/src/jake2/render/fastj Modified Files: Tag: render-refactoring Warp.java Main.java Image.java Model.java Draw.java Log Message: change to public (RenderAPI) Index: Warp.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastj/Attic/Warp.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** Warp.java 7 Oct 2006 20:02:07 -0000 1.1.2.1 --- Warp.java 20 Nov 2006 21:29:49 -0000 1.1.2.2 *************** *** 624,628 **** String[] suf = { "rt", "bk", "lf", "ft", "up", "dn" }; ! protected void R_SetSky(String name, float rotate, float[] axis) { assert (axis.length == 3) : "vec3_t bug"; int i; --- 624,628 ---- String[] suf = { "rt", "bk", "lf", "ft", "up", "dn" }; ! public void R_SetSky(String name, float rotate, float[] axis) { assert (axis.length == 3) : "vec3_t bug"; int i; Index: Main.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastj/Attic/Main.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** Main.java 7 Oct 2006 20:02:07 -0000 1.1.2.1 --- Main.java 20 Nov 2006 21:29:49 -0000 1.1.2.2 *************** *** 918,922 **** @@@@@@@@@@@@@@@@@@@@@ */ ! protected void R_RenderFrame(refdef_t fd) { R_RenderView(fd); R_SetLightLevel(); --- 918,922 ---- @@@@@@@@@@@@@@@@@@@@@ */ ! public void R_RenderFrame(refdef_t fd) { R_RenderView(fd); R_SetLightLevel(); *************** *** 1075,1079 **** } ! protected boolean R_Init(int vid_xpos, int vid_ypos) { assert(Warp.SIN.length == 256) : "warpsin table bug"; --- 1075,1079 ---- } ! public boolean R_Init(int vid_xpos, int vid_ypos) { assert(Warp.SIN.length == 256) : "warpsin table bug"; *************** *** 1101,1105 **** } ! protected boolean R_Init2() { VID.MenuInit(); --- 1101,1105 ---- } ! public boolean R_Init2() { VID.MenuInit(); *************** *** 1301,1305 **** =============== */ ! protected void R_Shutdown() { Cmd.RemoveCommand("modellist"); Cmd.RemoveCommand("screenshot"); --- 1301,1305 ---- =============== */ ! public void R_Shutdown() { Cmd.RemoveCommand("modellist"); Cmd.RemoveCommand("screenshot"); *************** *** 1322,1326 **** @@@@@@@@@@@@@@@@@@@@@ */ ! protected void R_BeginFrame(float camera_separation) { gl_state.camera_separation = camera_separation; --- 1322,1326 ---- @@@@@@@@@@@@@@@@@@@@@ */ ! public void R_BeginFrame(float camera_separation) { gl_state.camera_separation = camera_separation; *************** *** 1437,1441 **** ============= */ ! protected void R_SetPalette(byte[] palette) { // 256 RGB values (768 bytes) // or null --- 1437,1441 ---- ============= */ ! public void R_SetPalette(byte[] palette) { // 256 RGB values (768 bytes) // or null Index: Image.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastj/Attic/Image.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** Image.java 7 Oct 2006 20:02:07 -0000 1.1.2.1 --- Image.java 20 Nov 2006 21:29:49 -0000 1.1.2.2 *************** *** 1453,1457 **** * R_RegisterSkin */ ! protected image_t R_RegisterSkin(String name) { return GL_FindImage(name, it_skin); } --- 1453,1457 ---- * R_RegisterSkin */ ! public image_t R_RegisterSkin(String name) { return GL_FindImage(name, it_skin); } Index: Draw.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastj/Attic/Draw.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** Draw.java 7 Oct 2006 20:02:07 -0000 1.1.2.1 --- Draw.java 20 Nov 2006 21:29:49 -0000 1.1.2.2 *************** *** 66,70 **** ================ */ ! protected void Draw_Char(int x, int y, int num) { num &= 255; --- 66,70 ---- ================ */ ! public void Draw_Char(int x, int y, int num) { num &= 255; *************** *** 101,105 **** ============= */ ! protected image_t Draw_FindPic(String name) { image_t image = null; String fullname; --- 101,105 ---- ============= */ ! public image_t Draw_FindPic(String name) { image_t image = null; String fullname; *************** *** 121,125 **** ============= */ ! protected void Draw_GetPicSize(Dimension dim, String pic) { image_t image = Draw_FindPic(pic); --- 121,125 ---- ============= */ ! public void Draw_GetPicSize(Dimension dim, String pic) { image_t image = Draw_FindPic(pic); *************** *** 133,137 **** ============= */ ! protected void Draw_StretchPic (int x, int y, int w, int h, String pic) { image_t image; --- 133,137 ---- ============= */ ! public void Draw_StretchPic (int x, int y, int w, int h, String pic) { image_t image; *************** *** 172,176 **** ============= */ ! protected void Draw_Pic(int x, int y, String pic) { image_t image; --- 172,176 ---- ============= */ ! public void Draw_Pic(int x, int y, String pic) { image_t image; *************** *** 213,217 **** ============= */ ! protected void Draw_TileClear(int x, int y, int w, int h, String pic) { image_t image; --- 213,217 ---- ============= */ ! public void Draw_TileClear(int x, int y, int w, int h, String pic) { image_t image; *************** *** 250,254 **** ============= */ ! protected void Draw_Fill(int x, int y, int w, int h, int colorIndex) { if ( colorIndex > 255) --- 250,254 ---- ============= */ ! public void Draw_Fill(int x, int y, int w, int h, int colorIndex) { if ( colorIndex > 255) *************** *** 284,288 **** ================ */ ! protected void Draw_FadeScreen() { gl.glEnable(GL_BLEND); gl.glDisable(GL_TEXTURE_2D); --- 284,288 ---- ================ */ ! public void Draw_FadeScreen() { gl.glEnable(GL_BLEND); gl.glDisable(GL_TEXTURE_2D); *************** *** 311,315 **** ============= */ ! protected void Draw_StretchRaw (int x, int y, int w, int h, int cols, int rows, byte[] data) { int i, j, trows; --- 311,315 ---- ============= */ ! public void Draw_StretchRaw (int x, int y, int w, int h, int cols, int rows, byte[] data) { int i, j, trows; Index: Model.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastj/Attic/Model.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** Model.java 7 Oct 2006 20:02:07 -0000 1.1.2.1 --- Model.java 20 Nov 2006 21:29:49 -0000 1.1.2.2 *************** *** 1083,1087 **** * Specifies the model that will be used as the world @@@@@@@@@@@@@@@@@@@@@ */ ! protected void R_BeginRegistration(String model) { resetModelArrays(); // resetPolygonArrays(); --- 1083,1087 ---- * Specifies the model that will be used as the world @@@@@@@@@@@@@@@@@@@@@ */ ! public void R_BeginRegistration(String model) { resetModelArrays(); // resetPolygonArrays(); *************** *** 1110,1114 **** * @@@@@@@@@@@@@@@@@@@@@ */ ! protected model_t R_RegisterModel(String name) { model_t mod = null; int i; --- 1110,1114 ---- * @@@@@@@@@@@@@@@@@@@@@ */ ! public model_t R_RegisterModel(String name) { model_t mod = null; int i; *************** *** 1146,1150 **** * @@@@@@@@@@@@@@@@@@@@@ */ ! protected void R_EndRegistration() { model_t mod; --- 1146,1150 ---- * @@@@@@@@@@@@@@@@@@@@@ */ ! public void R_EndRegistration() { model_t mod; |
From: Carsten W. <ca...@us...> - 2006-11-20 21:28:00
|
Update of /cvsroot/jake2/jake2/src/jake2/render In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv477/src/jake2/render Modified Files: Tag: render-refactoring JoglRenderer.java Jsr231Renderer.java LwjglRenderer.java Log Message: change to RenderAPI calls Index: JoglRenderer.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/Attic/JoglRenderer.java,v retrieving revision 1.6.8.4 retrieving revision 1.6.8.5 diff -C2 -d -r1.6.8.4 -r1.6.8.5 *** JoglRenderer.java 15 Nov 2005 00:12:40 -0000 1.6.8.4 --- JoglRenderer.java 20 Nov 2006 21:27:57 -0000 1.6.8.5 *************** *** 48,52 **** // TODO extract a interface from render code ! private jake2.render.fast.Misc impl = new jake2.render.fast.Misc(); static { --- 48,52 ---- // TODO extract a interface from render code ! private RenderAPI impl = new jake2.render.fast.Misc(); static { *************** *** 71,75 **** public boolean Init(int vid_xpos, int vid_ypos) { // init the OpenGL drivers ! impl.setGlImpl(this); // pre init if (!impl.R_Init(vid_xpos, vid_ypos)) return false; --- 71,75 ---- public boolean Init(int vid_xpos, int vid_ypos) { // init the OpenGL drivers ! impl.setGLDriver(this); // pre init if (!impl.R_Init(vid_xpos, vid_ypos)) return false; Index: LwjglRenderer.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/Attic/LwjglRenderer.java,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** LwjglRenderer.java 15 Nov 2005 00:12:40 -0000 1.1.2.2 --- LwjglRenderer.java 20 Nov 2006 21:27:57 -0000 1.1.2.3 *************** *** 47,51 **** // TODO extract a interface from render code ! private jake2.render.fast.Misc impl = new jake2.render.fast.Misc(); static { --- 47,51 ---- // TODO extract a interface from render code ! private RenderAPI impl = new jake2.render.fast.Misc(); static { *************** *** 67,71 **** public boolean Init(int vid_xpos, int vid_ypos) { // init the OpenGL drivers ! impl.setGlImpl(this); // pre init --- 67,71 ---- public boolean Init(int vid_xpos, int vid_ypos) { // init the OpenGL drivers ! impl.setGLDriver(this); // pre init Index: Jsr231Renderer.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/Attic/Jsr231Renderer.java,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** Jsr231Renderer.java 15 Nov 2005 00:12:40 -0000 1.1.2.2 --- Jsr231Renderer.java 20 Nov 2006 21:27:57 -0000 1.1.2.3 *************** *** 47,51 **** // TODO extract a interface from render code ! private jake2.render.fast.Misc impl = new jake2.render.fast.Misc(); static { --- 47,51 ---- // TODO extract a interface from render code ! private RenderAPI impl = new jake2.render.fast.Misc(); static { *************** *** 68,72 **** public boolean Init(int vid_xpos, int vid_ypos) { // init the OpenGL drivers ! impl.setGlImpl(this); // pre init if (!impl.R_Init(vid_xpos, vid_ypos)) return false; --- 68,72 ---- public boolean Init(int vid_xpos, int vid_ypos) { // init the OpenGL drivers ! impl.setGLDriver(this); // pre init if (!impl.R_Init(vid_xpos, vid_ypos)) return false; |
From: Carsten W. <ca...@us...> - 2006-11-20 21:26:12
|
Update of /cvsroot/jake2/jake2/src/jake2/render In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv32456/src/jake2/render Modified Files: Tag: render-refactoring Base.java Log Message: implements RenderAPI Index: Base.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/Attic/Base.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** Base.java 14 Nov 2005 23:57:19 -0000 1.1.2.1 --- Base.java 20 Nov 2006 21:26:08 -0000 1.1.2.2 *************** *** 39,43 **** * @author dsanders/cwei */ ! public abstract class Base implements QGLConst { public static final int GL_COLOR_INDEX8_EXT = GL_COLOR_INDEX; --- 39,43 ---- * @author dsanders/cwei */ ! public abstract class Base implements QGLConst, RenderAPI { public static final int GL_COLOR_INDEX8_EXT = GL_COLOR_INDEX; *************** *** 179,183 **** protected GLDriver glImpl; ! public void setGlImpl(GLDriver driver) { glImpl = driver; gl = (QGL)driver; --- 179,183 ---- protected GLDriver glImpl; ! public void setGLDriver(GLDriver driver) { glImpl = driver; gl = (QGL)driver; |
From: Carsten W. <ca...@us...> - 2006-11-20 21:25:32
|
Update of /cvsroot/jake2/jake2/src/jake2/render In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv32079/src/jake2/render Added Files: Tag: render-refactoring RenderAPI.java Log Message: API interface for basic and fast renderer impl --- NEW FILE: RenderAPI.java --- package jake2.render; import jake2.client.refdef_t; import jake2.render.opengl.GLDriver; import java.awt.Dimension; public interface RenderAPI { void setGLDriver(GLDriver impl); boolean R_Init(int vid_xpos, int vid_ypos); boolean R_Init2(); void R_Shutdown(); void R_BeginRegistration(String map); model_t R_RegisterModel(String name); image_t R_RegisterSkin(String name); image_t Draw_FindPic(String name); void R_SetSky(String name, float rotate, float[] axis); void R_EndRegistration(); void R_RenderFrame(refdef_t fd); void Draw_GetPicSize(Dimension dim, String name); void Draw_Pic(int x, int y, String name); void Draw_StretchPic(int x, int y, int w, int h, String name); void Draw_Char(int x, int y, int num); void Draw_TileClear(int x, int y, int w, int h, String name); void Draw_Fill(int x, int y, int w, int h, int c); void Draw_FadeScreen(); void Draw_StretchRaw(int x, int y, int w, int h, int cols, int rows, byte[] data); void R_SetPalette(byte[] palette); void R_BeginFrame(float camera_separation); } |
From: Carsten W. <ca...@us...> - 2006-11-19 19:17:54
|
Update of /cvsroot/jake2/jake2/src/jake2/sound/lwjgl In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv21340/src/jake2/sound/lwjgl Modified Files: Tag: render-refactoring Channel.java Log Message: replace AL_SOURCE_ABSOLUTE (no standard) Index: Channel.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/sound/lwjgl/Channel.java,v retrieving revision 1.6.6.2 retrieving revision 1.6.6.3 diff -C2 -d -r1.6.6.2 -r1.6.6.3 *** Channel.java 19 Nov 2006 19:16:05 -0000 1.6.6.2 --- Channel.java 19 Nov 2006 19:17:50 -0000 1.6.6.3 *************** *** 169,173 **** unqueueStreams(); int source = channels[numChannels].sourceId; ! AL10.alSourcei (source, AL10.AL_SOURCE_ABSOLUTE, AL10.AL_TRUE); // free the last source --- 169,173 ---- unqueueStreams(); int source = channels[numChannels].sourceId; ! AL10.alSourcei (source, AL10.AL_SOURCE_RELATIVE, AL10.AL_FALSE); // free the last source |
From: Carsten W. <ca...@us...> - 2006-11-19 19:16:17
|
Update of /cvsroot/jake2/jake2/src/jake2/sound/lwjgl In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv20793/src/jake2/sound/lwjgl Modified Files: Tag: render-refactoring Channel.java Log Message: replace AL_SOURCE_ABSOLUTE (no standard) Index: Channel.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/sound/lwjgl/Channel.java,v retrieving revision 1.6.6.1 retrieving revision 1.6.6.2 diff -C2 -d -r1.6.6.1 -r1.6.6.2 *** Channel.java 25 Dec 2005 18:16:38 -0000 1.6.6.1 --- Channel.java 19 Nov 2006 19:16:05 -0000 1.6.6.2 *************** *** 124,128 **** AL10.alSourcef (sourceId, AL10.AL_GAIN, 1.0f); AL10.alSourcef (sourceId, AL10.AL_PITCH, 1.0f); ! AL10.alSourcei (sourceId, AL10.AL_SOURCE_ABSOLUTE, AL10.AL_TRUE); AL10.nalSourcefv(sourceId, AL10.AL_VELOCITY, NULLVECTOR, 0); AL10.alSourcei (sourceId, AL10.AL_LOOPING, AL10.AL_FALSE); --- 124,128 ---- AL10.alSourcef (sourceId, AL10.AL_GAIN, 1.0f); AL10.alSourcef (sourceId, AL10.AL_PITCH, 1.0f); ! AL10.alSourcei (sourceId, AL10.AL_SOURCE_RELATIVE, AL10.AL_FALSE); AL10.nalSourcefv(sourceId, AL10.AL_VELOCITY, NULLVECTOR, 0); AL10.alSourcei (sourceId, AL10.AL_LOOPING, AL10.AL_FALSE); |