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-14 20:49:14
|
Update of /cvsroot/jake2/jake2 In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv2791 Modified Files: Jake2.bat Jake2.sh Log Message: use only one of the drivers (jogl/joal or lwjgl) because of library collisions jogl/joal is the default Index: Jake2.bat =================================================================== RCS file: /cvsroot/jake2/jake2/Jake2.bat,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Jake2.bat 24 Oct 2006 23:00:43 -0000 1.2 --- Jake2.bat 14 Nov 2006 20:49:08 -0000 1.3 *************** *** 1,4 **** @echo off ! SET PATH=lib\joal\windows;%PATH% ! SET CP=build;resources;lib/jogl/jogl.jar;lib/joal/joal.jar;lib/lwjgl/lwjgl.jar;lib/lwjgl/lwjgl_util.jar ! java -Xmx100M -Dsun.java2d.noddraw=true -Djava.library.path=lib/jogl/windows;lib/joal/windows;lib/lwjgl/windows -cp %CP% jake2.Jake2 \ No newline at end of file --- 1,10 ---- @echo off ! ! REM for lwjgl ! REM SET LIB=lib/lwjgl/windows ! REM SET CP=build;resources;lib/lwjgl/lwjgl.jar;lib/lwjgl/lwjgl_util.jar ! ! REM for jogl and joal ! SET LIB=lib/jogl/windows;lib/joal/windows ! SET CP=build;resources;lib/jogl/jogl.jar;lib/joal/joal.jar;lib/joal/gluegen-rt.jar; ! java -Xmx100M -Dsun.java2d.noddraw=true -Djava.library.path=%LIB% -cp %CP% jake2.Jake2 \ No newline at end of file Index: Jake2.sh =================================================================== RCS file: /cvsroot/jake2/jake2/Jake2.sh,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Jake2.sh 24 Oct 2006 23:00:43 -0000 1.5 --- Jake2.sh 14 Nov 2006 20:49:08 -0000 1.6 *************** *** 1,10 **** #!/bin/bash - # $Id$ - cd `dirname $0` ! export LD_LIBRARY_PATH=lib/joal/linux:lib/lwjgl/linux ! CP=build:resources:lib/jogl/jogl.jar:lib/joal/joal.jar:lib/lwjgl/lwjgl.jar:lib/lwjgl/lwjgl_util.jar ! exec java -Xmx100M -Djava.library.path=lib/jogl/linux:lib/joal/linux:lib/lwjgl/linux -cp $CP jake2.Jake2 $* --- 1,13 ---- #!/bin/bash cd `dirname $0` ! # for lwjgl ! #LIB=lib/lwjgl/linux ! #CP=build:resources:lib/lwjgl/lwjgl.jar:lib/lwjgl/lwjgl_util.jar ! # for jogl and joal ! LIB=lib/jogl/linux:lib/joal/linux ! CP=build:resources:lib/jogl/jogl.jar:lib/joal/joal.jar:lib/joal/gluegen-rt.jar ! ! exec java -Xmx100M -Djava.library.path=$LIB -cp $CP jake2.Jake2 $* \ No newline at end of file |
From: Rene S. <sa...@us...> - 2006-10-31 14:00:31
|
Update of /cvsroot/jake2/jake2/src/jake2/render/common In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv5804/src/jake2/render/common Modified Files: Surf.java Base.java Model.java Misc.java Warp.java Mesh.java Log Message: imports cleaned up, independence from individual GL implementations Index: Surf.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/common/Surf.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Surf.java 31 Oct 2006 13:06:32 -0000 1.1 --- Surf.java 31 Oct 2006 14:00:23 -0000 1.2 *************** *** 26,46 **** ! import java.nio.*; ! import java.util.Arrays; ! ! import org.lwjgl.opengl.GL11; ! ! import net.java.games.jogl.GL; ! import net.java.games.jogl.util.BufferUtils; ! ! import jake2.*; import jake2.client.*; ! import jake2.game.*; ! import jake2.qcommon.*; import jake2.render.*; - import jake2.render.common.Image.pos_t; - import jake2.server.*; import jake2.util.*; public abstract class Surf extends Draw { --- 26,38 ---- ! import jake2.Defines; import jake2.client.*; ! import jake2.game.cplane_t; ! import jake2.qcommon.Com; import jake2.render.*; import jake2.util.*; + import java.nio.*; + import java.util.Arrays; public abstract class Surf extends Draw { *************** *** 463,467 **** } ! IntBuffer dummy = BufferUtils.newIntBuffer(128 * 128); /** --- 455,459 ---- } ! IntBuffer dummy = newIntBuffer(128 * 128); /** *************** *** 598,602 **** } ! GL_TexEnv(GL.GL_REPLACE); } --- 590,594 ---- } ! GL_TexEnv(ggl.GL_REPLACE); } *************** *** 652,658 **** lmtex = surf.lightmaptexturenum; ! ggl.glTexSubImage2D(GL.GL_TEXTURE_2D, 0, surf.light_s, surf.light_t, smax, tmax, GL_LIGHTMAP_FORMAT, ! GL.GL_UNSIGNED_BYTE, temp); } else { --- 644,650 ---- lmtex = surf.lightmaptexturenum; ! ggl.glTexSubImage2D(ggl.GL_TEXTURE_2D, 0, surf.light_s, surf.light_t, smax, tmax, GL_LIGHTMAP_FORMAT, ! ggl.GL_UNSIGNED_BYTE, temp); } else { *************** *** 666,672 **** lmtex = 0; ! ggl.glTexSubImage2D(GL.GL_TEXTURE_2D, 0, surf.light_s, surf.light_t, smax, tmax, GL_LIGHTMAP_FORMAT, ! GL.GL_UNSIGNED_BYTE, temp); } --- 658,664 ---- lmtex = 0; ! ggl.glTexSubImage2D(ggl.GL_TEXTURE_2D, 0, surf.light_s, surf.light_t, smax, tmax, GL_LIGHTMAP_FORMAT, ! ggl.GL_UNSIGNED_BYTE, temp); } *************** *** 689,698 **** for (p = surf.polys; p != null; p = p.chain) { p.beginScrolling(scroll); ! ggl.glDrawArrays(GL.GL_POLYGON, p.pos, p.numverts); p.endScrolling(); } } else { for (p = surf.polys; p != null; p = p.chain) { ! ggl.glDrawArrays(GL.GL_POLYGON, p.pos, p.numverts); } } --- 681,690 ---- for (p = surf.polys; p != null; p = p.chain) { p.beginScrolling(scroll); ! ggl.glDrawArrays(ggl.GL_POLYGON, p.pos, p.numverts); p.endScrolling(); } } else { for (p = surf.polys; p != null; p = p.chain) { ! ggl.glDrawArrays(ggl.GL_POLYGON, p.pos, p.numverts); } } *************** *** 717,721 **** for (p = surf.polys; p != null; p = p.chain) { p.beginScrolling(scroll); ! ggl.glDrawArrays(GL.GL_POLYGON, p.pos, p.numverts); p.endScrolling(); } --- 709,713 ---- for (p = surf.polys; p != null; p = p.chain) { p.beginScrolling(scroll); ! ggl.glDrawArrays(ggl.GL_POLYGON, p.pos, p.numverts); p.endScrolling(); } *************** *** 724,728 **** // ========== for (p = surf.polys; p != null; p = p.chain) { ! ggl.glDrawArrays(GL.GL_POLYGON, p.pos, p.numverts); } --- 716,720 ---- // ========== for (p = surf.polys; p != null; p = p.chain) { ! ggl.glDrawArrays(ggl.GL_POLYGON, p.pos, p.numverts); } Index: Mesh.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/common/Mesh.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Mesh.java 31 Oct 2006 13:06:32 -0000 1.1 --- Mesh.java 31 Oct 2006 14:00:23 -0000 1.2 *************** *** 20,23 **** --- 20,24 ---- // Created on 25.08.2006 by RST. + // $Id$ *************** *** 36,42 **** import java.nio.IntBuffer; - import net.java.games.joal.util.BufferUtils; - - public abstract class Mesh extends Light { --- 37,40 ---- *************** *** 58,68 **** // bounding box ! protected 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 } }; /* ! * ================== R_InitParticleTexture ================== ! */ protected byte[][] dottexture = { { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, 1, 0, 0, 0, 0 }, { 0, 1, 1, 1, 1, 0, 0, 0 }, --- 56,70 ---- // bounding box ! protected 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 } ! }; /* ! ================== ! R_InitParticleTexture ! ================== ! */ protected byte[][] dottexture = { { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, 1, 0, 0, 0, 0 }, { 0, 1, 1, 1, 1, 0, 0, 0 }, *************** *** 141,147 **** } ! protected FloatBuffer colorArrayBuf = BufferUtils.newFloatBuffer(qfiles.MAX_VERTS * 4); ! protected FloatBuffer vertexArrayBuf = BufferUtils.newFloatBuffer(qfiles.MAX_VERTS * 3); ! protected FloatBuffer textureArrayBuf = BufferUtils.newFloatBuffer(qfiles.MAX_VERTS * 2); protected boolean isFilled = false; --- 143,149 ---- } ! protected FloatBuffer colorArrayBuf = newFloatBuffer(qfiles.MAX_VERTS * 4); ! protected FloatBuffer vertexArrayBuf = newFloatBuffer(qfiles.MAX_VERTS * 3); ! protected FloatBuffer textureArrayBuf = newFloatBuffer(qfiles.MAX_VERTS * 2); protected boolean isFilled = false; *************** *** 461,467 **** /* ! * ================= R_DrawAliasModel ! * ! * ================= */ // TODO sync with jogl renderer. hoz --- 463,470 ---- /* ! ================= ! R_DrawAliasModel ! ! ================= */ // TODO sync with jogl renderer. hoz Index: Model.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/common/Model.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Model.java 31 Oct 2006 13:06:32 -0000 1.1 --- Model.java 31 Oct 2006 14:00:23 -0000 1.2 *************** *** 39,44 **** import java.util.Vector; - import net.java.games.jogl.util.BufferUtils; - /** * model loading and caching. --- 39,42 ---- *************** *** 1182,1189 **** protected static FloatBuffer globalModelTextureCoordBuf = ! BufferUtils.newFloatBuffer(MODEL_BUFFER_SIZE * 2); protected static IntBuffer globalModelVertexIndexBuf = ! BufferUtils.newIntBuffer(MODEL_BUFFER_SIZE); protected void precompileGLCmds(qfiles.dmdl_t model) { --- 1180,1187 ---- protected static FloatBuffer globalModelTextureCoordBuf = ! newFloatBuffer(MODEL_BUFFER_SIZE * 2); protected static IntBuffer globalModelVertexIndexBuf = ! newIntBuffer(MODEL_BUFFER_SIZE); protected void precompileGLCmds(qfiles.dmdl_t model) { Index: Warp.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/common/Warp.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Warp.java 31 Oct 2006 13:06:32 -0000 1.1 --- Warp.java 31 Oct 2006 14:00:23 -0000 1.2 *************** *** 24,29 **** package jake2.render.common; - - import net.java.games.jogl.GL; import jake2.Defines; import jake2.Globals; --- 24,27 ---- *************** *** 665,669 **** GL_Bind(sky_images[skytexorder[i]].texnum); ! ggl.glBegin(GL.GL_QUADS); MakeSkyVec(skymins[0][i], skymins[1][i], i); MakeSkyVec(skymins[0][i], skymaxs[1][i], i); --- 663,667 ---- GL_Bind(sky_images[skytexorder[i]].texnum); ! ggl.glBegin(ggl.GL_QUADS); MakeSkyVec(skymins[0][i], skymins[1][i], i); MakeSkyVec(skymins[0][i], skymaxs[1][i], i); Index: Base.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/common/Base.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Base.java 31 Oct 2006 13:06:32 -0000 1.1 --- Base.java 31 Oct 2006 14:00:23 -0000 1.2 *************** *** 24,32 **** package jake2.render.common; public class Base { public static GenericGL ggl; ! // to be initialized! protected int GL_TEXTURE0 = -1; protected int GL_TEXTURE1 = -1; --- 24,34 ---- package jake2.render.common; + import java.nio.*; + public class Base { public static GenericGL ggl; ! // to be initialized protected int GL_TEXTURE0 = -1; protected int GL_TEXTURE1 = -1; *************** *** 34,38 **** public static final String REF_VERSION = "GL 0.01"; - // up / down public static final int PITCH = 0; --- 36,39 ---- *************** *** 95,97 **** --- 96,154 ---- public static final int GL_RENDERER_OTHER = 0x80000000; + // to unify BufferUtils. + + public static final int SIZEOF_BYTE = 1; + public static final int SIZEOF_SHORT = 2; + public static final int SIZEOF_INT = 4; + public static final int SIZEOF_FLOAT = 4; + public static final int SIZEOF_LONG = 8; + public static final int SIZEOF_DOUBLE = 8; + + // ---------------------------------------------------------------------- + // Allocation routines + // + + /** + * Allocates a new direct ByteBuffer with the specified number of elements. + * The returned buffer will have its byte order set to the host platform's + * native byte order. + */ + public static ByteBuffer newByteBuffer(int numElements) { + ByteBuffer bb = ByteBuffer.allocateDirect(numElements); + bb.order(ByteOrder.nativeOrder()); + return bb; + } + + /** Allocates a new direct DoubleBuffer with the specified number of + elements. The returned buffer will have its byte order set to + the host platform's native byte order. */ + public static DoubleBuffer newDoubleBuffer(int numElements) { + ByteBuffer bb = newByteBuffer(numElements * SIZEOF_DOUBLE); + return bb.asDoubleBuffer(); + } + + /** Allocates a new direct FloatBuffer with the specified number of + elements. The returned buffer will have its byte order set to + the host platform's native byte order. */ + public static FloatBuffer newFloatBuffer(int numElements) { + ByteBuffer bb = newByteBuffer(numElements * SIZEOF_FLOAT); + return bb.asFloatBuffer(); + } + + /** Allocates a new direct IntBuffer with the specified number of + elements. The returned buffer will have its byte order set to + the host platform's native byte order. */ + public static IntBuffer newIntBuffer(int numElements) { + ByteBuffer bb = newByteBuffer(numElements * SIZEOF_INT); + return bb.asIntBuffer(); + } + + /** Allocates a new direct LongBuffer with the specified number of + elements. The returned buffer will have its byte order set to + the host platform's native byte order. */ + public static LongBuffer newLongBuffer(int numElements) { + ByteBuffer bb = newByteBuffer(numElements * SIZEOF_LONG); + return bb.asLongBuffer(); + } + } Index: Misc.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/common/Misc.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Misc.java 31 Oct 2006 13:06:32 -0000 1.1 --- Misc.java 31 Oct 2006 14:00:23 -0000 1.2 *************** *** 25,34 **** ! import jake2.*; ! import jake2.client.*; ! import jake2.game.*; ! import jake2.qcommon.*; ! import jake2.render.*; ! import jake2.server.*; --- 25,30 ---- ! import jake2.Defines; ! import jake2.client.VID; |
From: Rene S. <sa...@us...> - 2006-10-31 13:06:40
|
Update of /cvsroot/jake2/jake2/src/jake2/render In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv15592/src/jake2/render Modified Files: JoglBase.java Removed Files: JoglRenderer.java Log Message: major refactoring of the render module --- JoglRenderer.java DELETED --- Index: JoglBase.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/JoglBase.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** JoglBase.java 26 Jun 2005 08:51:19 -0000 1.15 --- JoglBase.java 31 Oct 2006 13:06:32 -0000 1.16 *************** *** 33,36 **** --- 33,38 ---- import jake2.qcommon.Cbuf; import jake2.qcommon.xcommand_t; + import jake2.render.common.Model; + import jake2.render.fastjogl.GLWrapJogl; import jake2.sys.JOGLKBD; *************** *** 49,53 **** * JoglCommon */ ! public abstract class JoglBase implements GLEventListener { // IMPORTED FUNCTIONS --- 51,56 ---- * JoglCommon */ ! public abstract class JoglBase extends jake2.render.common.Misc ! implements GLEventListener { // IMPORTED FUNCTIONS *************** *** 61,67 **** protected GLUT glut = new GLUT(); ! // window position on the screen ! int window_xpos, window_ypos; ! protected viddef_t vid = new viddef_t(); // handles the post initialization with JoglRenderer --- 64,68 ---- protected GLUT glut = new GLUT(); ! // handles the post initialization with JoglRenderer *************** *** 88,99 **** }; protected xcommand_t callback = INIT_CALLBACK; - - protected cvar_t vid_fullscreen; - - // enum rserr_t - protected static final int rserr_ok = 0; - protected static final int rserr_invalid_fullscreen = 1; - protected static final int rserr_invalid_mode = 2; - protected static final int rserr_unknown = 3; public DisplayMode[] getModeList() { --- 89,92 ---- *************** *** 329,332 **** --- 322,329 ---- } + protected void GLimp_Finish() { + gl.glFinish(); + } + /* * @see jake2.client.refexport_t#updateScreen() *************** *** 350,355 **** public void init(GLDrawable drawable) { this.gl = drawable.getGL(); this.glu = drawable.getGLU(); ! // this is a hack to run R_init() in gl context post_init = R_Init2(); --- 347,353 ---- public void init(GLDrawable drawable) { this.gl = drawable.getGL(); + ggl = new GLWrapJogl (this.gl); this.glu = drawable.getGLU(); ! // this is a hack to run R_init() in gl context post_init = R_Init2(); |
From: Rene S. <sa...@us...> - 2006-10-31 13:06:39
|
Update of /cvsroot/jake2/jake2/src/jake2/render/common In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv15592/src/jake2/render/common Added Files: Polygon.java Misc.java Surf.java Base.java Model.java Warp.java Anorms.java Draw.java Mesh.java Main.java GenericGL.java Image.java Light.java Log Message: major refactoring of the render module --- NEW FILE: Base.java --- /* 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. */ // Created on 19.08.2006 by RST. // $Id: Base.java,v 1.1 2006/10/31 13:06:32 salomo Exp $ package jake2.render.common; public class Base { public static GenericGL ggl; // to be initialized! protected int GL_TEXTURE0 = -1; protected int GL_TEXTURE1 = -1; protected int GL_COLOR_INDEX8_EXT = ggl.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; // 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; } --- NEW FILE: Image.java --- /* 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. */ [...1184 lines suppressed...] protected void Scrap_Upload() { scrap_uploads++; GL_Bind(TEXNUM_SCRAPS); GL_Upload8(scrap_texels[0], BLOCK_WIDTH, BLOCK_HEIGHT, false, false); scrap_dirty = false; } protected void GL_MBind(int target, int texnum) { GL_SelectTexture(target); if (target == GL_TEXTURE0) { if (gl_state.currenttextures[0] == texnum) return; } else { if (gl_state.currenttextures[1] == texnum) return; } GL_Bind(texnum); } } --- NEW FILE: Surf.java --- /* 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. */ [...1173 lines suppressed...] if (!LM_AllocBlock(smax, tmax, lightPos)) { Com.Error(Defines.ERR_FATAL, "Consecutive calls to LM_AllocBlock(" + smax + "," + tmax + ") failed\n"); } } // kopiere die koordinaten zurueck surf.light_s = lightPos.x; surf.light_t = lightPos.y; surf.lightmaptexturenum = gl_lms.current_lightmap_texture; base = gl_lms.lightmap_buffer; base.position(surf.light_t * LM_BLOCK_WIDTH + surf.light_s); R_SetCacheState(surf); R_BuildLightMap(surf, base.slice(), LM_BLOCK_WIDTH); } } --- NEW FILE: GenericGL.java --- /* 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. */ // Created on 28.10.2006 by RST. // $Id: GenericGL.java,v 1.1 2006/10/31 13:06:32 salomo Exp $ package jake2.render.common; import java.nio.*; /** * This is a class for wrapping lwjgl and jogl GL methods. * It is not known if it performs well, but jit should know what we'Re doing. */ public interface GenericGL { public static final int GL_2_BYTES = 5127; public static final int GL_2D = 1536; public static final int GL_3_BYTES = 5128; public static final int GL_3D = 1537; public static final int GL_3D_COLOR = 1538; public static final int GL_3D_COLOR_TEXTURE = 1539; public static final int GL_4_BYTES = 5129; public static final int GL_4D_COLOR_TEXTURE = 1540; public static final int GL_ACCUM = 256; public static final int GL_ACCUM_ALPHA_BITS = 3419; public static final int GL_ACCUM_BLUE_BITS = 3418; public static final int GL_ACCUM_BUFFER_BIT = 512; public static final int GL_ACCUM_CLEAR_VALUE = 2944; public static final int GL_ACCUM_GREEN_BITS = 3417; public static final int GL_ACCUM_RED_BITS = 3416; public static final int GL_ADD = 260; public static final int GL_ALL_ATTRIB_BITS = 0xfffff; public static final int GL_ALL_CLIENT_ATTRIB_BITS = -1; public static final int GL_ALPHA = 6406; public static final int GL_ALPHA_BIAS = 3357; public static final int GL_ALPHA_BITS = 3413; public static final int GL_ALPHA_SCALE = 3356; public static final int GL_ALPHA_TEST = 3008; public static final int GL_ALPHA_TEST_FUNC = 3009; public static final int GL_ALPHA_TEST_REF = 3010; public static final int GL_ALPHA12 = 32829; public static final int GL_ALPHA16 = 32830; public static final int GL_ALPHA4 = 32827; public static final int GL_ALPHA8 = 32828; public static final int GL_ALWAYS = 519; public static final int GL_AMBIENT = 4608; public static final int GL_AMBIENT_AND_DIFFUSE = 5634; public static final int GL_AND = 5377; public static final int GL_AND_INVERTED = 5380; public static final int GL_AND_REVERSE = 5378; public static final int GL_ATTRIB_STACK_DEPTH = 2992; public static final int GL_AUTO_NORMAL = 3456; public static final int GL_AUX_BUFFERS = 3072; public static final int GL_AUX0 = 1033; public static final int GL_AUX1 = 1034; public static final int GL_AUX2 = 1035; public static final int GL_AUX3 = 1036; public static final int GL_BACK = 1029; public static final int GL_BACK_LEFT = 1026; public static final int GL_BACK_RIGHT = 1027; public static final int GL_BITMAP = 6656; public static final int GL_BITMAP_TOKEN = 1796; public static final int GL_BLEND = 3042; public static final int GL_BLEND_DST = 3040; public static final int GL_BLEND_SRC = 3041; public static final int GL_BLUE = 6405; public static final int GL_BLUE_BIAS = 3355; public static final int GL_BLUE_BITS = 3412; public static final int GL_BLUE_SCALE = 3354; public static final int GL_BYTE = 5120; public static final int GL_C3F_V3F = 10788; public static final int GL_C4F_N3F_V3F = 10790; public static final int GL_C4UB_V2F = 10786; public static final int GL_C4UB_V3F = 10787; public static final int GL_CCW = 2305; public static final int GL_CLAMP = 10496; public static final int GL_CLEAR = 5376; public static final int GL_CLIENT_ATTRIB_STACK_DEPTH = 2993; public static final int GL_CLIENT_PIXEL_STORE_BIT = 1; public static final int GL_CLIENT_VERTEX_ARRAY_BIT = 2; public static final int GL_CLIP_PLANE0 = 12288; public static final int GL_CLIP_PLANE1 = 12289; public static final int GL_CLIP_PLANE2 = 12290; public static final int GL_CLIP_PLANE3 = 12291; public static final int GL_CLIP_PLANE4 = 12292; public static final int GL_CLIP_PLANE5 = 12293; public static final int GL_COEFF = 2560; public static final int GL_COLOR = 6144; public static final int GL_COLOR_ARRAY = 32886; public static final int GL_COLOR_ARRAY_POINTER = 32912; public static final int GL_COLOR_ARRAY_SIZE = 32897; public static final int GL_COLOR_ARRAY_STRIDE = 32899; public static final int GL_COLOR_ARRAY_TYPE = 32898; public static final int GL_COLOR_BUFFER_BIT = 16384; public static final int GL_COLOR_CLEAR_VALUE = 3106; public static final int GL_COLOR_INDEX = 6400; public static final int GL_COLOR_INDEXES = 5635; public static final int GL_COLOR_LOGIC_OP = 3058; public static final int GL_COLOR_MATERIAL = 2903; public static final int GL_COLOR_MATERIAL_FACE = 2901; public static final int GL_COLOR_MATERIAL_PARAMETER = 2902; public static final int GL_COLOR_WRITEMASK = 3107; public static final int GL_COMPILE = 4864; public static final int GL_COMPILE_AND_EXECUTE = 4865; public static final int GL_CONSTANT_ALPHA = 32771; public static final int GL_CONSTANT_ATTENUATION = 4615; public static final int GL_CONSTANT_COLOR = 32769; public static final int GL_COPY = 5379; public static final int GL_COPY_INVERTED = 5388; public static final int GL_COPY_PIXEL_TOKEN = 1798; public static final int GL_CULL_FACE = 2884; public static final int GL_CULL_FACE_MODE = 2885; public static final int GL_CURRENT_BIT = 1; public static final int GL_CURRENT_COLOR = 2816; public static final int GL_CURRENT_INDEX = 2817; public static final int GL_CURRENT_NORMAL = 2818; public static final int GL_CURRENT_RASTER_COLOR = 2820; public static final int GL_CURRENT_RASTER_DISTANCE = 2825; public static final int GL_CURRENT_RASTER_INDEX = 2821; public static final int GL_CURRENT_RASTER_POSITION = 2823; public static final int GL_CURRENT_RASTER_POSITION_VALID = 2824; public static final int GL_CURRENT_RASTER_TEXTURE_COORDS = 2822; public static final int GL_CURRENT_TEXTURE_COORDS = 2819; public static final int GL_CW = 2304; public static final int GL_DECAL = 8449; public static final int GL_DECR = 7683; public static final int GL_DEPTH = 6145; public static final int GL_DEPTH_BIAS = 3359; public static final int GL_DEPTH_BITS = 3414; public static final int GL_DEPTH_BUFFER_BIT = 256; public static final int GL_DEPTH_CLEAR_VALUE = 2931; public static final int GL_DEPTH_COMPONENT = 6402; public static final int GL_DEPTH_FUNC = 2932; public static final int GL_DEPTH_RANGE = 2928; public static final int GL_DEPTH_SCALE = 3358; public static final int GL_DEPTH_TEST = 2929; public static final int GL_DEPTH_WRITEMASK = 2930; public static final int GL_DIFFUSE = 4609; public static final int GL_DITHER = 3024; public static final int GL_DOMAIN = 2562; public static final int GL_DONT_CARE = 4352; public static final int GL_DOUBLE = 5130; public static final int GL_DOUBLEBUFFER = 3122; public static final int GL_DRAW_BUFFER = 3073; public static final int GL_DRAW_PIXEL_TOKEN = 1797; public static final int GL_DST_ALPHA = 772; public static final int GL_DST_COLOR = 774; public static final int GL_EDGE_FLAG = 2883; public static final int GL_EDGE_FLAG_ARRAY = 32889; public static final int GL_EDGE_FLAG_ARRAY_POINTER = 32915; public static final int GL_EDGE_FLAG_ARRAY_STRIDE = 32908; public static final int GL_EMISSION = 5632; public static final int GL_ENABLE_BIT = 8192; public static final int GL_EQUAL = 514; public static final int GL_EQUIV = 5385; public static final int GL_EVAL_BIT = 0x10000; public static final int GL_EXP = 2048; public static final int GL_EXP2 = 2049; public static final int GL_EXTENSIONS = 7939; public static final int GL_EYE_LINEAR = 9216; public static final int GL_EYE_PLANE = 9474; public static final int GL_FALSE = 0; public static final int GL_FASTEST = 4353; public static final int GL_FEEDBACK = 7169; public static final int GL_FEEDBACK_BUFFER_POINTER = 3568; public static final int GL_FEEDBACK_BUFFER_SIZE = 3569; public static final int GL_FEEDBACK_BUFFER_TYPE = 3570; public static final int GL_FILL = 6914; public static final int GL_FLAT = 7424; public static final int GL_FLOAT = 5126; public static final int GL_FOG = 2912; public static final int GL_FOG_BIT = 128; public static final int GL_FOG_COLOR = 2918; public static final int GL_FOG_DENSITY = 2914; public static final int GL_FOG_END = 2916; public static final int GL_FOG_HINT = 3156; public static final int GL_FOG_INDEX = 2913; public static final int GL_FOG_MODE = 2917; public static final int GL_FOG_START = 2915; public static final int GL_FRONT = 1028; public static final int GL_FRONT_AND_BACK = 1032; public static final int GL_FRONT_FACE = 2886; public static final int GL_FRONT_LEFT = 1024; public static final int GL_FRONT_RIGHT = 1025; public static final int GL_GEQUAL = 518; public static final int GL_GREATER = 516; public static final int GL_GREEN = 6404; public static final int GL_GREEN_BIAS = 3353; public static final int GL_GREEN_BITS = 3411; public static final int GL_GREEN_SCALE = 3352; public static final int GL_HINT_BIT = 32768; public static final int GL_INCR = 7682; public static final int GL_INDEX_ARRAY = 32887; public static final int GL_INDEX_ARRAY_POINTER = 32913; public static final int GL_INDEX_ARRAY_STRIDE = 32902; public static final int GL_INDEX_ARRAY_TYPE = 32901; public static final int GL_INDEX_BITS = 3409; public static final int GL_INDEX_CLEAR_VALUE = 3104; public static final int GL_INDEX_LOGIC_OP = 3057; public static final int GL_INDEX_MODE = 3120; public static final int GL_INDEX_OFFSET = 3347; public static final int GL_INDEX_SHIFT = 3346; public static final int GL_INDEX_WRITEMASK = 3105; public static final int GL_INT = 5124; public static final int GL_INTENSITY = 32841; public static final int GL_INTENSITY12 = 32844; public static final int GL_INTENSITY16 = 32845; public static final int GL_INTENSITY4 = 32842; public static final int GL_INTENSITY8 = 32843; public static final int GL_INVALID_ENUM = 1280; public static final int GL_INVALID_OPERATION = 1282; public static final int GL_INVALID_VALUE = 1281; public static final int GL_INVERT = 5386; public static final int GL_KEEP = 7680; public static final int GL_LEFT = 1030; public static final int GL_LEQUAL = 515; public static final int GL_LESS = 513; public static final int GL_LIGHT_MODEL_AMBIENT = 2899; public static final int GL_LIGHT_MODEL_LOCAL_VIEWER = 2897; public static final int GL_LIGHT_MODEL_TWO_SIDE = 2898; public static final int GL_LIGHT0 = 16384; public static final int GL_LIGHT1 = 16385; public static final int GL_LIGHT2 = 16386; public static final int GL_LIGHT3 = 16387; public static final int GL_LIGHT4 = 16388; public static final int GL_LIGHT5 = 16389; public static final int GL_LIGHT6 = 16390; public static final int GL_LIGHT7 = 16391; public static final int GL_LIGHTING = 2896; public static final int GL_LIGHTING_BIT = 64; public static final int GL_LINE = 6913; public static final int GL_LINE_BIT = 4; public static final int GL_LINE_LOOP = 2; public static final int GL_LINE_RESET_TOKEN = 1799; public static final int GL_LINE_SMOOTH = 2848; public static final int GL_LINE_SMOOTH_HINT = 3154; public static final int GL_LINE_STIPPLE = 2852; public static final int GL_LINE_STIPPLE_PATTERN = 2853; public static final int GL_LINE_STIPPLE_REPEAT = 2854; public static final int GL_LINE_STRIP = 3; public static final int GL_LINE_TOKEN = 1794; public static final int GL_LINE_WIDTH = 2849; public static final int GL_LINE_WIDTH_GRANULARITY = 2851; public static final int GL_LINE_WIDTH_RANGE = 2850; public static final int GL_LINEAR = 9729; public static final int GL_LINEAR_ATTENUATION = 4616; public static final int GL_LINEAR_MIPMAP_LINEAR = 9987; public static final int GL_LINEAR_MIPMAP_NEAREST = 9985; public static final int GL_LINES = 1; public static final int GL_LIST_BASE = 2866; public static final int GL_LIST_BIT = 0x20000; public static final int GL_LIST_INDEX = 2867; public static final int GL_LIST_MODE = 2864; public static final int GL_LOAD = 257; public static final int GL_LOGIC_OP = 3057; public static final int GL_LOGIC_OP_MODE = 3056; public static final int GL_LUMINANCE = 6409; public static final int GL_LUMINANCE_ALPHA = 6410; public static final int GL_LUMINANCE12 = 32833; public static final int GL_LUMINANCE12_ALPHA12 = 32839; public static final int GL_LUMINANCE12_ALPHA4 = 32838; public static final int GL_LUMINANCE16 = 32834; public static final int GL_LUMINANCE16_ALPHA16 = 32840; public static final int GL_LUMINANCE4 = 32831; public static final int GL_LUMINANCE4_ALPHA4 = 32835; public static final int GL_LUMINANCE6_ALPHA2 = 32836; public static final int GL_LUMINANCE8 = 32832; public static final int GL_LUMINANCE8_ALPHA8 = 32837; public static final int GL_MAP_COLOR = 3344; public static final int GL_MAP_STENCIL = 3345; public static final int GL_MAP1_COLOR_4 = 3472; public static final int GL_MAP1_GRID_DOMAIN = 3536; public static final int GL_MAP1_GRID_SEGMENTS = 3537; public static final int GL_MAP1_INDEX = 3473; public static final int GL_MAP1_NORMAL = 3474; public static final int GL_MAP1_TEXTURE_COORD_1 = 3475; public static final int GL_MAP1_TEXTURE_COORD_2 = 3476; public static final int GL_MAP1_TEXTURE_COORD_3 = 3477; public static final int GL_MAP1_TEXTURE_COORD_4 = 3478; public static final int GL_MAP1_VERTEX_3 = 3479; public static final int GL_MAP1_VERTEX_4 = 3480; public static final int GL_MAP2_COLOR_4 = 3504; public static final int GL_MAP2_GRID_DOMAIN = 3538; public static final int GL_MAP2_GRID_SEGMENTS = 3539; public static final int GL_MAP2_INDEX = 3505; public static final int GL_MAP2_NORMAL = 3506; public static final int GL_MAP2_TEXTURE_COORD_1 = 3507; public static final int GL_MAP2_TEXTURE_COORD_2 = 3508; public static final int GL_MAP2_TEXTURE_COORD_3 = 3509; public static final int GL_MAP2_TEXTURE_COORD_4 = 3510; public static final int GL_MAP2_VERTEX_3 = 3511; public static final int GL_MAP2_VERTEX_4 = 3512; public static final int GL_MATRIX_MODE = 2976; public static final int GL_MAX_ATTRIB_STACK_DEPTH = 3381; public static final int GL_MAX_CLIENT_ATTRIB_STACK_DEPTH = 3387; public static final int GL_MAX_CLIP_PLANES = 3378; public static final int GL_MAX_EVAL_ORDER = 3376; public static final int GL_MAX_LIGHTS = 3377; public static final int GL_MAX_LIST_NESTING = 2865; public static final int GL_MAX_MODELVIEW_STACK_DEPTH = 3382; public static final int GL_MAX_NAME_STACK_DEPTH = 3383; public static final int GL_MAX_PIXEL_MAP_TABLE = 3380; public static final int GL_MAX_PROJECTION_STACK_DEPTH = 3384; public static final int GL_MAX_TEXTURE_SIZE = 3379; public static final int GL_MAX_TEXTURE_STACK_DEPTH = 3385; public static final int GL_MAX_VIEWPORT_DIMS = 3386; public static final int GL_MODELVIEW = 5888; public static final int GL_MODELVIEW_MATRIX = 2982; public static final int GL_MODELVIEW_STACK_DEPTH = 2979; public static final int GL_MODULATE = 8448; public static final int GL_MULT = 259; public static final int GL_N3F_V3F = 10789; public static final int GL_NAME_STACK_DEPTH = 3440; public static final int GL_NAND = 5390; public static final int GL_NEAREST = 9728; public static final int GL_NEAREST_MIPMAP_LINEAR = 9986; public static final int GL_NEAREST_MIPMAP_NEAREST = 9984; public static final int GL_NEVER = 512; public static final int GL_NICEST = 4354; public static final int GL_NO_ERROR = 0; public static final int GL_NONE = 0; public static final int GL_NOOP = 5381; public static final int GL_NOR = 5384; public static final int GL_NORMAL_ARRAY = 32885; public static final int GL_NORMAL_ARRAY_POINTER = 32911; public static final int GL_NORMAL_ARRAY_STRIDE = 32895; public static final int GL_NORMAL_ARRAY_TYPE = 32894; public static final int GL_NORMALIZE = 2977; public static final int GL_NOTEQUAL = 517; public static final int GL_OBJECT_LINEAR = 9217; public static final int GL_OBJECT_PLANE = 9473; public static final int GL_ONE = 1; public static final int GL_ONE_MINUS_CONSTANT_ALPHA = 32772; public static final int GL_ONE_MINUS_CONSTANT_COLOR = 32770; public static final int GL_ONE_MINUS_DST_ALPHA = 773; public static final int GL_ONE_MINUS_DST_COLOR = 775; public static final int GL_ONE_MINUS_SRC_ALPHA = 771; public static final int GL_ONE_MINUS_SRC_COLOR = 769; public static final int GL_OR = 5383; public static final int GL_OR_INVERTED = 5389; public static final int GL_OR_REVERSE = 5387; public static final int GL_ORDER = 2561; public static final int GL_OUT_OF_MEMORY = 1285; public static final int GL_PACK_ALIGNMENT = 3333; public static final int GL_PACK_LSB_FIRST = 3329; public static final int GL_PACK_ROW_LENGTH = 3330; public static final int GL_PACK_SKIP_PIXELS = 3332; public static final int GL_PACK_SKIP_ROWS = 3331; public static final int GL_PACK_SWAP_BYTES = 3328; public static final int GL_PASS_THROUGH_TOKEN = 1792; public static final int GL_PERSPECTIVE_CORRECTION_HINT = 3152; public static final int GL_PIXEL_MAP_A_TO_A = 3193; public static final int GL_PIXEL_MAP_A_TO_A_SIZE = 3257; public static final int GL_PIXEL_MAP_B_TO_B = 3192; public static final int GL_PIXEL_MAP_B_TO_B_SIZE = 3256; public static final int GL_PIXEL_MAP_G_TO_G = 3191; public static final int GL_PIXEL_MAP_G_TO_G_SIZE = 3255; public static final int GL_PIXEL_MAP_I_TO_A = 3189; public static final int GL_PIXEL_MAP_I_TO_A_SIZE = 3253; public static final int GL_PIXEL_MAP_I_TO_B = 3188; public static final int GL_PIXEL_MAP_I_TO_B_SIZE = 3252; public static final int GL_PIXEL_MAP_I_TO_G = 3187; public static final int GL_PIXEL_MAP_I_TO_G_SIZE = 3251; public static final int GL_PIXEL_MAP_I_TO_I = 3184; public static final int GL_PIXEL_MAP_I_TO_I_SIZE = 3248; public static final int GL_PIXEL_MAP_I_TO_R = 3186; public static final int GL_PIXEL_MAP_I_TO_R_SIZE = 3250; public static final int GL_PIXEL_MAP_R_TO_R = 3190; public static final int GL_PIXEL_MAP_R_TO_R_SIZE = 3254; public static final int GL_PIXEL_MAP_S_TO_S = 3185; public static final int GL_PIXEL_MAP_S_TO_S_SIZE = 3249; public static final int GL_PIXEL_MODE_BIT = 32; public static final int GL_POINT = 6912; public static final int GL_POINT_BIT = 2; public static final int GL_POINT_SIZE = 2833; public static final int GL_POINT_SIZE_GRANULARITY = 2835; public static final int GL_POINT_SIZE_RANGE = 2834; public static final int GL_POINT_SMOOTH = 2832; public static final int GL_POINT_SMOOTH_HINT = 3153; public static final int GL_POINT_TOKEN = 1793; public static final int GL_POINTS = 0; public static final int GL_POLYGON = 9; public static final int GL_POLYGON_BIT = 8; public static final int GL_POLYGON_MODE = 2880; public static final int GL_POLYGON_OFFSET_FACTOR = 32824; public static final int GL_POLYGON_OFFSET_FILL = 32823; public static final int GL_POLYGON_OFFSET_LINE = 10754; public static final int GL_POLYGON_OFFSET_POINT = 10753; public static final int GL_POLYGON_OFFSET_UNITS = 10752; public static final int GL_POLYGON_SMOOTH = 2881; public static final int GL_POLYGON_SMOOTH_HINT = 3155; public static final int GL_POLYGON_STIPPLE = 2882; public static final int GL_POLYGON_STIPPLE_BIT = 16; public static final int GL_POLYGON_TOKEN = 1795; public static final int GL_POSITION = 4611; public static final int GL_PROJECTION = 5889; public static final int GL_PROJECTION_MATRIX = 2983; public static final int GL_PROJECTION_STACK_DEPTH = 2980; public static final int GL_PROXY_TEXTURE_1D = 32867; public static final int GL_PROXY_TEXTURE_2D = 32868; public static final int GL_Q = 8195; public static final int GL_QUAD_STRIP = 8; public static final int GL_QUADRATIC_ATTENUATION = 4617; public static final int GL_QUADS = 7; public static final int GL_R = 8194; public static final int GL_R3_G3_B2 = 10768; public static final int GL_READ_BUFFER = 3074; public static final int GL_RED = 6403; public static final int GL_RED_BIAS = 3349; public static final int GL_RED_BITS = 3410; public static final int GL_RED_SCALE = 3348; public static final int GL_RENDER = 7168; public static final int GL_RENDER_MODE = 3136; public static final int GL_RENDERER = 7937; public static final int GL_REPEAT = 10497; public static final int GL_REPLACE = 7681; public static final int GL_RETURN = 258; public static final int GL_RGB = 6407; public static final int GL_RGB10 = 32850; public static final int GL_RGB10_A2 = 32857; public static final int GL_RGB12 = 32851; public static final int GL_RGB16 = 32852; public static final int GL_RGB4 = 32847; public static final int GL_RGB5 = 32848; public static final int GL_RGB5_A1 = 32855; public static final int GL_RGB8 = 32849; public static final int GL_RGBA = 6408; public static final int GL_RGBA_MODE = 3121; public static final int GL_RGBA12 = 32858; public static final int GL_RGBA16 = 32859; public static final int GL_RGBA2 = 32853; public static final int GL_RGBA4 = 32854; public static final int GL_RGBA8 = 32856; public static final int GL_RIGHT = 1031; public static final int GL_S = 8192; public static final int GL_SCISSOR_BIT = 0x80000; public static final int GL_SCISSOR_BOX = 3088; public static final int GL_SCISSOR_TEST = 3089; public static final int GL_SELECT = 7170; public static final int GL_SELECTION_BUFFER_POINTER = 3571; public static final int GL_SELECTION_BUFFER_SIZE = 3572; public static final int GL_SET = 5391; public static final int GL_SHADE_MODEL = 2900; public static final int GL_SHININESS = 5633; public static final int GL_SHORT = 5122; public static final int GL_SMOOTH = 7425; public static final int GL_SPECULAR = 4610; public static final int GL_SPHERE_MAP = 9218; public static final int GL_SPOT_CUTOFF = 4614; public static final int GL_SPOT_DIRECTION = 4612; public static final int GL_SPOT_EXPONENT = 4613; public static final int GL_SRC_ALPHA = 770; public static final int GL_SRC_ALPHA_SATURATE = 776; public static final int GL_SRC_COLOR = 768; public static final int GL_STACK_OVERFLOW = 1283; public static final int GL_STACK_UNDERFLOW = 1284; public static final int GL_STENCIL = 6146; public static final int GL_STENCIL_BITS = 3415; public static final int GL_STENCIL_BUFFER_BIT = 1024; public static final int GL_STENCIL_CLEAR_VALUE = 2961; public static final int GL_STENCIL_FAIL = 2964; public static final int GL_STENCIL_FUNC = 2962; public static final int GL_STENCIL_INDEX = 6401; public static final int GL_STENCIL_PASS_DEPTH_FAIL = 2965; public static final int GL_STENCIL_PASS_DEPTH_PASS = 2966; public static final int GL_STENCIL_REF = 2967; public static final int GL_STENCIL_TEST = 2960; public static final int GL_STENCIL_VALUE_MASK = 2963; public static final int GL_STENCIL_WRITEMASK = 2968; public static final int GL_STEREO = 3123; public static final int GL_SUBPIXEL_BITS = 3408; public static final int GL_T = 8193; public static final int GL_T2F_C3F_V3F = 10794; public static final int GL_T2F_C4F_N3F_V3F = 10796; public static final int GL_T2F_C4UB_V3F = 10793; public static final int GL_T2F_N3F_V3F = 10795; public static final int GL_T2F_V3F = 10791; public static final int GL_T4F_C4F_N3F_V4F = 10797; public static final int GL_T4F_V4F = 10792; public static final int GL_TEXTURE = 5890; public static final int GL_TEXTURE_1D = 3552; public static final int GL_TEXTURE_2D = 3553; public static final int GL_TEXTURE_ALPHA_SIZE = 32863; public static final int GL_TEXTURE_BINDING_1D = 32872; public static final int GL_TEXTURE_BINDING_2D = 32873; public static final int GL_TEXTURE_BIT = 0x40000; public static final int GL_TEXTURE_BLUE_SIZE = 32862; public static final int GL_TEXTURE_BORDER = 4101; public static final int GL_TEXTURE_BORDER_COLOR = 4100; public static final int GL_TEXTURE_COMPONENTS = 4099; public static final int GL_TEXTURE_COORD_ARRAY = 32888; public static final int GL_TEXTURE_COORD_ARRAY_POINTER = 32914; public static final int GL_TEXTURE_COORD_ARRAY_SIZE = 32904; public static final int GL_TEXTURE_COORD_ARRAY_STRIDE = 32906; public static final int GL_TEXTURE_COORD_ARRAY_TYPE = 32905; public static final int GL_TEXTURE_ENV = 8960; public static final int GL_TEXTURE_ENV_COLOR = 8705; public static final int GL_TEXTURE_ENV_MODE = 8704; public static final int GL_TEXTURE_GEN_MODE = 9472; public static final int GL_TEXTURE_GEN_Q = 3171; public static final int GL_TEXTURE_GEN_R = 3170; public static final int GL_TEXTURE_GEN_S = 3168; public static final int GL_TEXTURE_GEN_T = 3169; public static final int GL_TEXTURE_GREEN_SIZE = 32861; public static final int GL_TEXTURE_HEIGHT = 4097; public static final int GL_TEXTURE_INTENSITY_SIZE = 32865; public static final int GL_TEXTURE_INTERNAL_FORMAT = 4099; public static final int GL_TEXTURE_LUMINANCE_SIZE = 32864; public static final int GL_TEXTURE_MAG_FILTER = 10240; public static final int GL_TEXTURE_MATRIX = 2984; public static final int GL_TEXTURE_MIN_FILTER = 10241; public static final int GL_TEXTURE_PRIORITY = 32870; public static final int GL_TEXTURE_RED_SIZE = 32860; public static final int GL_TEXTURE_RESIDENT = 32871; public static final int GL_TEXTURE_STACK_DEPTH = 2981; public static final int GL_TEXTURE_WIDTH = 4096; public static final int GL_TEXTURE_WRAP_S = 10242; public static final int GL_TEXTURE_WRAP_T = 10243; public static final int GL_TRANSFORM_BIT = 4096; public static final int GL_TRIANGLE_FAN = 6; public static final int GL_TRIANGLE_STRIP = 5; public static final int GL_TRIANGLES = 4; public static final int GL_TRUE = 1; public static final int GL_UNPACK_ALIGNMENT = 3317; public static final int GL_UNPACK_LSB_FIRST = 3313; public static final int GL_UNPACK_ROW_LENGTH = 3314; public static final int GL_UNPACK_SKIP_PIXELS = 3316; public static final int GL_UNPACK_SKIP_ROWS = 3315; public static final int GL_UNPACK_SWAP_BYTES = 3312; public static final int GL_UNSIGNED_BYTE = 5121; public static final int GL_UNSIGNED_INT = 5125; public static final int GL_UNSIGNED_SHORT = 5123; public static final int GL_V2F = 10784; public static final int GL_V3F = 10785; public static final int GL_VENDOR = 7936; public static final int GL_VERSION = 7938; public static final int GL_VERTEX_ARRAY = 32884; public static final int GL_VERTEX_ARRAY_POINTER = 32910; public static final int GL_VERTEX_ARRAY_SIZE = 32890; public static final int GL_VERTEX_ARRAY_STRIDE = 32892; public static final int GL_VERTEX_ARRAY_TYPE = 32891; public static final int GL_VIEWPORT = 2978; public static final int GL_VIEWPORT_BIT = 2048; public static final int GL_XOR = 5382; public static final int GL_ZERO = 0; public static final int GL_ZOOM_X = 3350; public static final int GL_ZOOM_Y = 3351; void glActiveTextureARB(int texture); void glBegin(int gl_triangle_fan2); void glBindTexture(int gl_texture_2d2, int texnum); void glBlendFunc(int gl_src_alpha2, int gl_one_minus_src_alpha2); void glClear(int gl_color_buffer_bit2); void glClearColor(float f, float g, float h, float i); void glClientActiveTextureARB(int texture); void glColor3f(float f, float g, float h); void glColor3ub(byte b, byte c, byte d); void glColor4f(float intens, float intens2, float intens3, float f); void glColor4f(int i, int j, int k, float f); void glColor4ub(byte b, byte c, byte d, byte e); void glColorPointer(int i, int gl_float2, int j, FloatBuffer colorArrayBuf); void glColorPointer(int i, int gl_unsigned_byte2, int j, ByteBuffer bb); void glCullFace(int gl_back2); void glDepthFunc(int gl_lequal2); void glDepthMask(boolean b); void glDepthRange(float gldepthmin, double d); void glDisable(int gl_texture_2d2); void glDisableClientState(int gl_color_array2); void glDrawArrays(int gl_polygon2, int pos, int numverts); void glDrawElements(int mode, int count, int gl_unsigned_int2, IntBuffer srcIndexBuf); void glEnable(int gl_alpha_test2); void glEnableClientState(int gl_color_array2); void glEnd(); void glFrustum(double xmin, double xmax, double ymin, double ymax, double near, double far); void glInterleavedArrays(int gl_t2f_v3f2, int byte_stride, FloatBuffer globalPolygonInterleavedBuf); void glLoadIdentity(); void glLoadMatrixf(float[] r_world_matrix); void glMatrixMode(int gl_projection2); void glOrtho(int i, int width, int height, int j, int k, int l); void glPointSize(float value); void glPopMatrix(); void glPushMatrix(); void glRotatef(float f, float g, float h, float i); void glScalef(int i, int j, int k); void glShadeModel(int gl_smooth2); void glTexCoord2f(float s, float t); void glTexCoordPointer(int i, int gl_float2, int j, FloatBuffer textureArrayBuf); void glTexEnvi(int gl_texture_env2, int gl_texture_env_mode2, int mode); void glTexImage2D(int gl_texture_2d2, int i, int gl_color_index8_ext, int j, int k, int l, int gl_color_index2, int gl_unsigned_byte2, ByteBuffer image8); void glTexImage2D(int gl_texture_2d2, int i, int gl_tex_solid_format, int j, int k, int l, int gl_rgba3, int gl_unsigned_byte2, IntBuffer image32); void glTexParameterf(int gl_texture_2d, int gl_texture_min_filter, int gl_nearest); void glTexParameteri(int gl_texture_2d2, int gl_texture_min_filter2, int gl_filter_min); void glTexSubImage2D(int gl_texture_2d2, int i, int j, int k, int lm_block_width, int height, int gl_lightmap_format, int gl_unsigned_byte2, IntBuffer lightmap_buffer); void glTranslatef(float f, float g, float h); void glVertex2f(int x, int i); void glVertex3f(float f, float g, float h); void glVertexPointer(int i, int gl_float2, int j, FloatBuffer vertexArrayBuf); void glViewport(int i, int j, int width, int height); } --- NEW FILE: Light.java --- /* 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. */ // Created on 20.08.2006 by RST. // $Id: Light.java,v 1.1 2006/10/31 13:06:32 salomo Exp $ package jake2.render.common; import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.util.Arrays; import jake2.*; import jake2.client.*; import jake2.game.*; import jake2.qcommon.*; import jake2.render.*; import jake2.server.*; import jake2.util.Math3D; import jake2.util.Vec3Cache; public abstract class Light extends Warp { protected float[] pointcolor = { 0, 0, 0 }; // vec3_t protected cplane_t lightplane; // used as shadow plane protected float[] lightspot = { 0, 0, 0 }; // vec3_t protected float[] s_blocklights = new float[34 * 34 * 3]; protected int r_dlightframecount; protected final float[] impact = { 0, 0, 0 }; public static final int DLIGHT_CUTOFF = 64; /** * R_AddDynamicLights */ protected 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]; } } } } } // replaces the goto jump private Throwable gotoStore = new Throwable(); /** * R_BuildLightMap * * Combine and scale multiple lightmaps into the floating format in * blocklights */ protected 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) { for (i = 0; i < size * 3; i++) s_blocklights[i] = 255; // 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; 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) { // dest.position(destp); 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) { // dest.position(destp); 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); } } } } // stack variable private final float[] end = { 0, 0, 0 }; /** * R_LightPoint */ protected 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); } /** * RecursiveLightPoint * * @param node * @param start * @param end * @return */ protected 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; } /** * R_MarkLights */ protected 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_SetCacheState */ protected 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; } } /** * R_PushDlights */ protected 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]); } } /* * ============================================================================= * * DYNAMIC LIGHTS BLEND RENDERING * * ============================================================================= */ void R_RenderDlight(dlight_t light) { float rad = light.intensity * 0.35f; float[] v = Vec3Cache.get(); Math3D.VectorSubtract(light.origin, r_origin, v); ggl.glBegin(ggl.GL_TRIANGLE_FAN); ggl.glColor3f(light.color[0] * 0.2f, light.color[1] * 0.2f, light.color[2] * 0.2f); for (int i = 0; i < 3; i++) v[i] = light.origin[i] - vpn[i] * rad; ggl.glVertex3f(v[0], v[1], v[2]); ggl.glColor3f(0, 0, 0); float a; for (int i = 16; i >= 0; i--) { a = (float) (i / 16.0f * Math.PI * 2); for (int j = 0; j < 3; j++) v[j] = (float) (light.origin[j] + vright[j] * Math.cos(a) * rad + vup[j] * Math.sin(a) * rad); ggl.glVertex3f(v[0], v[1], v[2]); } ggl.glEnd(); Vec3Cache.release(); } /** * ============= R_RenderDlights ============= */ public void R_RenderDlights() { if (gl_flashblend.value == 0) return; r_dlightframecount = r_framecount + 1; // because the count hasn't // advanced yet for this frame ggl.glDepthMask(false); ggl.glDisable(ggl.GL_TEXTURE_2D); ggl.glShadeModel(ggl.GL_SMOOTH); ggl.glDisable(ggl.GL_BLEND); ggl.glBlendFunc(ggl.GL_ONE, ggl.GL_ONE); for (int i = 0; i < r_newrefdef.num_dlights; i++) { R_RenderDlight(r_newrefdef.dlights[i]); } ggl.glColor3f(1, 1, 1); ggl.glDisable(ggl.GL_BLEND); ggl.glDisable(ggl.GL_TEXTURE_2D); ggl.glBlendFunc(ggl.GL_SRC_ALPHA, ggl.GL_ONE_MINUS_SRC_ALPHA); ggl.glDepthMask(true); } } --- NEW FILE: Mesh.java --- /* 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. */ // Created on 25.08.2006 by RST. // $Id: Mesh.java,v 1.1 2006/10/31 13:06:32 salomo Exp $ package jake2.render.common; import jake2.Defines; import jake2.client.VID; import jake2.client.entity_t; import jake2.qcommon.qfiles; import jake2.render.image_t; import jake2.util.Math3D; import jake2.util.Vec3Cache; import java.nio.FloatBuffer; import java.nio.IntBuffer; import net.java.games.joal.util.BufferUtils; public abstract class Mesh extends Light { protected static final int NUMVERTEXNORMALS = 162; protected float[][] r_avertexnormals = Anorms.VERTEXNORMALS; protected float[] shadevector = { 0, 0, 0 }; protected float[] shadelight = { 0, 0, 0 }; // precalculated dot products for quantized angles protected static final int SHADEDOT_QUANT = 16; protected float[][] r_avertexnormal_dots = Anorms.VERTEXNORMAL_DOTS; protected float[] shadedots = r_avertexnormal_dots[0]; // bounding box protected 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 } }; /* * ================== R_InitParticleTexture ================== */ protected byte[][] dottexture = { { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, 1, 0, 0, 0, 0 }, { 0, 1, 1, 1, 1, 0, 0, 0 }, { 0, 1, 1, 1, 1, 0, 0, 0 }, { 0, 0, 1, 1, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 }, }; protected void R_InitParticleTexture() { int x, y; byte[] data = new byte[8 * 8 * 4]; // // particle texture // for (x = 0; x < 8; x++) { for (y = 0; y < 8; y++) { data[y * 32 + x * 4 + 0] = (byte) 255; data[y * 32 + x * 4 + 1] = (byte) 255; data[y * 32 + x * 4 + 2] = (byte) 255; data[y * 32 + x * 4 + 3] = (byte) (dottexture[x][y] * 255); } } r_particletexture = GL_LoadPic("***particle***", data, 8, 8, Base.it_sprite, 32); // // also use this for bad textures, but without alpha // for (x = 0; x < 8; x++) { for (y = 0; y < 8; y++) { data[y * 32 + x * 4 + 0] = (byte) (dottexture[x & 3][y & 3] * 255); data[y * 32 + x * 4 + 1] = 0; // dottexture[x&3][y&3]*255; data[y * 32 + x * 4 + 2] = 0; // dottexture[x&3][y&3]*255; data[y * 32 + x * 4 + 3] = (byte) 255; } } r_notexture = GL_LoadPic("***r_notexture***", data, 8, 8, Base.it_wall, 32); } /** * GL_LerpVerts */ protected 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) * fro... [truncated message content] |
From: Rene S. <sa...@us...> - 2006-10-31 13:06:38
|
Update of /cvsroot/jake2/jake2/src/jake2/render/jogl In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv15592/src/jake2/render/jogl Removed Files: Polygon.java Base.java Anorms.java Image.java Warp.java Light.java Main.java Model.java Surf.java Draw.java Misc.java Mesh.java Log Message: major refactoring of the render module --- Base.java DELETED --- --- Image.java DELETED --- --- Surf.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: Rene S. <sa...@us...> - 2006-10-31 13:06:37
|
Update of /cvsroot/jake2/jake2/src/jake2/render/lwjgl In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv15592/src/jake2/render/lwjgl Modified Files: Main.java Misc.java LWJGLBase.java Image.java Added Files: GLWrapLWJGL.java Removed Files: Base.java Draw.java Surf.java Model.java Anorms.java Light.java Warp.java Mesh.java Polygon.java Log Message: major refactoring of the render module --- Base.java DELETED --- Index: Image.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/lwjgl/Image.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Image.java 7 May 2005 17:31:37 -0000 1.3 --- Image.java 31 Oct 2006 13:06:33 -0000 1.4 *************** *** 6,27 **** */ /* ! Copyright (C) 1997-2001 Id Software, Inc. ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! This program is distributed in the hope that it will be useful, [...1813 lines suppressed...] ! /** ! * GL_ShutdownImages. ! */ ! protected 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 // TODO jogl bug texnumBuffer.clear(); ! texnumBuffer.put(0, image.texnum); gl.glDeleteTextures(texnumBuffer); ! image.clear(); } } } --- Surf.java DELETED --- --- Light.java DELETED --- --- NEW FILE: GLWrapLWJGL.java --- /* 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. */ // Created on 28.10.2006 by RST. // $Id: GLWrapLWJGL.java,v 1.1 2006/10/31 13:06:33 salomo Exp $ package jake2.render.lwjgl; import java.nio.*; import org.lwjgl.opengl.GL11; import org.lwjgl.util.GLImpl; import net.java.games.jogl.GL; import jake2.*; import jake2.client.*; import jake2.game.*; import jake2.qcommon.*; import jake2.render.*; import jake2.render.common.GenericGL; import jake2.server.*; import net.java.games.jogl.*; public class GLWrapLWJGL implements GenericGL{ protected GLImpl gl; public GLWrapLWJGL(GLImpl gl) { this.gl = gl; } public final void glTexParameterf(int gl_texture_2d, int gl_texture_min_filter, int gl_nearest) { gl.glTexParameterf(gl_texture_2d, gl_texture_min_filter, gl_nearest); } public final void glBegin(int gl_triangle_fan2) { gl.glBegin(gl_triangle_fan2); } public final void glTexCoord2f(float s, float t) { gl.glTexCoord2f(s, t); } public final void glVertex3f(float f, float g, float h) { gl.glVertex3f(f, g, h); } public final void glEnd() { gl.glEnd(); } public final void glPushMatrix() { gl.glPushMatrix(); } public final void glTranslatef(float f, float g, float h) { gl.glTranslatef(f, g, h); } public final void glRotatef(float f, float g, float h, float i) { gl.glRotatef(f, g, h, i); } public final void glPopMatrix() { gl.glPopMatrix(); } public final void glColor3f(float f, float g, float h) { gl.glColor3f(f, g, h); } public final void glDepthMask(boolean b) { gl.glDepthMask(b); } public final void glDisable(int gl_texture_2d2) { gl.glDisable(gl_texture_2d2); } public final void glBlendFunc(int gl_src_alpha2, int gl_one_minus_src_alpha2) { gl.glBlendFunc(gl_src_alpha2, gl_one_minus_src_alpha2); } public final void glShadeModel(int gl_smooth2) { gl.glShadeModel(gl_smooth2); } public final void glDrawArrays(int gl_polygon2, int pos, int numverts) { gl.glDrawArrays(gl_polygon2, pos, numverts); } public final void glBindTexture(int gl_texture_2d2, int texnum) { gl.glBindTexture(gl_texture_2d2, texnum); } public final void glActiveTextureARB(int texture) { gl.glActiveTextureARB( texture); } public final void glClientActiveTextureARB(int texture) { gl.glClientActiveTextureARB(texture); } public final void glTexEnvi(int gl_texture_env2, int gl_texture_env_mode2, int mode) { gl.glTexEnvi(gl_texture_env2, gl_texture_env_mode2, mode); } public final void glVertex2f(int x, int y) { gl.glVertex2f(x, y); } public final void glEnable(int gl_alpha_test2) { gl.glEnable(gl_alpha_test2); } public final void glColor3ub(byte b, byte c, byte d) { gl.glColor3ub(b, c, d); } public final void glColor4f(int i, int j, int k, float f) { gl.glColor4f(i, j, k, f); } public final void glTexImage2D(int gl_texture_2d2, int i, int gl_tex_solid_format, int j, int k, int l, int gl_rgba3, int gl_unsigned_byte2, IntBuffer image32) { gl.glTexImage2D(gl_texture_2d2, i, gl_tex_solid_format, j, k, l, gl_rgba3, gl_unsigned_byte2, image32); } public final void glTexImage2D(int gl_texture_2d2, int i, int gl_color_index8_ext, int j, int k, int l, int gl_color_index2, int gl_unsigned_byte2, ByteBuffer image8) { gl.glTexImage2D(gl_texture_2d2, i, gl_color_index8_ext, j, k, l, gl_color_index2, gl_unsigned_byte2, image8); } public final void glColor4ub(byte b, byte c, byte d, byte e) { gl.glColor4ub(b, c, d, e); } public final void glTexParameteri(int gl_texture_2d2, int gl_texture_min_filter2, int gl_filter_min) { gl.glTexParameteri(gl_texture_2d2, gl_texture_min_filter2, gl_filter_min); } public final void glTexSubImage2D(int gl_texture_2d2, int i, int j, int k, int lm_block_width, int height, int gl_lightmap_format, int gl_unsigned_byte2, IntBuffer lightmap_buffer) { gl.glTexSubImage2D(gl_texture_2d2, i, j, k, lm_block_width, height, gl_lightmap_format, gl_unsigned_byte2, lightmap_buffer); } public final void glColor4f(float intens, float intens2, float intens3, float f) { gl.glColor4f(intens, intens2, intens3, f); } public final void glLoadMatrixf(float[] r_world_matrix) { gl.glLoadMatrix(FloatBuffer.wrap(r_world_matrix)); } public final void glInterleavedArrays(int gl_t2f_v3f2, int byte_stride, FloatBuffer globalPolygonInterleavedBuf) { gl.glInterleavedArrays(gl_t2f_v3f2, byte_stride, globalPolygonInterleavedBuf); } public void glDrawElements(int mode, int count, int gl_unsigned_int2, IntBuffer srcIndexBuf) { gl.glDrawElements(mode, srcIndexBuf); } public void glDisableClientState(int gl_color_array2) { gl.glDisableClientState(gl_color_array2); } public void glVertexPointer(int i, int gl_float2, int j, FloatBuffer vertexArrayBuf) { gl.glVertexPointer(i, j, vertexArrayBuf); } public void glEnableClientState(int gl_color_array2) { gl.glEnableClientState(gl_color_array2); } public void glColorPointer(int i, int gl_float2, int j, FloatBuffer colorArrayBuf) { gl.glColorPointer(i, j, colorArrayBuf); } public final void glTexCoordPointer(int i, int gl_float2, int j, FloatBuffer textureArrayBuf) { gl.glTexCoordPointer(i, j, textureArrayBuf); } public final void glDepthRange(float gldepthmin, double d) { gl.glDepthRange(gldepthmin, d); } public final void glMatrixMode(int gl_projection2) { gl.glMatrixMode(gl_projection2); } public final void glLoadIdentity() { gl.glLoadIdentity(); } public final void glScalef(int i, int j, int k) { gl.glScalef(i, j, k); } public final void glCullFace(int gl_back2) { gl.glCullFace(gl_back2); } public final void glClear(int gl_color_buffer_bit2) { gl.glClear(gl_color_buffer_bit2); } public final void glDepthFunc(int gl_lequal2) { gl.glDepthFunc(gl_lequal2); } public final void glFrustum(double xmin, double xmax, double ymin, double ymax, double near, double far) { gl.glFrustum(xmin, xmax, ymin, ymax, near, far); } public final void glViewport(int i, int j, int width, int height) { gl.glViewport(i, j, width, height); } public final void glOrtho(int i, int width, int height, int j, int k, int l) { gl.glOrtho(i, width, height, j, k, l); } public void glColorPointer(int i, int gl_unsigned_byte2, int j, ByteBuffer bb) { gl.glColorPointer(i, true, j, bb); } public void glPointSize(float value) { gl.glPointSize(value); } public void glClearColor(float f, float g, float h, float i) { gl.glClearColor(f, g, h, i); } } --- Mesh.java DELETED --- --- Model.java DELETED --- Index: Main.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/lwjgl/Main.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Main.java 7 May 2005 18:23:25 -0000 1.7 --- Main.java 31 Oct 2006 13:06:32 -0000 1.8 *************** *** 28,47 **** import jake2.Defines; import jake2.Globals; ! import jake2.client.VID; ! import jake2.client.entity_t; ! import jake2.client.particle_t; ! import jake2.client.refdef_t; ! import jake2.game.Cmd; ! import jake2.game.cplane_t; ! import jake2.game.cvar_t; ! import jake2.qcommon.Com; [...1372 lines suppressed...] - - 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(GL11.GL_TEXTURE_2D); - gl.glDisable(GL11.GL_BLEND); - gl.glDepthMask(true); - } } \ No newline at end of file --- 470,472 ---- --- Polygon.java DELETED --- Index: LWJGLBase.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/lwjgl/LWJGLBase.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** LWJGLBase.java 26 Oct 2006 22:02:56 -0000 1.3 --- LWJGLBase.java 31 Oct 2006 13:06:33 -0000 1.4 *************** *** 37,42 **** import org.lwjgl.LWJGLException; ! import org.lwjgl.opengl.Display; ! import org.lwjgl.opengl.DisplayMode; import org.lwjgl.util.GLImpl; --- 37,41 ---- import org.lwjgl.LWJGLException; ! import org.lwjgl.opengl.*; import org.lwjgl.util.GLImpl; *************** *** 46,70 **** * @author dsanders/cwei */ ! public abstract class LWJGLBase { // IMPORTED FUNCTIONS protected DisplayMode oldDisplayMode; protected GLImpl gl = new GLImpl(); - - // window position on the screen - int window_xpos, window_ypos; - protected viddef_t vid = new viddef_t(); // handles the post initialization with LWJGLRenderer protected abstract boolean R_Init2(); - - protected cvar_t vid_fullscreen; ! // enum rserr_t ! protected static final int rserr_ok = 0; ! protected static final int rserr_invalid_fullscreen = 1; ! protected static final int rserr_invalid_mode = 2; ! protected static final int rserr_unknown = 3; ! private java.awt.DisplayMode toAwtDisplayMode(DisplayMode m) { --- 45,59 ---- * @author dsanders/cwei */ ! public abstract class LWJGLBase extends jake2.render.common.Misc { ! // IMPORTED FUNCTIONS protected DisplayMode oldDisplayMode; protected GLImpl gl = new GLImpl(); // handles the post initialization with LWJGLRenderer protected abstract boolean R_Init2(); ! private java.awt.DisplayMode toAwtDisplayMode(DisplayMode m) { *************** *** 328,331 **** --- 317,324 ---- } + protected void GLimp_Finish() { + gl.glFinish(); + } + /** * this is a hack for jogl renderers. --- Warp.java DELETED --- --- Anorms.java DELETED --- --- Draw.java DELETED --- Index: Misc.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/lwjgl/Misc.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Misc.java 11 May 2005 21:45:02 -0000 1.8 --- Misc.java 31 Oct 2006 13:06:32 -0000 1.9 *************** *** 6,27 **** */ /* ! Copyright (C) 1997-2001 Id Software, Inc. ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ! See the GNU General Public License for more details. ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ package jake2.render.lwjgl; --- 6,27 ---- */ /* ! Copyright (C) 1997-2001 Id Software, Inc. ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ! See the GNU General Public License for more details. ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ package jake2.render.lwjgl; *************** *** 42,214 **** /** * Misc ! * * @author cwei */ ! public abstract class Misc extends Mesh { /* ! ================== ! R_InitParticleTexture ! ================== ! */ ! byte[][] dottexture = ! { ! {0,0,0,0,0,0,0,0}, ! {0,0,1,1,0,0,0,0}, ! {0,1,1,1,1,0,0,0}, ! {0,1,1,1,1,0,0,0}, ! {0,0,1,1,0,0,0,0}, ! {0,0,0,0,0,0,0,0}, ! {0,0,0,0,0,0,0,0}, ! {0,0,0,0,0,0,0,0}, ! }; ! void R_InitParticleTexture() ! { ! int x,y; ! byte[] data = new byte[8 * 8 * 4]; ! // ! // particle texture ! // ! for (x=0 ; x<8 ; x++) ! { ! for (y=0 ; y<8 ; y++) ! { ! data[y * 32 + x * 4 + 0] = (byte)255; ! data[y * 32 + x * 4 + 1] = (byte)255; ! data[y * 32 + x * 4 + 2] = (byte)255; ! data[y * 32 + x * 4 + 3] = (byte)(dottexture[x][y]*255); } - } - r_particletexture = GL_LoadPic("***particle***", data, 8, 8, it_sprite, 32); ! // ! // also use this for bad textures, but without alpha ! // ! for (x=0 ; x<8 ; x++) ! { ! for (y=0 ; y<8 ; y++) ! { ! data[y * 32 + x * 4 + 0] = (byte)(dottexture[x&3][y&3]*255); ! data[y * 32 + x * 4 + 1] = 0; // dottexture[x&3][y&3]*255; ! data[y * 32 + x * 4 + 2] = 0; //dottexture[x&3][y&3]*255; ! data[y * 32 + x * 4 + 3] = (byte)255; } } - r_notexture = GL_LoadPic("***r_notexture***", data, 8, 8, it_wall, 32); - } - - // /* - // ============================================================================== - // - // SCREEN SHOTS - // - // ============================================================================== - // */ - // - // typedef struct _TargaHeader { - // unsigned char id_length, colormap_type, image_type; - // unsigned short colormap_index, colormap_length; - // unsigned char colormap_size; - // unsigned short x_origin, y_origin, width, height; - // unsigned char pixel_size, attributes; - // } TargaHeader; - - private final static int TGA_HEADER_SIZE = 18; - - /* - ================== - GL_ScreenShot_f - ================== - */ - void GL_ScreenShot_f() { - StringBuffer sb = new StringBuffer(FS.Gamedir() + "/scrshot/jake00.tga"); - FS.CreatePath(sb.toString()); - File file = new File(sb.toString()); - // find a valid file name - int i = 0; int offset = sb.length() - 6; - while (file.exists() && i++ < 100) { - sb.setCharAt(offset, (char) ((i/10) + '0')); - sb.setCharAt(offset + 1, (char) ((i%10) + '0')); - file = new File(sb.toString()); - } - if (i == 100) { - VID.Printf(Defines.PRINT_ALL, "Clean up your screenshots\n"); - return; - } - - try { - RandomAccessFile out = new RandomAccessFile(file, "rw"); - FileChannel ch = out.getChannel(); - int fileLength = TGA_HEADER_SIZE + vid.width * vid.height * 3; - out.setLength(fileLength); - MappedByteBuffer image = ch.map(FileChannel.MapMode.READ_WRITE, 0, - fileLength); - - // write the TGA header - image.put(0, (byte) 0).put(1, (byte) 0); - image.put(2, (byte) 2); // uncompressed type - image.put(12, (byte) (vid.width & 0xFF)); // vid.width - image.put(13, (byte) (vid.width >> 8)); // vid.width - image.put(14, (byte) (vid.height & 0xFF)); // vid.height - image.put(15, (byte) (vid.height >> 8)); // vid.height - image.put(16, (byte) 24); // pixel size - - // go to image data position - image.position(TGA_HEADER_SIZE); - - - // change pixel alignment for reading - if (vid.width % 4 != 0) { - gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, 1); - } - - // OpenGL 1.2+ supports the GL_BGR color format - // check the GL_VERSION to use the TARGA BGR order if possible - // e.g.: 1.5.2 NVIDIA 66.29 - if (gl_config.getOpenGLVersion() >= 1.2f) { - // read the BGR values into the image buffer - gl.glReadPixels(0, 0, vid.width, vid.height, GL12.GL_BGR, GL.GL_UNSIGNED_BYTE, image); - } else { - // read the RGB values into the image buffer - gl.glReadPixels(0, 0, vid.width, vid.height, GL11.GL_RGB, GL.GL_UNSIGNED_BYTE, image); - // flip RGB to BGR - byte tmp; - for (i = TGA_HEADER_SIZE; i < fileLength; i += 3) { - tmp = image.get(i); - image.put(i, image.get(i + 2)); - image.put(i + 2, tmp); - } - } - // reset to default alignment - gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, 4); - // close the file channel - ch.close(); - } catch (IOException e) { - VID.Printf(Defines.PRINT_ALL, e.getMessage() + '\n'); - } ! VID.Printf(Defines.PRINT_ALL, "Wrote " + file + '\n'); ! } ! ! /* ! ** GL_Strings_f ! */ ! void GL_Strings_f() { ! VID.Printf(Defines.PRINT_ALL, "GL_VENDOR: " + gl_config.vendor_string + '\n'); ! VID.Printf(Defines.PRINT_ALL, "GL_RENDERER: " + gl_config.renderer_string + '\n'); ! VID.Printf(Defines.PRINT_ALL, "GL_VERSION: " + gl_config.version_string + '\n'); ! VID.Printf(Defines.PRINT_ALL, "GL_EXTENSIONS: " + gl_config.extensions_string + '\n'); } /* ! ** GL_SetDefaultState ! */ ! void GL_SetDefaultState() ! { ! gl.glClearColor(1f,0f, 0.5f , 0.5f); // original quake2 ! //gl.glClearColor(0, 0, 0, 0); // replaced with black gl.glCullFace(GL11.GL_FRONT); gl.glEnable(GL11.GL_TEXTURE_2D); --- 42,149 ---- /** * Misc ! * * @author cwei */ ! public abstract class Misc extends Image { ! ! // /* ! // ============================================================================== ! // ! // SCREEN SHOTS ! // ! // ============================================================================== ! // */ ! // ! // typedef struct _TargaHeader { ! // unsigned char id_length, colormap_type, image_type; ! // unsigned short colormap_index, colormap_length; ! // unsigned char colormap_size; ! // unsigned short x_origin, y_origin, width, height; ! // unsigned char pixel_size, attributes; ! // } TargaHeader; ! ! private final static int TGA_HEADER_SIZE = 18; /* ! * ================== GL_ScreenShot_f ================== ! */ ! protected void GL_ScreenShot_f() { ! StringBuffer sb = new StringBuffer(FS.Gamedir() + "/scrshot/jake00.tga"); ! FS.CreatePath(sb.toString()); ! File file = new File(sb.toString()); ! // find a valid file name ! int i = 0; ! int offset = sb.length() - 6; ! while (file.exists() && i++ < 100) { ! sb.setCharAt(offset, (char) ((i / 10) + '0')); ! sb.setCharAt(offset + 1, (char) ((i % 10) + '0')); ! file = new File(sb.toString()); ! } ! if (i == 100) { ! VID.Printf(Defines.PRINT_ALL, "Clean up your screenshots\n"); ! return; ! } ! try { ! RandomAccessFile out = new RandomAccessFile(file, "rw"); ! FileChannel ch = out.getChannel(); ! int fileLength = TGA_HEADER_SIZE + vid.width * vid.height * 3; ! out.setLength(fileLength); ! MappedByteBuffer image = ch.map(FileChannel.MapMode.READ_WRITE, 0, ! fileLength); ! // write the TGA header ! image.put(0, (byte) 0).put(1, (byte) 0); ! image.put(2, (byte) 2); // uncompressed type ! image.put(12, (byte) (vid.width & 0xFF)); // vid.width ! image.put(13, (byte) (vid.width >> 8)); // vid.width ! image.put(14, (byte) (vid.height & 0xFF)); // vid.height ! image.put(15, (byte) (vid.height >> 8)); // vid.height ! image.put(16, (byte) 24); // pixel size ! ! // go to image data position ! image.position(TGA_HEADER_SIZE); + // change pixel alignment for reading + if (vid.width % 4 != 0) { + gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, 1); } ! // OpenGL 1.2+ supports the GL_BGR color format ! // check the GL_VERSION to use the TARGA BGR order if possible ! // e.g.: 1.5.2 NVIDIA 66.29 ! if (gl_config.getOpenGLVersion() >= 1.2f) { ! // read the BGR values into the image buffer ! gl.glReadPixels(0, 0, vid.width, vid.height, GL12.GL_BGR, ! GL.GL_UNSIGNED_BYTE, image); ! } else { ! // read the RGB values into the image buffer ! gl.glReadPixels(0, 0, vid.width, vid.height, GL11.GL_RGB, ! GL.GL_UNSIGNED_BYTE, image); ! // flip RGB to BGR ! byte tmp; ! for (i = TGA_HEADER_SIZE; i < fileLength; i += 3) { ! tmp = image.get(i); ! image.put(i, image.get(i + 2)); ! image.put(i + 2, tmp); ! } } + // reset to default alignment + gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, 4); + // close the file channel + ch.close(); + } catch (IOException e) { + VID.Printf(Defines.PRINT_ALL, e.getMessage() + '\n'); } ! VID.Printf(Defines.PRINT_ALL, "Wrote " + file + '\n'); } /* ! * * GL_SetDefaultState ! */ ! protected void GL_SetDefaultState() { ! gl.glClearColor(1f, 0f, 0.5f, 0.5f); // original quake2 ! // gl.glClearColor(0, 0, 0, 0); // replaced with black gl.glCullFace(GL11.GL_FRONT); gl.glEnable(GL11.GL_TEXTURE_2D); *************** *** 217,266 **** gl.glAlphaFunc(GL11.GL_GREATER, 0.666f); ! gl.glDisable (GL11.GL_DEPTH_TEST); ! gl.glDisable (GL11.GL_CULL_FACE); ! gl.glDisable (GL11.GL_BLEND); ! gl.glColor4f (1,1,1,1); ! gl.glPolygonMode (GL11.GL_FRONT_AND_BACK, GL11.GL_FILL); ! gl.glShadeModel (GL11.GL_FLAT); ! GL_TextureMode( gl_texturemode.string ); ! GL_TextureAlphaMode( gl_texturealphamode.string ); ! GL_TextureSolidMode( gl_texturesolidmode.string ); ! gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, gl_filter_min); ! gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, gl_filter_max); ! gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT); ! gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT); ! gl.glBlendFunc (GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); ! GL_TexEnv( GL11.GL_REPLACE ); ! if ( qglPointParameterfEXT ) ! { ! // float[] attenuations = { gl_particle_att_a.value, gl_particle_att_b.value, gl_particle_att_c.value }; ! FloatBuffer att_buffer=BufferUtils.createFloatBuffer(4); ! att_buffer.put(0,gl_particle_att_a.value); ! att_buffer.put(1,gl_particle_att_b.value); ! att_buffer.put(2,gl_particle_att_c.value); ! ! gl.glEnable( GL11.GL_POINT_SMOOTH ); ! gl.glPointParameterfEXT( EXTPointParameters.GL_POINT_SIZE_MIN_EXT, gl_particle_min_size.value ); ! gl.glPointParameterfEXT( EXTPointParameters.GL_POINT_SIZE_MAX_EXT, gl_particle_max_size.value ); ! gl.glPointParameterEXT( EXTPointParameters.GL_DISTANCE_ATTENUATION_EXT, att_buffer ); } ! if ( qglColorTableEXT && gl_ext_palettedtexture.value != 0.0f ) ! { ! gl.glEnable( EXTSharedTexturePalette.GL_SHARED_TEXTURE_PALETTE_EXT ); ! GL_SetTexturePalette( d_8to24table ); } GL_UpdateSwapInterval(); ! /* * vertex array extension --- 152,207 ---- gl.glAlphaFunc(GL11.GL_GREATER, 0.666f); ! gl.glDisable(GL11.GL_DEPTH_TEST); ! gl.glDisable(GL11.GL_CULL_FACE); ! gl.glDisable(GL11.GL_BLEND); ! gl.glColor4f(1, 1, 1, 1); ! gl.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL); ! gl.glShadeModel(GL11.GL_FLAT); ! GL_TextureMode(gl_texturemode.string); ! GL_TextureAlphaMode(gl_texturealphamode.string); ! GL_TextureSolidMode(gl_texturesolidmode.string); ! gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, ! gl_filter_min); ! gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, ! gl_filter_max); ! gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, ! GL11.GL_REPEAT); ! gl.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, ! GL11.GL_REPEAT); ! gl.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); ! GL_TexEnv(GL11.GL_REPLACE); ! if (qglPointParameterfEXT) { ! // float[] attenuations = { gl_particle_att_a.value, ! // gl_particle_att_b.value, gl_particle_att_c.value }; ! FloatBuffer att_buffer = BufferUtils.createFloatBuffer(4); ! att_buffer.put(0, gl_particle_att_a.value); ! att_buffer.put(1, gl_particle_att_b.value); ! att_buffer.put(2, gl_particle_att_c.value); ! ! gl.glEnable(GL11.GL_POINT_SMOOTH); ! gl.glPointParameterfEXT(EXTPointParameters.GL_POINT_SIZE_MIN_EXT, ! gl_particle_min_size.value); ! gl.glPointParameterfEXT(EXTPointParameters.GL_POINT_SIZE_MAX_EXT, ! gl_particle_max_size.value); ! gl.glPointParameterEXT( ! EXTPointParameters.GL_DISTANCE_ATTENUATION_EXT, att_buffer); } ! if (qglColorTableEXT && gl_ext_palettedtexture.value != 0.0f) { ! gl.glEnable(EXTSharedTexturePalette.GL_SHARED_TEXTURE_PALETTE_EXT); ! GL_SetTexturePalette(d_8to24table); } GL_UpdateSwapInterval(); ! /* * vertex array extension *************** *** 271,281 **** } ! void GL_UpdateSwapInterval() ! { ! if ( gl_swapinterval.modified ) ! { gl_swapinterval.modified = false; ! if ( !gl_state.stereo_enabled ) ! { if (qwglSwapIntervalEXT) { // ((WGL)gl).wglSwapIntervalEXT((int)gl_swapinterval.value); --- 212,219 ---- } ! protected void GL_UpdateSwapInterval() { ! if (gl_swapinterval.modified) { gl_swapinterval.modified = false; ! if (!gl_state.stereo_enabled) { if (qwglSwapIntervalEXT) { // ((WGL)gl).wglSwapIntervalEXT((int)gl_swapinterval.value); |
From: Rene S. <sa...@us...> - 2006-10-31 13:06:35
|
Update of /cvsroot/jake2/jake2/src/jake2/render/fastjogl In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv15592/src/jake2/render/fastjogl Modified Files: Misc.java Image.java Main.java Added Files: GLWrapJogl.java Removed Files: Light.java Model.java Anorms.java Polygon.java Mesh.java Base.java Draw.java Warp.java Surf.java Log Message: major refactoring of the render module --- Base.java DELETED --- Index: Image.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastjogl/Image.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Image.java 10 Nov 2004 20:35:36 -0000 1.8 --- Image.java 31 Oct 2006 13:06:32 -0000 1.9 *************** *** 32,35 **** --- 32,37 ---- import jake2.qcommon.*; import jake2.render.image_t; + import jake2.render.common.Image.glmode_t; + import jake2.render.common.Image.gltmode_t; import jake2.util.Lib; import jake2.util.Vargs; *************** *** 47,1591 **** */ [...1850 lines suppressed...] ! } ! /* ! * GL_ShutdownImages ! */ ! protected 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 ! gl.glDeleteTextures(1, new int[] { image.texnum }); ! image.clear(); ! } ! } } \ No newline at end of file --- Surf.java DELETED --- --- Light.java DELETED --- --- Mesh.java DELETED --- --- Model.java DELETED --- Index: Main.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastjogl/Main.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Main.java 7 May 2005 18:23:26 -0000 1.8 --- Main.java 31 Oct 2006 13:06:32 -0000 1.9 *************** *** 29,37 **** import jake2.Globals; import jake2.client.*; ! import jake2.game.Cmd; ! import jake2.game.cplane_t; ! import jake2.game.cvar_t; import jake2.qcommon.*; import jake2.render.*; import jake2.util.Math3D; import jake2.util.Vargs; --- 29,37 ---- [...1342 lines suppressed...] - - 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.GL_TEXTURE_2D); - gl.glDisable(GL.GL_BLEND); - gl.glDepthMask(true); - } - } --- 443,445 ---- --- Polygon.java DELETED --- --- NEW FILE: GLWrapJogl.java --- /* 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. */ // Created on 28.10.2006 by RST. // $Id: GLWrapJogl.java,v 1.1 2006/10/31 13:06:31 salomo Exp $ package jake2.render.fastjogl; import java.nio.*; import net.java.games.jogl.GL; import jake2.*; import jake2.client.*; import jake2.game.*; import jake2.qcommon.*; import jake2.render.*; import jake2.render.common.GenericGL; import jake2.server.*; import net.java.games.jogl.*; public class GLWrapJogl implements GenericGL{ protected GL gl; public GLWrapJogl(GL gl) { this.gl = gl; } public void glTexParameterf(int gl_texture_2d, int gl_texture_min_filter, int gl_nearest) { gl.glTexParameterf(gl_texture_2d, gl_texture_min_filter, gl_nearest); } public void glBegin(int gl_triangle_fan2) { gl.glBegin(gl_triangle_fan2); } public void glTexCoord2f(float s, float t) { gl.glTexCoord2f(s, t); } public void glVertex3f(float f, float g, float h) { gl.glVertex3f(f, g, h); } public void glEnd() { gl.glEnd(); } public void glPushMatrix() { gl.glPushMatrix(); } public void glTranslatef(float f, float g, float h) { gl.glTranslatef(f, g, h); } public void glRotatef(float f, float g, float h, float i) { gl.glRotatef(f, g, h, i); } public void glPopMatrix() { gl.glPopMatrix(); } public void glColor3f(float f, float g, float h) { gl.glColor3f(f, g, h); } public void glDepthMask(boolean b) { gl.glDepthMask(b); } public void glDisable(int gl_texture_2d2) { gl.glDisable(gl_texture_2d2); } public void glBlendFunc(int gl_src_alpha2, int gl_one_minus_src_alpha2) { gl.glBlendFunc(gl_src_alpha2, gl_one_minus_src_alpha2); } public void glShadeModel(int gl_smooth2) { gl.glShadeModel(gl_smooth2); } public void glDrawArrays(int gl_polygon2, int pos, int numverts) { gl.glDrawArrays(gl_polygon2, pos, numverts); } public void glBindTexture(int gl_texture_2d2, int texnum) { gl.glBindTexture(gl_texture_2d2, texnum); } public void glActiveTextureARB(int texture) { gl.glActiveTextureARB( texture); } public void glClientActiveTextureARB(int texture) { gl.glClientActiveTextureARB(texture); } public void glTexEnvi(int gl_texture_env2, int gl_texture_env_mode2, int mode) { gl.glTexEnvi(gl_texture_env2, gl_texture_env_mode2, mode); } public void glVertex2f(int x, int y) { gl.glVertex2f(x, y); } public void glEnable(int gl_alpha_test2) { gl.glEnable(gl_alpha_test2); } public void glColor3ub(byte b, byte c, byte d) { gl.glColor3ub(b, c, d); } public void glColor4f(int i, int j, int k, float f) { gl.glColor4f(i, j, k, f); } public void glTexImage2D(int gl_texture_2d2, int i, int gl_tex_solid_format, int j, int k, int l, int gl_rgba3, int gl_unsigned_byte2, IntBuffer image32) { gl.glTexImage2D(gl_texture_2d2, i, gl_tex_solid_format, j, k, l, gl_rgba3, gl_unsigned_byte2, image32); } public void glTexImage2D(int gl_texture_2d2, int i, int gl_color_index8_ext, int j, int k, int l, int gl_color_index2, int gl_unsigned_byte2, ByteBuffer image8) { gl.glTexImage2D(gl_texture_2d2, i, gl_color_index8_ext, j, k, l, gl_color_index2, gl_unsigned_byte2, image8); } public void glColor4ub(byte b, byte c, byte d, byte e) { gl.glColor4ub(b, c, d, e); } public void glTexParameteri(int gl_texture_2d2, int gl_texture_min_filter2, int gl_filter_min) { gl.glTexParameteri(gl_texture_2d2, gl_texture_min_filter2, gl_filter_min); } public void glTexSubImage2D(int gl_texture_2d2, int i, int j, int k, int lm_block_width, int height, int gl_lightmap_format, int gl_unsigned_byte2, IntBuffer lightmap_buffer) { gl.glTexSubImage2D(gl_texture_2d2, i, j, k, lm_block_width, height, gl_lightmap_format, gl_unsigned_byte2, lightmap_buffer); } public final void glColor4f(float intens, float intens2, float intens3, float f) { gl.glColor4f(intens, intens2, intens3, f); } public final void glLoadMatrixf(float[] r_world_matrix) { gl.glLoadMatrixf(r_world_matrix); } public final void glInterleavedArrays(int gl_t2f_v3f2, int byte_stride, FloatBuffer globalPolygonInterleavedBuf) { gl.glInterleavedArrays(gl_t2f_v3f2, byte_stride, globalPolygonInterleavedBuf); } public final void glDrawElements(int mode, int count, int gl_unsigned_int2, IntBuffer srcIndexBuf) { gl.glDrawElements(mode, count, gl_unsigned_int2, srcIndexBuf); } public final void glDisableClientState(int gl_color_array2) { gl.glDisableClientState(gl_color_array2); } public final void glVertexPointer(int i, int gl_float2, int j, FloatBuffer vertexArrayBuf) { gl.glVertexPointer(i, gl_float2, j, vertexArrayBuf); } public final void glEnableClientState(int gl_color_array2) { gl.glEnableClientState(gl_color_array2); } public final void glColorPointer(int i, int gl_float2, int j, FloatBuffer colorArrayBuf) { gl.glColorPointer(i, gl_float2, j, colorArrayBuf); } public final void glTexCoordPointer(int i, int gl_float2, int j, FloatBuffer textureArrayBuf) { gl.glTexCoordPointer(i, gl_float2, j, textureArrayBuf); } public final void glDepthRange(float gldepthmin, double d) { gl.glDepthRange(gldepthmin, d); } public final void glMatrixMode(int gl_projection2) { gl.glMatrixMode(gl_projection2); } public final void glLoadIdentity() { gl.glLoadIdentity(); } public final void glScalef(int i, int j, int k) { gl.glScalef(i, j, k); } public final void glCullFace(int gl_back2) { gl.glCullFace(gl_back2); } public final void glClear(int gl_color_buffer_bit2) { gl.glClear(gl_color_buffer_bit2); } public final void glDepthFunc(int gl_lequal2) { gl.glDepthFunc(gl_lequal2); } public final void glFrustum(double xmin, double xmax, double ymin, double ymax, double near, double far) { gl.glFrustum(xmin, xmax, ymin, ymax, near, far); } public final void glViewport(int i, int j, int width, int height) { gl.glViewport(i, j, width, height); } public final void glOrtho(int i, int width, int height, int j, int k, int l) { gl.glOrtho(i, width, height, j, k, l); } public void glColorPointer(int i, int gl_unsigned_byte2, int j, ByteBuffer bb) { gl.glColorPointer(i, gl_unsigned_byte2, j, bb.asIntBuffer()); } public void glPointSize(float value) { gl.glPointSize(value); } public void glClearColor(float f, float g, float h, float i) { gl.glClearColor(f, g, h, i); } } --- Warp.java DELETED --- --- Anorms.java DELETED --- --- Draw.java DELETED --- Index: Misc.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastjogl/Misc.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Misc.java 11 May 2005 21:44:55 -0000 1.7 --- Misc.java 31 Oct 2006 13:06:32 -0000 1.8 *************** *** 6,27 **** */ /* ! Copyright (C) 1997-2001 Id Software, Inc. ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ! See the GNU General Public License for more details. ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ package jake2.render.fastjogl; --- 6,27 ---- */ /* ! Copyright (C) 1997-2001 Id Software, Inc. ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ! See the GNU General Public License for more details. ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ package jake2.render.fastjogl; *************** *** 30,33 **** --- 30,34 ---- import jake2.qcommon.FS; import jake2.qcommon.xcommand_t; + import jake2.render.common.Base; import java.io.*; *************** *** 41,94 **** /** * Misc ! * * @author cwei */ ! public abstract class Misc extends Mesh { ! ! /* ! ================== ! R_InitParticleTexture ! ================== ! */ ! byte[][] dottexture = { { 0, 0, 0, 0, 0, 0, 0, 0 }, { ! 0, 0, 1, 1, 0, 0, 0, 0 }, { ! 0, 1, 1, 1, 1, 0, 0, 0 }, ! { 0, 1, 1, 1, 1, 0, 0, 0 }, { ! 0, 0, 1, 1, 0, 0, 0, 0 }, { ! 0, 0, 0, 0, 0, 0, 0, 0 }, { ! 0, 0, 0, 0, 0, 0, 0, 0 }, { ! 0, 0, 0, 0, 0, 0, 0, 0 }, }; ! ! void R_InitParticleTexture() { ! int x, y; ! byte[] data = new byte[8 * 8 * 4]; ! ! // ! // particle texture ! // ! for (x = 0; x < 8; x++) { ! for (y = 0; y < 8; y++) { ! data[y * 32 + x * 4 + 0] = (byte) 255; ! data[y * 32 + x * 4 + 1] = (byte) 255; ! data[y * 32 + x * 4 + 2] = (byte) 255; ! data[y * 32 + x * 4 + 3] = (byte) (dottexture[x][y] * 255); ! ! } ! } ! r_particletexture = GL_LoadPic("***particle***", data, 8, 8, it_sprite, 32); ! ! // ! // also use this for bad textures, but without alpha ! // ! for (x = 0; x < 8; x++) { ! for (y = 0; y < 8; y++) { ! data[y * 32 + x * 4 + 0] = (byte) (dottexture[x & 3][y & 3] * 255); ! data[y * 32 + x * 4 + 1] = 0; // dottexture[x&3][y&3]*255; ! data[y * 32 + x * 4 + 2] = 0; //dottexture[x&3][y&3]*255; ! data[y * 32 + x * 4 + 3] = (byte) 255; ! } ! } ! r_notexture = GL_LoadPic("***r_notexture***", data, 8, 8, it_wall, 32); ! } // /* --- 42,49 ---- /** * Misc ! * * @author cwei */ ! public abstract class Misc extends Image { // /* *************** *** 113,117 **** * GL_ScreenShot_f */ ! void GL_ScreenShot_f() { if (contextInUse) { screenshot_f(); --- 68,72 ---- * GL_ScreenShot_f */ ! protected void GL_ScreenShot_f() { if (contextInUse) { screenshot_f(); *************** *** 197,215 **** VID.Printf(Defines.PRINT_ALL, "Wrote " + file + '\n'); } - - /* - ** GL_Strings_f - */ - void GL_Strings_f() { - VID.Printf(Defines.PRINT_ALL, "GL_VENDOR: " + gl_config.vendor_string + '\n'); - VID.Printf(Defines.PRINT_ALL, "GL_RENDERER: " + gl_config.renderer_string + '\n'); - VID.Printf(Defines.PRINT_ALL, "GL_VERSION: " + gl_config.version_string + '\n'); - VID.Printf(Defines.PRINT_ALL, "GL_EXTENSIONS: " + gl_config.extensions_string + '\n'); - } /* ** GL_SetDefaultState */ ! void GL_SetDefaultState() { gl.glClearColor(1f, 0f, 0.5f, 0.5f); // original quake2 //gl.glClearColor(0, 0, 0, 0); // replaced with black --- 152,160 ---- VID.Printf(Defines.PRINT_ALL, "Wrote " + file + '\n'); } /* ** GL_SetDefaultState */ ! protected void GL_SetDefaultState() { gl.glClearColor(1f, 0f, 0.5f, 0.5f); // original quake2 //gl.glClearColor(0, 0, 0, 0); // replaced with black *************** *** 268,272 **** } ! void GL_UpdateSwapInterval() { if (gl_swapinterval.modified) { gl_swapinterval.modified = false; --- 213,217 ---- } ! protected void GL_UpdateSwapInterval() { if (gl_swapinterval.modified) { gl_swapinterval.modified = false; |
From: Rene S. <sa...@us...> - 2006-10-31 13:05:53
|
Update of /cvsroot/jake2/jake2/src/jake2/render/common In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv15581/src/jake2/render/common Log Message: Directory /cvsroot/jake2/jake2/src/jake2/render/common added to the repository |
From: Rene S. <sa...@us...> - 2006-10-31 13:04:47
|
Update of /cvsroot/jake2/jake2/src/jake2/render In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv15174/src/jake2/render Added Files: gl_functions.txt Log Message: initial revision --- NEW FILE: gl_functions.txt --- gl.glActiveTexture gl.glActiveTextureARB gl.glAlphaFunc gl.glArrayElement gl.glBegin gl.glBindTexture gl.glBlendFunc gl.glClear gl.glClearColor gl.glClientActiveTextureARB gl.glColor3f gl.glColor3ub gl.glColor4f gl.glColor4ub gl.glColorPointer gl.glColorTable gl.glColorTableEXT gl.glCullFace gl.glDeleteTextures gl.glDepthFunc gl.glDepthMask gl.glDepthRange gl.glDisable gl.glDisableClientState gl.glDrawArrays gl.glDrawBuffer gl.glDrawElements gl.glEnable gl.glEnableClientState gl.glEnd gl.glFinish gl.glFlush gl.glFrustum gl.glGetError gl.glGetFloat gl.glGetFloatv gl.glGetString gl.glInterleavedArrays gl.glLoadIdentity gl.glLoadMatrix gl.glLoadMatrixf gl.glLockArraysEXT gl.glMatrixMode gl.glMultiTexCoord2fARB gl.glOrtho gl.glPixelStorei gl.glPointParameterEXT gl.glPointParameterfEXT gl.glPointParameterfvEXT gl.glPointSize gl.glPolygonMode gl.glPopMatrix gl.glPushMatrix gl.glReadPixels gl.glRotatef gl.glScalef gl.glScissor gl.glShadeModel gl.glTexCoord2f gl.glTexCoordPointer gl.glTexEnvi gl.glTexImage2D gl.glTexParameterf gl.glTexParameteri gl.glTexSubImage2D gl.glTranslatef gl.glUnlockArraysEXT gl.glutWireCube gl.glVertex2f gl.glVertex3f gl.glVertexPointer gl.glViewport |
From: Rene S. <sa...@us...> - 2006-10-31 13:04:26
|
Update of /cvsroot/jake2/jake2/src/jake2/render In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv15150/src/jake2/render Added Files: extract_gl_functions.sh Log Message: initial revision --- NEW FILE: extract_gl_functions.sh --- cat *.java | egrep "\.gl" | grep \( | sed 's/(.*$//g'| grep -v "//" | grep ".gl" | sed 's/^.*\.gl/gl\.gl/g' | sed 's/ //g' | sort | uniq > $1 |
From: Carsten W. <ca...@us...> - 2006-10-29 14:49:29
|
Update of /cvsroot/jake2/jake2/scripts In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv2326/scripts Modified Files: Jake2_mac_lwjgl.sh Jake2_lwjgl.bat Log Message: separate lwjgl libs directory Index: Jake2_lwjgl.bat =================================================================== RCS file: /cvsroot/jake2/jake2/scripts/Jake2_lwjgl.bat,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Jake2_lwjgl.bat 24 Oct 2006 22:15:52 -0000 1.3 --- Jake2_lwjgl.bat 29 Oct 2006 14:49:21 -0000 1.4 *************** *** 2,4 **** SET PATH=lib\windows;%PATH% SET CP=lib/jake2.jar;lib/lwjgl.jar;lib/lwjgl_util.jar ! start javaw -Xmx100M -Dsun.java2d.noddraw=true -Djava.library.path=lib/windows -cp %CP% jake2.Jake2 \ No newline at end of file --- 2,4 ---- SET PATH=lib\windows;%PATH% SET CP=lib/jake2.jar;lib/lwjgl.jar;lib/lwjgl_util.jar ! start javaw -Xmx100M -Dsun.java2d.noddraw=true -Djava.library.path=lib/windows/lwjgl -cp %CP% jake2.Jake2 \ No newline at end of file Index: Jake2_mac_lwjgl.sh =================================================================== RCS file: /cvsroot/jake2/jake2/scripts/Jake2_mac_lwjgl.sh,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Jake2_mac_lwjgl.sh 7 Oct 2005 06:00:48 -0000 1.3 --- Jake2_mac_lwjgl.sh 29 Oct 2006 14:49:21 -0000 1.4 *************** *** 1,6 **** #!/bin/sh ! export LD_LIBRARY_PATH=lib/osx CP=lib/jake2.jar:lib/lwjgl.jar:lib/lwjgl_util.jar ! exec java -Xmx100M -Djava.library.path=lib/osx -cp $CP jake2.Jake2 --- 1,7 ---- #!/bin/sh ! export LD_LIBRARY_PATH=lib/osx/lwjgl ! export DYLD_LIBRARY_PATH=lib/osx/lwjgl CP=lib/jake2.jar:lib/lwjgl.jar:lib/lwjgl_util.jar ! exec java -Xmx100M -Djava.library.path=lib/osx/lwjgl -cp $CP jake2.Jake2 |
From: Holger Z. <hz...@us...> - 2006-10-29 13:48:12
|
Update of /cvsroot/jake2/jake2 In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv30593 Modified Files: README Jake2_Eclipse_Setup.txt README_DE Log Message: new cvs server name Index: README =================================================================== RCS file: /cvsroot/jake2/jake2/README,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** README 24 Oct 2006 22:15:52 -0000 1.10 --- README 29 Oct 2006 13:20:04 -0000 1.11 *************** *** 45,51 **** If you want to have the latest experimental features you can grab the latest Jake2 sources from CVS. ! - "cvs -d:pserver:ano...@cv...:/cvsroot/jake2 login" - when askesd for password simply press the Enter key ! - "cvs -d:pserver:ano...@cv...:/cvsroot/jake2 co jake2" - proceed with the build from source instructions --- 45,51 ---- If you want to have the latest experimental features you can grab the latest Jake2 sources from CVS. ! - "cvs -d:pserver:ano...@ja...:/cvsroot/jake2 login" - when askesd for password simply press the Enter key ! - "cvs -d:pserver:ano...@ja...:/cvsroot/jake2 co jake2" - proceed with the build from source instructions Index: Jake2_Eclipse_Setup.txt =================================================================== RCS file: /cvsroot/jake2/jake2/Jake2_Eclipse_Setup.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Jake2_Eclipse_Setup.txt 21 Jan 2006 11:33:19 -0000 1.1 --- Jake2_Eclipse_Setup.txt 29 Oct 2006 13:20:04 -0000 1.2 *************** *** 3,7 **** - switch to CVS perspective - create a new CVS repository with the following parameters: ! host: cvs.sourceforge.net repository path: /cvsroot/jake2 user: anonymous --- 3,7 ---- - switch to CVS perspective - create a new CVS repository with the following parameters: ! host: jake2.cvs.sourceforge.net repository path: /cvsroot/jake2 user: anonymous *************** *** 59,63 **** project root dir ! 6. Keep ud to date - right click project root folder jake2 --- 59,63 ---- project root dir ! 6. Keep up to date - right click project root folder jake2 Index: README_DE =================================================================== RCS file: /cvsroot/jake2/jake2/README_DE,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** README_DE 24 Oct 2006 22:15:52 -0000 1.9 --- README_DE 29 Oct 2006 13:20:04 -0000 1.10 *************** *** 49,55 **** Zum Testen neuer und experimenteller Features kann der aktuelle Jake2 Sourcetree per anonymous CVS ausgecheckt werden. ! - "cvs -d:pserver:ano...@cv...:/cvsroot/jake2 login" - bei der Frage nach dem Passwort einfach Enter drücken ! - "cvs -d:pserver:ano...@cv...:/cvsroot/jake2 co jake2" - dann gehts weiter wie oben für die Sourcedistribution beschrieben --- 49,55 ---- Zum Testen neuer und experimenteller Features kann der aktuelle Jake2 Sourcetree per anonymous CVS ausgecheckt werden. ! - "cvs -d:pserver:ano...@ja...:/cvsroot/jake2 login" - bei der Frage nach dem Passwort einfach Enter drücken ! - "cvs -d:pserver:ano...@ja...:/cvsroot/jake2 co jake2" - dann gehts weiter wie oben für die Sourcedistribution beschrieben |
From: Carsten W. <ca...@us...> - 2006-10-28 12:02:43
|
Update of /cvsroot/jake2/jake2 In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv26040 Modified Files: build.xml Log Message: separate lwjgl libs directory for webstart builds Index: build.xml =================================================================== RCS file: /cvsroot/jake2/jake2/build.xml,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** build.xml 26 Oct 2006 23:06:46 -0000 1.31 --- build.xml 28 Oct 2006 12:02:32 -0000 1.32 *************** *** 99,105 **** <include name="*"/> </fileset> <fileset dir="lib/lwjgl/windows"> <include name="*"/> ! </fileset> </copy> <copy todir="${dist}/lib/osx"> --- 99,107 ---- <include name="*"/> </fileset> + </copy> + <copy todir="${dist}/lib/windows/lwjgl"> <fileset dir="lib/lwjgl/windows"> <include name="*"/> ! </fileset> </copy> <copy todir="${dist}/lib/osx"> *************** *** 110,116 **** <include name="*"/> </fileset> <fileset dir="lib/lwjgl/osx"> <include name="*"/> ! </fileset> </copy> <copy todir="${dist}"> --- 112,120 ---- <include name="*"/> </fileset> + </copy> + <copy todir="${dist}/lib/osx/lwjgl"> <fileset dir="lib/lwjgl/osx"> <include name="*"/> ! </fileset> </copy> <copy todir="${dist}"> *************** *** 256,265 **** </jar> <mkdir dir="webstart/lib/osx"/> ! <jar destfile="webstart/lib/osx/lwjgl-native.jar" basedir="${dist}/lib/osx"> <include name="liblwjgl.jnilib"/> <include name="openal.dylib"/> </jar> <mkdir dir="webstart/lib/windows"/> ! <jar destfile="webstart/lib/windows/lwjgl-native.jar" basedir="${dist}/lib/windows"> <include name="lwjgl.dll"/> <include name="OpenAL32.dll"/> --- 260,269 ---- </jar> <mkdir dir="webstart/lib/osx"/> ! <jar destfile="webstart/lib/osx/lwjgl-native.jar" basedir="${dist}/lib/osx/lwjgl"> <include name="liblwjgl.jnilib"/> <include name="openal.dylib"/> </jar> <mkdir dir="webstart/lib/windows"/> ! <jar destfile="webstart/lib/windows/lwjgl-native.jar" basedir="${dist}/lib/windows/lwjgl"> <include name="lwjgl.dll"/> <include name="OpenAL32.dll"/> |
From: Carsten W. <ca...@us...> - 2006-10-26 23:06:49
|
Update of /cvsroot/jake2/jake2 In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv29795 Modified Files: build.xml Log Message: switch to lwjgl 1.0beta3 Index: build.xml =================================================================== RCS file: /cvsroot/jake2/jake2/build.xml,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** build.xml 25 Oct 2006 21:04:38 -0000 1.30 --- build.xml 26 Oct 2006 23:06:46 -0000 1.31 *************** *** 255,262 **** <include name="*.so"/> </jar> <mkdir dir="webstart/lib/windows"/> <jar destfile="webstart/lib/windows/lwjgl-native.jar" basedir="${dist}/lib/windows"> <include name="lwjgl.dll"/> ! <include name="lwjglaudio.dll"/> </jar> <signjar keystore="${user.home}/bytonic" alias="bytonic" storepass="${bytonic.pass}"> --- 255,267 ---- <include name="*.so"/> </jar> + <mkdir dir="webstart/lib/osx"/> + <jar destfile="webstart/lib/osx/lwjgl-native.jar" basedir="${dist}/lib/osx"> + <include name="liblwjgl.jnilib"/> + <include name="openal.dylib"/> + </jar> <mkdir dir="webstart/lib/windows"/> <jar destfile="webstart/lib/windows/lwjgl-native.jar" basedir="${dist}/lib/windows"> <include name="lwjgl.dll"/> ! <include name="OpenAL32.dll"/> </jar> <signjar keystore="${user.home}/bytonic" alias="bytonic" storepass="${bytonic.pass}"> |
From: Carsten W. <ca...@us...> - 2006-10-26 23:06:06
|
Update of /cvsroot/jake2/jake2/webstart In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv29370/webstart Modified Files: jake2_lwjgl.jnlp Log Message: use name instead of ip Index: jake2_lwjgl.jnlp =================================================================== RCS file: /cvsroot/jake2/jake2/webstart/jake2_lwjgl.jnlp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** jake2_lwjgl.jnlp 8 Jan 2006 22:54:29 -0000 1.11 --- jake2_lwjgl.jnlp 26 Oct 2006 23:06:02 -0000 1.12 *************** *** 46,50 **** <argument>+set</argument> <argument>adr0</argument> ! <argument>213.187.87.100</argument> </application-desc> --- 46,50 ---- <argument>+set</argument> <argument>adr0</argument> ! <argument>jake2.in-chemnitz.de</argument> </application-desc> |
From: Carsten W. <ca...@us...> - 2006-10-26 22:03:03
|
Update of /cvsroot/jake2/jake2/src/jake2/sound/lwjgl In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv3095/src/jake2/sound/lwjgl Modified Files: Channel.java LWJGLSoundImpl.java Log Message: switch to lwjgl 1.0beta3 (sound and gfx tested on MacBook Pro) Index: Channel.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/sound/lwjgl/Channel.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Channel.java 4 Dec 2005 20:56:26 -0000 1.8 --- Channel.java 26 Oct 2006 22:02:55 -0000 1.9 *************** *** 24,28 **** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ package jake2.sound.lwjgl; --- 24,28 ---- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ package jake2.sound.lwjgl; *************** *** 42,45 **** --- 42,46 ---- import org.lwjgl.openal.AL10; + import org.lwjgl.openal.OpenALException; /** *************** *** 50,441 **** public class Channel { ! final static int LISTENER = 0; ! final static int FIXED = 1; ! final static int DYNAMIC = 2; ! final static int MAX_CHANNELS = 32; ! private final static FloatBuffer NULLVECTOR = Lib.newFloatBuffer(3); ! ! private static Channel[] channels = new Channel[MAX_CHANNELS]; ! private static IntBuffer sources = Lib.newIntBuffer(MAX_CHANNELS); ! // a reference of L:WJGLSoundImpl.buffers ! private static IntBuffer buffers; ! private static Map looptable = new Hashtable(MAX_CHANNELS); - private static boolean isInitialized = false; - private static int numChannels; - // stream handling private static boolean streamingEnabled = false; private static int streamQueue = 0; - - // sound attributes - private int type; - private int entnum; - private int entchannel; - private int bufferId; - private int sourceId; - private float volume; - private float rolloff; - private float[] origin = {0, 0, 0}; ! // update flags ! private boolean autosound; ! private boolean active; ! private boolean modified; ! private boolean bufferChanged; ! private boolean volumeChanged; ! private Channel(int sourceId) { ! this.sourceId = sourceId; ! clear(); ! volumeChanged = false; ! volume = 1.0f; ! } ! private void clear() { ! entnum = entchannel = bufferId = -1; ! bufferChanged = false; ! rolloff = 0; ! autosound = false; ! active = false; ! modified = false; ! } ! ! private static IntBuffer tmp = Lib.newIntBuffer(1); ! static int init(IntBuffer buffers) { ! Channel.buffers = buffers; ! // create channels ! int sourceId; ! for (int i = 0; i < MAX_CHANNELS; i++) { ! ! AL10.alGenSources(tmp); ! sourceId = tmp.get(0); ! ! // can't generate more sources ! if (sourceId <= 0) break; ! ! sources.put(i, sourceId); ! channels[i] = new Channel(sourceId); ! numChannels++; ! ! // set default values for AL sources ! 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); ! AL10.alSourcef (sourceId, AL10.AL_REFERENCE_DISTANCE, 200.0f); ! AL10.alSourcef (sourceId, AL10.AL_MIN_GAIN, 0.0005f); ! AL10.alSourcef (sourceId, AL10.AL_MAX_GAIN, 1.0f); ! } ! isInitialized = true; ! return numChannels; ! } ! ! static void reset() { ! for (int i = 0; i < numChannels; i++) { ! AL10.alSourceStop(sources.get(i)); ! AL10.alSourcei(sources.get(i), AL10.AL_BUFFER, 0); ! channels[i].clear(); ! } } ! ! static void shutdown() { ! AL10.alDeleteSources(sources); ! numChannels = 0; ! isInitialized = false; } ! static void enableStreaming() { ! if (streamingEnabled) return; ! ! // use the last source ! numChannels--; ! streamingEnabled = true; ! streamQueue = 0; ! int source = channels[numChannels].sourceId; ! AL10.alSourcei (source, AL10.AL_SOURCE_RELATIVE, AL10.AL_TRUE); ! AL10.alSourcef(source, AL10.AL_GAIN, 1.0f); ! channels[numChannels].volumeChanged = true; ! Com.DPrintf("streaming enabled\n"); } static void disableStreaming() { ! if (!streamingEnabled) return; ! unqueueStreams(); ! int source = channels[numChannels].sourceId; ! AL10.alSourcei (source, AL10.AL_SOURCE_ABSOLUTE, AL10.AL_TRUE); ! // free the last source ! numChannels++; ! streamingEnabled = false; ! Com.DPrintf("streaming disabled\n"); } ! static void unqueueStreams() { ! if (!streamingEnabled) return; ! int source = channels[numChannels].sourceId; ! // stop streaming ! AL10.alSourceStop(source); ! int count = AL10.alGetSourcei(source, AL10.AL_BUFFERS_QUEUED); ! Com.DPrintf("unqueue " + count + " buffers\n"); ! while (count-- > 0) { ! AL10.alSourceUnqueueBuffers(source, tmp); ! } ! streamQueue = 0; } static void updateStream(ByteBuffer samples, int count, int format, int rate) { ! enableStreaming(); ! int source = channels[numChannels].sourceId; ! int processed = AL10.alGetSourcei(source, AL10.AL_BUFFERS_PROCESSED); ! ! boolean playing = (AL10.alGetSourcei(source, AL10.AL_SOURCE_STATE) == AL10.AL_PLAYING); ! boolean interupted = !playing && streamQueue > 2; ! ! IntBuffer buffer = tmp; ! if (interupted) { ! unqueueStreams(); ! buffer.put(0, buffers.get(Sound.MAX_SFX + streamQueue++)); ! Com.DPrintf("queue " + (streamQueue - 1) + '\n'); ! } else if (processed < 2) { ! // check queue overrun ! if (streamQueue >= Sound.STREAM_QUEUE) return; ! buffer.put(0, buffers.get(Sound.MAX_SFX + streamQueue++)); ! Com.DPrintf("queue " + (streamQueue - 1) + '\n'); ! } else { ! // reuse the buffer ! AL10.alSourceUnqueueBuffers(source, buffer); ! } ! samples.position(0); ! samples.limit(count); ! AL10.alBufferData(buffer.get(0), format, samples, rate); ! AL10.alSourceQueueBuffers(source, buffer); ! ! if (streamQueue > 1 && !playing) { ! Com.DPrintf("start sound\n"); ! AL10.alSourcePlay(source); ! } ! } ! ! static void addPlaySounds() { ! while (Channel.assign(PlaySound.nextPlayableSound())); } - - private static boolean assign(PlaySound ps) { - if (ps == null) return false; - Channel ch = null; - int i; - for (i = 0; i < numChannels; i++) { - ch = channels[i]; ! if (ps.entchannel != 0 && ch.entnum == ps.entnum && ch.entchannel == ps.entchannel) { ! // always override sound from same entity ! if (ch.bufferId != ps.bufferId) { ! AL10.alSourceStop(ch.sourceId); ! } ! break; ! } ! // don't let monster sounds override player sounds ! if ((ch.entnum == Globals.cl.playernum+1) && (ps.entnum != Globals.cl.playernum+1) && ch.bufferId != -1) ! continue; ! // looking for a free AL source ! if (!ch.active) { ! break; ! } } ! ! if (i == numChannels) ! return false; ! ! ch.type = ps.type; ! if (ps.type == Channel.FIXED) ! Math3D.VectorCopy(ps.origin, ch.origin); ! ch.entnum = ps.entnum; ! ch.entchannel = ps.entchannel; ! ch.bufferChanged = (ch.bufferId != ps.bufferId); ! ch.bufferId = ps.bufferId; ! ch.rolloff = ps.attenuation * 2; ! ch.volumeChanged = (ch.volume != ps.volume); ! ch.volume = ps.volume; ch.active = true; ch.modified = true; ! return true; } ! ! private static Channel pickForLoop(int bufferId, float attenuation) { ! Channel ch; ! for (int i = 0; i < numChannels; i++) { ! ch = channels[i]; ! // looking for a free AL source ! if (!ch.active) { ! ch.entnum = 0; ! ch.entchannel = 0; ! ch.bufferChanged = (ch.bufferId != bufferId); ! ch.bufferId = bufferId; ! ch.volumeChanged = (ch.volume != 1.0f); ! ch.volume = 1.0f; ! ch.rolloff = attenuation * 2; ! ch.active = true; ! ch.modified = true; ! return ch; ! } ! } ! return null; } - - private static FloatBuffer sourceOriginBuffer = Lib.newFloatBuffer(3); ! //stack variable ! private static float[] entityOrigin = {0, 0, 0}; ! ! static void playAllSounds(FloatBuffer listenerOrigin) { ! FloatBuffer sourceOrigin = sourceOriginBuffer; ! Channel ch; ! int sourceId; ! int state; ! for (int i = 0; i < numChannels; i++) { ! ch = channels[i]; ! if (ch.active) { ! sourceId = ch.sourceId; ! switch (ch.type) { ! case Channel.LISTENER: ! sourceOrigin.put(0, listenerOrigin.get(0)); ! sourceOrigin.put(1, listenerOrigin.get(1)); ! sourceOrigin.put(2, listenerOrigin.get(2)); ! break; ! case Channel.DYNAMIC: ! CL_ents.GetEntitySoundOrigin(ch.entnum, entityOrigin); ! convertVector(entityOrigin, sourceOrigin); ! break; ! case Channel.FIXED: ! convertVector(ch.origin, sourceOrigin); ! break; ! } ! if (ch.modified) { ! if (ch.bufferChanged) { ! AL10.alSourcei(sourceId, AL10.AL_BUFFER, ch.bufferId); ! } ! if (ch.volumeChanged) { ! AL10.alSourcef (sourceId, AL10.AL_GAIN, ch.volume); ! } ! AL10.alSourcef (sourceId, AL10.AL_ROLLOFF_FACTOR, ch.rolloff); ! AL10.nalSourcefv(sourceId, AL10.AL_POSITION, sourceOrigin, 0); ! AL10.alSourcePlay(sourceId); ! ch.modified = false; ! } else { ! state = AL10.alGetSourcei(sourceId, AL10.AL_SOURCE_STATE); ! if (state == AL10.AL_PLAYING) { ! AL10.nalSourcefv(sourceId, AL10.AL_POSITION, sourceOrigin, 0); ! } else { ! ch.clear(); ! } ! } ! ch.autosound = false; } } } ! ! /* ! * adddLoopSounds ! * Entities with a ->sound field will generated looped sounds ! * that are automatically started, stopped, and merged together ! * as the entities are sent to the client ! */ ! static void addLoopSounds() { ! ! if ((Globals.cl_paused.value != 0.0f) || (Globals.cls.state != Globals.ca_active) || !Globals.cl.sound_prepped) { ! removeUnusedLoopSounds(); ! return; ! } ! ! Channel ch; ! sfx_t sfx; ! sfxcache_t sc; ! int num; ! entity_state_t ent; ! Object key; ! int sound = 0; ! for (int i=0 ; i<Globals.cl.frame.num_entities ; i++) { ! num = (Globals.cl.frame.parse_entities + i)&(Defines.MAX_PARSE_ENTITIES-1); ! ent = Globals.cl_parse_entities[num]; ! sound = ent.sound; ! if (sound == 0) continue; ! key = new Integer(ent.number); ! ch = (Channel)looptable.get(key); ! if (ch != null) { ! // keep on looping ! ch.autosound = true; ! Math3D.VectorCopy(ent.origin, ch.origin); ! continue; ! } ! sfx = Globals.cl.sound_precache[sound]; ! if (sfx == null) ! continue; // bad sound effect ! sc = sfx.cache; ! if (sc == null) ! continue; ! // allocate a channel ! ch = Channel.pickForLoop(buffers.get(sfx.bufferId), 6); ! if (ch == null) ! break; ! ! ch.type = FIXED; ! Math3D.VectorCopy(ent.origin, ch.origin); ! ch.autosound = true; ! ! looptable.put(key, ch); ! AL10.alSourcei(ch.sourceId, AL10.AL_LOOPING, AL10.AL_TRUE); ! } ! removeUnusedLoopSounds(); ! } ! ! private static void removeUnusedLoopSounds() { ! Channel ch; ! // stop unused loopsounds ! for (Iterator iter = looptable.values().iterator(); iter.hasNext();) { ! ch = (Channel)iter.next(); ! if (!ch.autosound) { ! AL10.alSourceStop(ch.sourceId); ! AL10.alSourcei(ch.sourceId, AL10.AL_LOOPING, AL10.AL_FALSE); ! iter.remove(); ! ch.clear(); ! } ! } ! } ! static void convertVector(float[] from, FloatBuffer to) { ! to.put(0, from[0]); ! to.put(1, from[2]); ! to.put(2, -from[1]); } ! static void convertOrientation(float[] forward, float[] up, FloatBuffer orientation) { ! orientation.put(0, forward[0]); ! orientation.put(1, forward[2]); ! orientation.put(2, -forward[1]); ! orientation.put(3, up[0]); ! orientation.put(4, up[2]); ! orientation.put(5, -up[1]); } } --- 51,445 ---- public class Channel { ! final static int LISTENER = 0; ! final static int FIXED = 1; ! final static int DYNAMIC = 2; ! final static int MAX_CHANNELS = 32; ! private final static FloatBuffer NULLVECTOR = Lib.newFloatBuffer(3); ! ! private static Channel[] channels = new Channel[MAX_CHANNELS]; ! private static IntBuffer sources = Lib.newIntBuffer(MAX_CHANNELS); ! // a reference of L:WJGLSoundImpl.buffers ! private static IntBuffer buffers; ! private static Map looptable = new Hashtable(MAX_CHANNELS); ! ! private static int numChannels; // stream handling private static boolean streamingEnabled = false; private static int streamQueue = 0; ! // sound attributes ! private int type; ! private int entnum; ! private int entchannel; ! private int bufferId; ! private int sourceId; ! private float volume; ! private float rolloff; ! private float[] origin = {0, 0, 0}; ! // update flags ! private boolean autosound; ! private boolean active; ! private boolean modified; ! private boolean bufferChanged; ! private boolean volumeChanged; ! private Channel(int sourceId) { ! this.sourceId = sourceId; ! clear(); ! volumeChanged = false; ! volume = 1.0f; ! } ! private void clear() { ! entnum = entchannel = bufferId = -1; ! bufferChanged = false; ! rolloff = 0; ! autosound = false; ! active = false; ! modified = false; ! } ! private static IntBuffer tmp = Lib.newIntBuffer(1); ! ! static int init(IntBuffer buffers) { ! Channel.buffers = buffers; ! // create channels ! int sourceId; ! for (int i = 0; i < MAX_CHANNELS; i++) { ! ! AL10.alGenSources(tmp); ! sourceId = tmp.get(0); ! ! // can't generate more sources ! if (sourceId <= 0) break; ! ! sources.put(i, sourceId); ! ! channels[i] = new Channel(sourceId); ! numChannels++; ! ! // set default values for AL sources ! 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.alSource(sourceId, AL10.AL_VELOCITY, NULLVECTOR); ! AL10.alSourcei (sourceId, AL10.AL_LOOPING, AL10.AL_FALSE); ! AL10.alSourcef (sourceId, AL10.AL_REFERENCE_DISTANCE, 200.0f); ! AL10.alSourcef (sourceId, AL10.AL_MIN_GAIN, 0.0005f); ! AL10.alSourcef (sourceId, AL10.AL_MAX_GAIN, 1.0f); } ! return numChannels; ! } ! ! static void reset() { ! for (int i = 0; i < numChannels; i++) { ! AL10.alSourceStop(sources.get(i)); ! AL10.alSourcei(sources.get(i), AL10.AL_BUFFER, 0); ! channels[i].clear(); } ! } ! ! static void shutdown() { ! AL10.alDeleteSources(sources); ! numChannels = 0; ! } ! static void enableStreaming() { ! if (streamingEnabled) return; ! // use the last source ! numChannels--; ! streamingEnabled = true; ! streamQueue = 0; ! int source = channels[numChannels].sourceId; ! AL10.alSourcei (source, AL10.AL_SOURCE_RELATIVE, AL10.AL_TRUE); ! AL10.alSourcef(source, AL10.AL_GAIN, 1.0f); ! channels[numChannels].volumeChanged = true; ! ! Com.DPrintf("streaming enabled\n"); } static void disableStreaming() { ! if (!streamingEnabled) return; ! unqueueStreams(); ! int source = channels[numChannels].sourceId; ! AL10.alSourcei (source, AL10.AL_SOURCE_RELATIVE, AL10.AL_FALSE); ! // free the last source ! numChannels++; ! streamingEnabled = false; ! Com.DPrintf("streaming disabled\n"); } ! static void unqueueStreams() { ! if (!streamingEnabled) return; ! int source = channels[numChannels].sourceId; ! // stop streaming ! AL10.alSourceStop(source); ! int count = AL10.alGetSourcei(source, AL10.AL_BUFFERS_QUEUED); ! Com.DPrintf("unqueue " + count + " buffers\n"); ! while (count-- > 0) { ! AL10.alSourceUnqueueBuffers(source, tmp); ! } ! streamQueue = 0; } static void updateStream(ByteBuffer samples, int count, int format, int rate) { ! enableStreaming(); ! int source = channels[numChannels].sourceId; ! int processed = AL10.alGetSourcei(source, AL10.AL_BUFFERS_PROCESSED); ! boolean playing = (AL10.alGetSourcei(source, AL10.AL_SOURCE_STATE) == AL10.AL_PLAYING); ! boolean interupted = !playing && streamQueue > 2; ! ! IntBuffer buffer = tmp; ! if (interupted) { ! unqueueStreams(); ! buffer.put(0, buffers.get(Sound.MAX_SFX + streamQueue++)); ! Com.DPrintf("queue " + (streamQueue - 1) + '\n'); ! } else if (processed < 2) { ! // check queue overrun ! if (streamQueue >= Sound.STREAM_QUEUE) return; ! buffer.put(0, buffers.get(Sound.MAX_SFX + streamQueue++)); ! Com.DPrintf("queue " + (streamQueue - 1) + '\n'); ! } else { ! // reuse the buffer ! AL10.alSourceUnqueueBuffers(source, buffer); } ! samples.position(0); ! samples.limit(count); ! AL10.alBufferData(buffer.get(0), format, samples, rate); ! AL10.alSourceQueueBuffers(source, buffer); ! if (streamQueue > 1 && !playing) { ! Com.DPrintf("start sound\n"); ! AL10.alSourcePlay(source); ! } ! } ! static void addPlaySounds() { ! while (Channel.assign(PlaySound.nextPlayableSound())); ! } ! ! private static boolean assign(PlaySound ps) { ! if (ps == null) return false; ! Channel ch = null; ! int i; ! for (i = 0; i < numChannels; i++) { ! ch = channels[i]; ! ! if (ps.entchannel != 0 && ch.entnum == ps.entnum && ch.entchannel == ps.entchannel) { ! // always override sound from same entity ! if (ch.bufferId != ps.bufferId) { ! AL10.alSourceStop(ch.sourceId); } ! break; ! } ! ! // don't let monster sounds override player sounds ! if ((ch.entnum == Globals.cl.playernum+1) && (ps.entnum != Globals.cl.playernum+1) && ch.bufferId != -1) ! continue; ! ! // looking for a free AL source ! if (!ch.active) { ! break; ! } ! } ! ! if (i == numChannels) ! return false; ! ! ch.type = ps.type; ! if (ps.type == Channel.FIXED) ! Math3D.VectorCopy(ps.origin, ch.origin); ! ch.entnum = ps.entnum; ! ch.entchannel = ps.entchannel; ! ch.bufferChanged = (ch.bufferId != ps.bufferId); ! ch.bufferId = ps.bufferId; ! ch.rolloff = ps.attenuation * 2; ! ch.volumeChanged = (ch.volume != ps.volume); ! ch.volume = ps.volume; ! ch.active = true; ! ch.modified = true; ! return true; ! } ! ! private static Channel pickForLoop(int bufferId, float attenuation) { ! Channel ch; ! for (int i = 0; i < numChannels; i++) { ! ch = channels[i]; ! // looking for a free AL source ! if (!ch.active) { ! ch.entnum = 0; ! ch.entchannel = 0; ! ch.bufferChanged = (ch.bufferId != bufferId); ! ch.bufferId = bufferId; ! ch.volumeChanged = (ch.volume != 1.0f); ! ch.volume = 1.0f; ! ch.rolloff = attenuation * 2; ch.active = true; ch.modified = true; ! return ch; ! } } ! return null; } ! private static FloatBuffer sourceOriginBuffer = Lib.newFloatBuffer(3); ! //stack variable ! private static float[] entityOrigin = {0, 0, 0}; ! static void playAllSounds(FloatBuffer listenerOrigin) { ! FloatBuffer sourceOrigin = sourceOriginBuffer; ! Channel ch; ! int sourceId; ! int state; ! ! for (int i = 0; i < numChannels; i++) { ! ch = channels[i]; ! if (ch.active) { ! sourceId = ch.sourceId; ! switch (ch.type) { ! case Channel.LISTENER: ! sourceOrigin.put(0, listenerOrigin.get(0)); ! sourceOrigin.put(1, listenerOrigin.get(1)); ! sourceOrigin.put(2, listenerOrigin.get(2)); ! break; ! case Channel.DYNAMIC: ! CL_ents.GetEntitySoundOrigin(ch.entnum, entityOrigin); ! convertVector(entityOrigin, sourceOrigin); ! break; ! case Channel.FIXED: ! convertVector(ch.origin, sourceOrigin); ! break; ! } ! ! if (ch.modified) { ! if (ch.bufferChanged) { ! try { ! AL10.alSourcei(sourceId, AL10.AL_BUFFER, ch.bufferId); ! } catch (OpenALException e) { ! // fallback for buffer changing ! AL10.alSourceStop(sourceId); ! AL10.alSourcei(sourceId, AL10.AL_BUFFER, ch.bufferId); } + } + if (ch.volumeChanged) { + AL10.alSourcef (sourceId, AL10.AL_GAIN, ch.volume); + } + AL10.alSourcef (sourceId, AL10.AL_ROLLOFF_FACTOR, ch.rolloff); + AL10.alSource(sourceId, AL10.AL_POSITION, sourceOrigin); + AL10.alSourcePlay(sourceId); + ch.modified = false; + } else { + state = AL10.alGetSourcei(sourceId, AL10.AL_SOURCE_STATE); + if (state == AL10.AL_PLAYING) { + AL10.alSource(sourceId, AL10.AL_POSITION, sourceOrigin); + } else { + ch.clear(); + } } + ch.autosound = false; + } } ! } ! /* ! * adddLoopSounds ! * Entities with a ->sound field will generated looped sounds ! * that are automatically started, stopped, and merged together ! * as the entities are sent to the client ! */ ! static void addLoopSounds() { ! if ((Globals.cl_paused.value != 0.0f) || (Globals.cls.state != Globals.ca_active) || !Globals.cl.sound_prepped) { ! removeUnusedLoopSounds(); ! return; ! } ! Channel ch; ! sfx_t sfx; ! sfxcache_t sc; ! int num; ! entity_state_t ent; ! Object key; ! int sound = 0; ! for (int i=0 ; i<Globals.cl.frame.num_entities ; i++) { ! num = (Globals.cl.frame.parse_entities + i)&(Defines.MAX_PARSE_ENTITIES-1); ! ent = Globals.cl_parse_entities[num]; ! sound = ent.sound; ! if (sound == 0) continue; ! key = new Integer(ent.number); ! ch = (Channel)looptable.get(key); ! if (ch != null) { ! // keep on looping ! ch.autosound = true; ! Math3D.VectorCopy(ent.origin, ch.origin); ! continue; ! } ! sfx = Globals.cl.sound_precache[sound]; ! if (sfx == null) ! continue; // bad sound effect ! sc = sfx.cache; ! if (sc == null) ! continue; ! // allocate a channel ! ch = Channel.pickForLoop(buffers.get(sfx.bufferId), 6); ! if (ch == null) ! break; ! ! ch.type = FIXED; ! Math3D.VectorCopy(ent.origin, ch.origin); ! ch.autosound = true; ! ! looptable.put(key, ch); ! AL10.alSourcei(ch.sourceId, AL10.AL_LOOPING, AL10.AL_TRUE); } ! removeUnusedLoopSounds(); ! ! } ! ! private static void removeUnusedLoopSounds() { ! Channel ch; ! // stop unused loopsounds ! for (Iterator iter = looptable.values().iterator(); iter.hasNext();) { ! ch = (Channel)iter.next(); ! if (!ch.autosound) { ! AL10.alSourceStop(ch.sourceId); ! AL10.alSourcei(ch.sourceId, AL10.AL_LOOPING, AL10.AL_FALSE); ! iter.remove(); ! ch.clear(); ! } } + } + + static void convertVector(float[] from, FloatBuffer to) { + to.put(0, from[0]); + to.put(1, from[2]); + to.put(2, -from[1]); + } + + static void convertOrientation(float[] forward, float[] up, FloatBuffer orientation) { + orientation.put(0, forward[0]); + orientation.put(1, forward[2]); + orientation.put(2, -forward[1]); + orientation.put(3, up[0]); + orientation.put(4, up[2]); + orientation.put(5, -up[1]); + } } Index: LWJGLSoundImpl.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/sound/lwjgl/LWJGLSoundImpl.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** LWJGLSoundImpl.java 4 Dec 2005 17:27:34 -0000 1.8 --- LWJGLSoundImpl.java 26 Oct 2006 22:02:55 -0000 1.9 *************** *** 16,26 **** import java.nio.*; - import java.util.Random; - import org.lwjgl.LWJGLException; import org.lwjgl.openal.*; ! import org.lwjgl.openal.eax.EAX; ! import org.lwjgl.openal.eax.EAX20; ! import org.lwjgl.openal.eax.EAXListenerProperties; [...1095 lines suppressed...] ! Com.Printf("(%2db) %6i : %s\n", new Vargs(3).add(sc.width * 8).add(size).add(sfx.name)); ! } else { ! if (sfx.name.charAt(0) == '*') ! Com.Printf(" placeholder : " + sfx.name + "\n"); ! else ! Com.Printf(" not loaded : " + sfx.name + "\n"); ! } } ! Com.Printf("Total resident: " + total + "\n"); ! } ! void SoundInfo_f() { ! ! Com.Printf("%5d stereo\n", new Vargs(1).add(1)); ! Com.Printf("%5d samples\n", new Vargs(1).add(22050)); ! Com.Printf("%5d samplebits\n", new Vargs(1).add(16)); ! Com.Printf("%5d speed\n", new Vargs(1).add(44100)); ! } } |
From: Carsten W. <ca...@us...> - 2006-10-26 22:03:02
|
Update of /cvsroot/jake2/jake2/lib/lwjgl In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv3095/lib/lwjgl Modified Files: lwjgl_util.jar lwjgl.jar Log Message: switch to lwjgl 1.0beta3 (sound and gfx tested on MacBook Pro) Index: lwjgl.jar =================================================================== RCS file: /cvsroot/jake2/jake2/lib/lwjgl/lwjgl.jar,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvs17udAM and /tmp/cvsRlY6kI differ Index: lwjgl_util.jar =================================================================== RCS file: /cvsroot/jake2/jake2/lib/lwjgl/lwjgl_util.jar,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvs14bINS and /tmp/cvs8CgHDO differ |
From: Carsten W. <ca...@us...> - 2006-10-26 22:03:02
|
Update of /cvsroot/jake2/jake2/src/jake2/sys In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv3095/src/jake2/sys Modified Files: LWJGLKBD.java Log Message: switch to lwjgl 1.0beta3 (sound and gfx tested on MacBook Pro) Index: LWJGLKBD.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/sys/LWJGLKBD.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** LWJGLKBD.java 1 Jul 2005 14:20:54 -0000 1.10 --- LWJGLKBD.java 26 Oct 2006 22:02:56 -0000 1.11 *************** *** 26,34 **** if (!Keyboard.isCreated()) Keyboard.create(); if (!Mouse.isCreated()) Mouse.create(); ! ! if (!Keyboard.isBuffered()) Keyboard.enableBuffer(); ! if (!Keyboard.isTranslationEnabled()) Keyboard.enableTranslation(); ! if (!Mouse.isBuffered()) Mouse.enableBuffer(); ! if (lwjglKeycodeMap == null) lwjglKeycodeMap = new char[256]; if (pressed == null) pressed = new int[256]; --- 26,30 ---- if (!Keyboard.isCreated()) Keyboard.create(); if (!Mouse.isCreated()) Mouse.create(); ! if (lwjglKeycodeMap == null) lwjglKeycodeMap = new char[256]; if (pressed == null) pressed = new int[256]; |
From: Carsten W. <ca...@us...> - 2006-10-26 22:03:02
|
Update of /cvsroot/jake2/jake2/lib/lwjgl/windows In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv3095/lib/lwjgl/windows Modified Files: lwjgl.dll Added Files: OpenAL32.dll Removed Files: lwjglaudio.dll Log Message: switch to lwjgl 1.0beta3 (sound and gfx tested on MacBook Pro) Index: lwjgl.dll =================================================================== RCS file: /cvsroot/jake2/jake2/lib/lwjgl/windows/lwjgl.dll,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvsW9Kxee and /tmp/cvso73dEa differ --- NEW FILE: OpenAL32.dll --- (This appears to be a binary file; contents omitted.) --- lwjglaudio.dll DELETED --- |
From: Carsten W. <ca...@us...> - 2006-10-26 22:02:59
|
Update of /cvsroot/jake2/jake2/src/jake2/render/lwjgl In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv3095/src/jake2/render/lwjgl Modified Files: LWJGLBase.java Log Message: switch to lwjgl 1.0beta3 (sound and gfx tested on MacBook Pro) Index: LWJGLBase.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/lwjgl/LWJGLBase.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LWJGLBase.java 20 Dec 2004 21:51:18 -0000 1.2 --- LWJGLBase.java 26 Oct 2006 22:02:56 -0000 1.3 *************** *** 30,33 **** --- 30,34 ---- import jake2.client.viddef_t; import jake2.game.cvar_t; + import jake2.qcommon.Com; import jake2.qcommon.xcommand_t; *************** *** 73,77 **** public java.awt.DisplayMode[] getModeList() { ! DisplayMode[] modes = Display.getAvailableDisplayModes(); LinkedList l = new LinkedList(); --- 74,84 ---- 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(); *************** *** 107,111 **** public DisplayMode[] getLWJGLModeList() { ! DisplayMode[] modes = Display.getAvailableDisplayModes(); LinkedList l = new LinkedList(); --- 114,124 ---- public DisplayMode[] getLWJGLModeList() { ! DisplayMode[] modes; ! try { ! modes = Display.getAvailableDisplayModes(); ! } catch (LWJGLException e) { ! Com.Println(e.getMessage()); ! return new DisplayMode[0]; ! } LinkedList l = new LinkedList(); |
From: Carsten W. <ca...@us...> - 2006-10-26 22:02:59
|
Update of /cvsroot/jake2/jake2/lib/lwjgl/osx In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv3095/lib/lwjgl/osx Modified Files: openal.dylib liblwjgl.jnilib Log Message: switch to lwjgl 1.0beta3 (sound and gfx tested on MacBook Pro) Index: liblwjgl.jnilib =================================================================== RCS file: /cvsroot/jake2/jake2/lib/lwjgl/osx/liblwjgl.jnilib,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsowXDM3 and /tmp/cvsOtkBZZ differ Index: openal.dylib =================================================================== RCS file: /cvsroot/jake2/jake2/lib/lwjgl/osx/openal.dylib,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvs28XQL9 and /tmp/cvsoDvn45 differ |
From: Carsten W. <ca...@us...> - 2006-10-26 22:02:59
|
Update of /cvsroot/jake2/jake2/lib/lwjgl/linux In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv3095/lib/lwjgl/linux Modified Files: libopenal.so liblwjgl.so Added Files: liblwjgl64.so Log Message: switch to lwjgl 1.0beta3 (sound and gfx tested on MacBook Pro) --- NEW FILE: liblwjgl64.so --- (This appears to be a binary file; contents omitted.) Index: liblwjgl.so =================================================================== RCS file: /cvsroot/jake2/jake2/lib/lwjgl/linux/liblwjgl.so,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvsSyod3A and /tmp/cvsR0RQtw differ Index: libopenal.so =================================================================== RCS file: /cvsroot/jake2/jake2/lib/lwjgl/linux/libopenal.so,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvsT6bMsD and /tmp/cvsg01YXy differ |
From: Carsten W. <ca...@us...> - 2006-10-26 20:38:29
|
Update of /cvsroot/jake2/jake2/webstart In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv27615/webstart Modified Files: jake2_jogl11.jnlp Log Message: disable ATI_WORKAROUND (because of linux renderer crashs) Index: jake2_jogl11.jnlp =================================================================== RCS file: /cvsroot/jake2/jake2/webstart/jake2_jogl11.jnlp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** jake2_jogl11.jnlp 25 Oct 2006 20:13:16 -0000 1.14 --- jake2_jogl11.jnlp 26 Oct 2006 20:22:17 -0000 1.15 *************** *** 21,24 **** --- 21,25 ---- <jar href="http://jake2.sourceforge.net/lib/jake2.jar"/> <property name="sun.java2d.noddraw" value="true"/> + <property name="ATI_WORKAROUND" value="false"/> <extension name="jogl" href="https://jogl.dev.java.net/webstart/jogl-1-1.jnlp"/> <extension name="joal" href="http://download.java.net/media/joal/webstart/joal.jnlp" /> |
From: Carsten W. <ca...@us...> - 2006-10-25 21:13:17
|
Update of /cvsroot/jake2/jake2/scripts In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv2298/scripts Modified Files: Jake2_dedicated.sh Jake2.sh Jake2_mac.sh Jake2.bat Log Message: corrected classpath (joal needs a gluegen runtime lib) Index: Jake2_dedicated.sh =================================================================== RCS file: /cvsroot/jake2/jake2/scripts/Jake2_dedicated.sh,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Jake2_dedicated.sh 24 Oct 2006 22:15:52 -0000 1.2 --- Jake2_dedicated.sh 25 Oct 2006 21:13:10 -0000 1.3 *************** *** 5,7 **** CP=lib/jake2.jar ! exec java -Xmx64M -cp $CP jake2.Jake2 --- 5,7 ---- CP=lib/jake2.jar ! exec java -Xmx64M -cp $CP jake2.Jake2 +set dedicated 1 Index: Jake2.sh =================================================================== RCS file: /cvsroot/jake2/jake2/scripts/Jake2.sh,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Jake2.sh 24 Oct 2006 23:00:44 -0000 1.7 --- Jake2.sh 25 Oct 2006 21:13:11 -0000 1.8 *************** *** 4,8 **** export LD_LIBRARY_PATH=lib/linux ! CP=lib/jake2.jar:lib/jogl.jar:lib/joal.jar exec java -Xmx100M -Djava.library.path=lib/linux -cp $CP jake2.Jake2 --- 4,8 ---- export LD_LIBRARY_PATH=lib/linux ! CP=lib/jake2.jar:lib/jogl.jar:lib/joal.jar:lib/gluegen-rt.jar exec java -Xmx100M -Djava.library.path=lib/linux -cp $CP jake2.Jake2 Index: Jake2_mac.sh =================================================================== RCS file: /cvsroot/jake2/jake2/scripts/Jake2_mac.sh,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Jake2_mac.sh 24 Oct 2006 23:00:44 -0000 1.4 --- Jake2_mac.sh 25 Oct 2006 21:13:11 -0000 1.5 *************** *** 3,7 **** export LD_LIBRARY_PATH=lib/osx export DYLD_LIBRARY_PATH=lib/osx ! CP=lib/jake2.jar:lib/jogl.jar:lib/joal.jar exec java -Xmx100M -Djava.library.path=lib/osx -cp $CP jake2.Jake2 --- 3,7 ---- export LD_LIBRARY_PATH=lib/osx export DYLD_LIBRARY_PATH=lib/osx ! CP=lib/jake2.jar:lib/jogl.jar:lib/joal.jar:lib/gluegen-rt.jar exec java -Xmx100M -Djava.library.path=lib/osx -cp $CP jake2.Jake2 Index: Jake2.bat =================================================================== RCS file: /cvsroot/jake2/jake2/scripts/Jake2.bat,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Jake2.bat 24 Oct 2006 23:00:44 -0000 1.7 --- Jake2.bat 25 Oct 2006 21:13:11 -0000 1.8 *************** *** 1,4 **** @echo off SET PATH=lib\windows;%PATH% ! SET CP=lib/jake2.jar;lib/jogl.jar;lib/joal.jar start javaw -Xmx100M -Dsun.java2d.noddraw=true -Djava.library.path=lib/windows -cp %CP% jake2.Jake2 \ No newline at end of file --- 1,4 ---- @echo off SET PATH=lib\windows;%PATH% ! SET CP=lib/jake2.jar;lib/jogl.jar;lib/joal.jar;lib/gluegen-rt.jar start javaw -Xmx100M -Dsun.java2d.noddraw=true -Djava.library.path=lib/windows -cp %CP% jake2.Jake2 \ No newline at end of file |
From: Carsten W. <ca...@us...> - 2006-10-25 21:04:44
|
Update of /cvsroot/jake2/jake2 In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv30129 Modified Files: build.xml Log Message: joal via webstart from sun * patch removed * joal-native jar build removed Index: build.xml =================================================================== RCS file: /cvsroot/jake2/jake2/build.xml,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** build.xml 24 Oct 2006 22:15:52 -0000 1.29 --- build.xml 25 Oct 2006 21:04:38 -0000 1.30 *************** *** 23,27 **** <path id="build.class.path"> <pathelement location="lib/jogl/jogl.jar"/> ! <pathelement location="lib/joal/linux/joal.jar"/> <pathelement location="lib/lwjgl/lwjgl.jar"/> <pathelement location="lib/lwjgl/lwjgl_util.jar"/> --- 23,27 ---- <path id="build.class.path"> <pathelement location="lib/jogl/jogl.jar"/> ! <pathelement location="lib/joal/joal.jar"/> <pathelement location="lib/lwjgl/lwjgl.jar"/> <pathelement location="lib/lwjgl/lwjgl_util.jar"/> *************** *** 72,75 **** --- 72,78 ---- <include name="*.jar"/> </fileset> + <fileset dir="lib/joal"> + <include name="*.jar"/> + </fileset> <fileset dir="lib/lwjgl"> <include name="*.jar"/> *************** *** 152,156 **** <injar name="jake2.jar"/> <libraryjar name="lib/jogl/jogl.jar"/> ! <libraryjar name="lib/joal/linux/joal.jar"/> <libraryjar name="${classes}"/> <keep access="public" name="jake2.Jake2"> --- 155,160 ---- <injar name="jake2.jar"/> <libraryjar name="lib/jogl/jogl.jar"/> ! <libraryjar name="lib/joal/joal.jar"/> ! <libraryjar name="lib/joal/gluegen-rt.jar"/> <libraryjar name="${classes}"/> <keep access="public" name="jake2.Jake2"> *************** *** 195,199 **** <tarfileset dir="." prefix="Jake2"> <include name="src/jake2/**"/> - <include name="patch/**"/> <include name="resources/**"/> <include name="lib/**"/> --- 199,202 ---- *************** *** 211,215 **** <zipfileset dir="." prefix="Jake2"> <include name="src/jake2/**"/> - <include name="patch/**"/> <include name="resources/**"/> <include name="scripts/*.*"/> --- 214,217 ---- *************** *** 238,242 **** <!-- webstart --> ! <target name="webstart" depends="dist,patch"> <mkdir dir="webstart/lib"/> <copy todir="webstart/lib"> --- 240,244 ---- <!-- webstart --> ! <target name="webstart" depends="dist"> <mkdir dir="webstart/lib"/> <copy todir="webstart/lib"> *************** *** 244,273 **** <include name="**/*.jar"/> <exclude name="jogl.jar"/> ! </fileset> ! <fileset dir="."> ! <include name="patch.jar"/> </fileset> </copy> ! <jar destfile="webstart/lib/linux/joal-native.jar" basedir="${dist}/lib/linux"> ! <include name="libjoal.so"/> ! </jar> <jar destfile="webstart/lib/linux/lwjgl-native.jar" basedir="${dist}/lib/linux/lwjgl"> <include name="*.so"/> </jar> ! <jar destfile="webstart/lib/linux/openal.jar" basedir="${dist}/lib/linux"> ! <include name="libopenal.so"/> ! </jar> ! <jar destfile="webstart/lib/osx/joal-native.jar" basedir="${dist}/lib/osx"> ! <include name="libjoal.jnilib"/> ! </jar> ! <jar destfile="webstart/lib/osx/lwjgl-native.jar" basedir="${dist}/lib/osx"> ! <include name="liblwjgl.jnilib"/> ! <include name="openal.dylib"/> ! </jar> ! <jar destfile="webstart/lib/windows/joal-native.jar" basedir="${dist}/lib/windows"> ! <include name="joal.dll"/> ! <include name="OpenAL32.dll"/> ! </jar> <jar destfile="webstart/lib/windows/lwjgl-native.jar" basedir="${dist}/lib/windows"> <include name="lwjgl.dll"/> --- 246,259 ---- <include name="**/*.jar"/> <exclude name="jogl.jar"/> ! <exclude name="joal.jar"/> ! <exclude name="gluegen-rt.jar"/> </fileset> </copy> ! <mkdir dir="webstart/lib/linux"/> <jar destfile="webstart/lib/linux/lwjgl-native.jar" basedir="${dist}/lib/linux/lwjgl"> <include name="*.so"/> </jar> ! <mkdir dir="webstart/lib/windows"/> <jar destfile="webstart/lib/windows/lwjgl-native.jar" basedir="${dist}/lib/windows"> <include name="lwjgl.dll"/> *************** *** 299,313 **** </delete> </target> - - <!-- patch --> - <target name="patch"> - <javac destdir="${build}" optimize="on" debug="off" source="1.4"> - <src path="${patch}"/> - <include name="**"/> - <classpath refid="build.class.path"/> - </javac> - <jar destfile="patch.jar" basedir="${build}"> - <include name="net/**"/> - </jar> - </target> </project> \ No newline at end of file --- 285,287 ---- |