From: Rene S. <sa...@us...> - 2005-01-23 21:32:38
|
Update of /cvsroot/jake2/jake2/src/jake2/render/lwjgl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8896/src/jake2/render/lwjgl Modified Files: Tag: RST Light.java Warp.java Main.java Mesh.java Surf.java Log Message: added debug messages, fixed cooperative multiplayer bugs. Index: Light.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/lwjgl/Light.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** Light.java 14 Dec 2004 12:56:59 -0000 1.2 --- Light.java 23 Jan 2005 21:31:47 -0000 1.2.2.1 *************** *** 37,40 **** --- 37,41 ---- import jake2.render.mtexinfo_t; import jake2.util.Math3D; + import jake2.util.Vec3Cache; import java.nio.ByteBuffer; *************** *** 64,75 **** */ [...1014 lines suppressed...] ! 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); ! } ! } ! } ! } ! ! } \ No newline at end of file Index: Warp.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/lwjgl/Warp.java,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -C2 -d -r1.2.2.1 -r1.2.2.2 *** Warp.java 16 Jan 2005 21:21:08 -0000 1.2.2.1 --- Warp.java 23 Jan 2005 21:31:48 -0000 1.2.2.2 *************** *** 31,34 **** --- 31,35 ---- import jake2.render.*; import jake2.util.Math3D; + import jake2.util.Vec3Cache; import org.lwjgl.opengl.GL11; *************** *** 40,45 **** */ public abstract class Warp extends Model { - - // warpsin.h public static final float[] SIN = { --- 41,44 ---- *************** *** 78,84 **** }; - // gl_warp.c -- sky and water polygons - //extern model_t *loadmodel; // Model.java - String skyname; float skyrotate; --- 77,80 ---- *************** *** 90,105 **** static final int SUBDIVIDE_SIZE = 64; ! void BoundPoly(int numverts, float[][] verts, float[] mins, float[] maxs) ! { ! int i, j; ! float[] v; ! mins[0] = mins[1] = mins[2] = 9999; maxs[0] = maxs[1] = maxs[2] = -9999; ! for (i=0 ; i<numverts ; i++) ! { v = verts[i]; ! for (j=0 ; j<3 ; j++) ! { if (v[j] < mins[j]) mins[j] = v[j]; --- 86,105 ---- static final int SUBDIVIDE_SIZE = 64; ! /** ! * BoundPoly ! * @param numverts ! * @param verts ! * @param mins ! * @param maxs ! */ ! void BoundPoly(int numverts, float[][] verts, float[] mins, float[] maxs) { mins[0] = mins[1] = mins[2] = 9999; maxs[0] = maxs[1] = maxs[2] = -9999; ! ! int j; ! float[] v; ! for (int i=0 ; i<numverts ; i++) { v = verts[i]; ! for (j=0 ; j<3 ; j++) { if (v[j] < mins[j]) mins[j] = v[j]; *************** *** 110,120 **** } void SubdividePolygon(int numverts, float[][] verts) { int i, j, k; - float[] mins = {0, 0, 0}; - float[] maxs = {0, 0, 0}; float m; - float[] v = {0, 0, 0}; float[][] front = new float[64][3]; float[][] back = new float[64][3]; --- 110,122 ---- } + /** + * SubdividePolygon + * @param numverts + * @param verts + */ void SubdividePolygon(int numverts, float[][] verts) { int i, j, k; float m; float[][] front = new float[64][3]; float[][] back = new float[64][3]; *************** *** 123,135 **** float[] dist = new float[64]; float frac; - float s, t; - float[] total = {0, 0, 0}; - float total_s, total_t; if (numverts > 60) Com.Error(Defines.ERR_DROP, "numverts = " + numverts); ! BoundPoly(numverts, verts, mins, maxs); // x,y und z for (i=0 ; i<3 ; i++) --- 125,137 ---- float[] dist = new float[64]; float frac; if (numverts > 60) Com.Error(Defines.ERR_DROP, "numverts = " + numverts); ! float[] mins = Vec3Cache.get(); ! float[] maxs = Vec3Cache.get(); + BoundPoly(numverts, verts, mins, maxs); + float[] v; // x,y und z for (i=0 ; i<3 ; i++) *************** *** 151,155 **** Math3D.VectorCopy(verts[0], verts[numverts]); ! f = b = 0; for (j=0 ; j<numverts ; j++) --- 153,157 ---- Math3D.VectorCopy(verts[0], verts[numverts]); ! f = b = 0; for (j=0 ; j<numverts ; j++) *************** *** 182,188 **** SubdividePolygon(f, front); SubdividePolygon(b, back); return; } ! // add a point in the center to help keep warp valid --- 184,194 ---- SubdividePolygon(f, front); SubdividePolygon(b, back); + + Vec3Cache.release(2); // mins, maxs return; } ! ! Vec3Cache.release(2); // mins, maxs ! // add a point in the center to help keep warp valid *************** *** 195,202 **** poly.next = warpface.polys; warpface.polys = poly; Math3D.VectorClear(total); ! total_s = 0; ! total_t = 0; ! for (i = 0; i < numverts; i++) { poly.x(i + 1, verts[i][0]); poly.y(i + 1, verts[i][1]); --- 201,211 ---- poly.next = warpface.polys; warpface.polys = poly; + + float[] total = Vec3Cache.get(); Math3D.VectorClear(total); ! float total_s = 0; ! float total_t = 0; ! float s, t; ! for (i = 0; i < numverts; i++) { poly.x(i + 1, verts[i][0]); poly.y(i + 1, verts[i][1]); *************** *** 227,243 **** poly.s2(i + 1, poly.s2(1)); poly.t2(i + 1, poly.t2(1)); } ! /* ! ================ ! GL_SubdivideSurface ! ! Breaks a polygon up along axial 64 unit ! boundaries so that turbulent and sky warps ! can be done reasonably. ! ================ ! */ ! float[][] tmpVerts = new float[64][3]; ! void GL_SubdivideSurface(msurface_t fa) { float[][] verts = tmpVerts; --- 236,250 ---- poly.s2(i + 1, poly.s2(1)); poly.t2(i + 1, poly.t2(1)); + + Vec3Cache.release(); // total } ! private final float[][] tmpVerts = new float[64][3]; ! /** ! * GL_SubdivideSurface ! * Breaks a polygon up along axial 64 unit ! * boundaries so that turbulent and sky warps ! * can be done reasonably. ! */ void GL_SubdivideSurface(msurface_t fa) { float[][] verts = tmpVerts; *************** *** 261,293 **** } ! // ========================================================= ! ! ! ! //// speed up sin calculations - Ed ! // float r_turbsin[] = ! // { ! // #include "warpsin.h" ! // }; static final float TURBSCALE = (float)(256.0f / (2 * Math.PI)); ! /* ! ============= ! EmitWaterPolys ! ! Does a water warp on the pre-fragmented glpoly_t chain ! ============= ! */ void EmitWaterPolys(msurface_t fa) { - glpoly_t p, bp; - float[] v; - int i; - float s = 0; - float t = 0; - float os, ot; - float scroll; float rdt = r_newrefdef.time; if ((fa.texinfo.flags & Defines.SURF_FLOWING) != 0) scroll = -64 * ( (r_newrefdef.time*0.5f) - (int)(r_newrefdef.time*0.5f) ); --- 268,283 ---- } ! // ========================================================= static final float TURBSCALE = (float)(256.0f / (2 * Math.PI)); ! /** ! * EmitWaterPolys ! * Does a water warp on the pre-fragmented glpoly_t chain ! */ void EmitWaterPolys(msurface_t fa) { float rdt = r_newrefdef.time; + float scroll; if ((fa.texinfo.flags & Defines.SURF_FLOWING) != 0) scroll = -64 * ( (r_newrefdef.time*0.5f) - (int)(r_newrefdef.time*0.5f) ); *************** *** 295,298 **** --- 285,291 ---- scroll = 0; + int i; + float s, t, os, ot; + glpoly_t p, bp; for (bp = fa.polys; bp != null; bp = bp.next) { p = bp; *************** *** 321,325 **** // =================================================================== - float[][] skyclip = { { 1, 1, 0}, --- 314,317 ---- *************** *** 364,379 **** float sky_min, sky_max; ! void DrawSkyPolygon (int nump, float[][] vecs) { - int i,j; - float[] v = {0, 0, 0}; - float[] av = {0, 0, 0}; - float s, t, dv; - int axis; - float[] vp; - c_sky++; // decide which face it maps to Math3D.VectorCopy(Globals.vec3_origin, v); for (i=0; i<nump ; i++) { --- 356,373 ---- float sky_min, sky_max; ! // stack variable ! private final float[] v = {0, 0, 0}; ! private final float[] av = {0, 0, 0}; ! /** ! * DrawSkyPolygon ! * @param nump ! * @param vecs ! */ ! void DrawSkyPolygon(int nump, float[][] vecs) { c_sky++; // decide which face it maps to Math3D.VectorCopy(Globals.vec3_origin, v); + int i, axis; for (i=0; i<nump ; i++) { *************** *** 406,409 **** --- 400,405 ---- // project new texture coords + float s, t, dv; + int j; for (i=0 ; i<nump ; i++) { *************** *** 448,460 **** float[][][][] newv = new float[6][2][MAX_CLIP_VERTS][3]; void ClipSkyPolygon(int nump, float[][] vecs, int stage) { - float[] norm; - float[] v; - boolean front, back; - float d, e; - int[] newc = { 0, 0 }; - int i, j; - if (nump > MAX_CLIP_VERTS-2) Com.Error(Defines.ERR_DROP, "ClipSkyPolygon: MAX_CLIP_VERTS"); --- 444,455 ---- float[][][][] newv = new float[6][2][MAX_CLIP_VERTS][3]; + /** + * ClipSkyPolygon + * @param nump + * @param vecs + * @param stage + */ void ClipSkyPolygon(int nump, float[][] vecs, int stage) { if (nump > MAX_CLIP_VERTS-2) Com.Error(Defines.ERR_DROP, "ClipSkyPolygon: MAX_CLIP_VERTS"); *************** *** 465,470 **** } ! front = back = false; ! norm = skyclip[stage]; for (i=0 ; i<nump ; i++) { --- 460,469 ---- } ! boolean front = false; ! boolean back = false; ! float[] norm = skyclip[stage]; ! ! int i; ! float d; for (i=0 ; i<nump ; i++) { *************** *** 495,500 **** dists[i] = dists[0]; Math3D.VectorCopy(vecs[0], vecs[i]); - newc[0] = newc[1] = 0; for (i=0; i<nump ; i++) { --- 494,502 ---- dists[i] = dists[0]; Math3D.VectorCopy(vecs[0], vecs[i]); + int newc0 = 0; int newc1 = 0; + float[] v; + float e; + int j; for (i=0; i<nump ; i++) { *************** *** 503,518 **** { case SIDE_FRONT: ! Math3D.VectorCopy(v, newv[stage][0][newc[0]]); ! newc[0]++; break; case SIDE_BACK: ! Math3D.VectorCopy(v, newv[stage][1][newc[1]]); ! newc[1]++; break; case SIDE_ON: ! Math3D.VectorCopy(v, newv[stage][0][newc[0]]); ! newc[0]++; ! Math3D.VectorCopy (v, newv[stage][1][newc[1]]); ! newc[1]++; break; } --- 505,520 ---- { case SIDE_FRONT: ! Math3D.VectorCopy(v, newv[stage][0][newc0]); ! newc0++; break; case SIDE_BACK: ! Math3D.VectorCopy(v, newv[stage][1][newc1]); ! newc1++; break; case SIDE_ON: ! Math3D.VectorCopy(v, newv[stage][0][newc0]); ! newc0++; ! Math3D.VectorCopy (v, newv[stage][1][newc1]); ! newc1++; break; } *************** *** 525,547 **** { e = v[j] + d * (vecs[i + 1][j] - v[j]); ! newv[stage][0][newc[0]][j] = e; ! newv[stage][1][newc[1]][j] = e; } ! newc[0]++; ! newc[1]++; } // continue ! ClipSkyPolygon(newc[0], newv[stage][0], stage+1); ! ClipSkyPolygon(newc[1], newv[stage][1], stage+1); } float[][] verts = new float[MAX_CLIP_VERTS][3]; ! /* ! ================= ! R_AddSkySurface ! ================= ! */ void R_AddSkySurface(msurface_t fa) { --- 527,547 ---- { e = v[j] + d * (vecs[i + 1][j] - v[j]); ! newv[stage][0][newc0][j] = e; ! newv[stage][1][newc1][j] = e; } ! newc0++; ! newc1++; } // continue ! ClipSkyPolygon(newc0, newv[stage][0], stage+1); ! ClipSkyPolygon(newc1, newv[stage][1], stage+1); } float[][] verts = new float[MAX_CLIP_VERTS][3]; ! /** ! * R_AddSkySurface ! */ void R_AddSkySurface(msurface_t fa) { *************** *** 557,593 **** } ! ! /* ! ============== ! R_ClearSkyBox ! ============== ! */ void R_ClearSkyBox() { for (int i=0 ; i<6 ; i++) { ! skymins[0][i] = skymins[1][i] = 9999; ! skymaxs[0][i] = skymaxs[1][i] = -9999; } } ! ! ! void MakeSkyVec (float s, float t, int axis) { - float[] v = {0, 0, 0}; - float[] b = {0, 0, 0}; - int j, k; - b[0] = s*2300; b[1] = t*2300; b[2] = 2300; for (j=0 ; j<3 ; j++) { k = st_to_vec[axis][j]; if (k < 0) ! v[j] = -b[-k - 1]; else ! v[j] = b[k - 1]; } --- 557,600 ---- } ! /** ! * R_ClearSkyBox ! */ void R_ClearSkyBox() { + float[] skymins0 = skymins[0]; + float[] skymins1 = skymins[1]; + float[] skymaxs0 = skymaxs[0]; + float[] skymaxs1 = skymaxs[1]; + for (int i=0 ; i<6 ; i++) { ! skymins0[i] = skymins1[i] = 9999; ! skymaxs0[i] = skymaxs1[i] = -9999; } } ! ! // stack variable ! private final float[] v1 = {0, 0, 0}; ! private final float[] b = {0, 0, 0}; ! /** ! * MakeSkyVec ! * @param s ! * @param t ! * @param axis ! */ ! void MakeSkyVec(float s, float t, int axis) { b[0] = s*2300; b[1] = t*2300; b[2] = 2300; + int j, k; for (j=0 ; j<3 ; j++) { k = st_to_vec[axis][j]; if (k < 0) ! v1[j] = -b[-k - 1]; else ! v1[j] = b[k - 1]; } *************** *** 607,620 **** t = 1.0f - t; gl.glTexCoord2f (s, t); ! gl.glVertex3f(v[0], v[1], v[2]); } - /* - ============== - R_DrawSkyBox - ============== - */ int[] skytexorder = {0,2,1,3,4,5}; void R_DrawSkyBox() { --- 614,625 ---- t = 1.0f - t; gl.glTexCoord2f (s, t); ! gl.glVertex3f(v1[0], v1[1], v1[2]); } int[] skytexorder = {0,2,1,3,4,5}; + /** + * R_DrawSkyBox + */ void R_DrawSkyBox() { *************** *** 661,680 **** } - - /* - ============ - R_SetSky - ============ - */ // 3dstudio environment map names String[] suf = {"rt", "bk", "lf", "ft", "up", "dn"}; protected void R_SetSky(String name, float rotate, float[] axis) { assert (axis.length == 3) : "vec3_t bug"; - int i; String pathname; - - // strncpy (skyname, name, sizeof(skyname)-1); skyname = name; --- 666,682 ---- } // 3dstudio environment map names String[] suf = {"rt", "bk", "lf", "ft", "up", "dn"}; + /** + * R_SetSky + * @param name + * @param rotate + * @param axis + */ protected void R_SetSky(String name, float rotate, float[] axis) { assert (axis.length == 3) : "vec3_t bug"; String pathname; skyname = name; *************** *** 682,686 **** Math3D.VectorCopy(axis, skyaxis); ! for (i=0 ; i<6 ; i++) { // chop down rotating skies for less memory --- 684,688 ---- Math3D.VectorCopy(axis, skyaxis); ! for (int i=0 ; i<6 ; i++) { // chop down rotating skies for less memory *************** *** 714,716 **** } } ! } --- 716,718 ---- } } ! } \ No newline at end of file Index: Mesh.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/lwjgl/Mesh.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** Mesh.java 14 Dec 2004 12:56:59 -0000 1.2 --- Mesh.java 23 Jan 2005 21:31:49 -0000 1.2.2.1 *************** *** 47,51 **** // g_mesh.c: triangle model functions - /* ============================================================= --- 47,50 ---- *************** *** 69,72 **** --- 68,80 ---- float[] shadedots = r_avertexnormal_dots[0]; + /** + * GL_LerpVerts + * @param nverts + * @param ov + * @param verts + * @param move + * @param frontv + * @param backv + */ void GL_LerpVerts(int nverts, qfiles.dtrivertx_t[] ov, qfiles.dtrivertx_t[] verts, float[] move, float[] frontv, float[] backv ) { *************** *** 115,136 **** }; ! /* ! ============= ! GL_DrawAliasFrameLerp ! ! interpolates between two frames and origins ! FIXME: batch lerp all vertexes ! ============= ! */ ! void GL_DrawAliasFrameLerp(qfiles.dmdl_t paliashdr, float backlerp) { - int count; - float alpha; - - float[] move = {0, 0, 0}; // vec3_t - float[] frontv = {0, 0, 0}; // vec3_t - float[] backv = {0, 0, 0}; // vec3_t - qfiles.daliasframe_t frame = paliashdr.aliasFrames[currententity.frame]; --- 123,138 ---- }; ! // stack variable ! private final float[] move = {0, 0, 0}; // vec3_t ! private final float[] frontv = {0, 0, 0}; // vec3_t ! private final float[] backv = {0, 0, 0}; // vec3_t ! /** ! * GL_DrawAliasFrameLerp ! * ! * interpolates between two frames and origins ! * FIXME: batch lerp all vertexes ! */ void GL_DrawAliasFrameLerp(qfiles.dmdl_t paliashdr, float backlerp) { qfiles.daliasframe_t frame = paliashdr.aliasFrames[currententity.frame]; *************** *** 141,144 **** --- 143,147 ---- qfiles.dtrivertx_t[] ov = oldframe.verts; + float alpha; if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0) alpha = currententity.alpha; *************** *** 217,221 **** int dstIndex = 0; int srcIndex = 0; ! for (int j = 0; j < counts.length; j++) { --- 220,224 ---- int dstIndex = 0; int srcIndex = 0; ! int count; for (int j = 0; j < counts.length; j++) { *************** *** 253,284 **** gl.glDisableClientState( GL11.GL_COLOR_ARRAY ); - } ! /* ! ============= ! GL_DrawAliasShadow ! ============= ! */ void GL_DrawAliasShadow(qfiles.dmdl_t paliashdr, int posenum) { ! qfiles.dtrivertx_t[] verts; ! int[] order; ! float[] point = {0, 0, 0}; ! float height, lheight; ! int count; ! qfiles.daliasframe_t frame; ! ! lheight = currententity.origin[2] - lightspot[2]; ! ! frame = paliashdr.aliasFrames[currententity.frame]; ! ! verts = frame.verts; ! ! height = 0; ! ! order = paliashdr.glCmds; ! ! height = -lheight + 1.0f; int orderIndex = 0; --- 256,272 ---- gl.glDisableClientState( GL11.GL_COLOR_ARRAY ); } ! private final float[] point = {0, 0, 0}; ! /** ! * GL_DrawAliasShadow ! */ void GL_DrawAliasShadow(qfiles.dmdl_t paliashdr, int posenum) { ! float lheight = currententity.origin[2] - lightspot[2]; ! qfiles.daliasframe_t frame = paliashdr.aliasFrames[currententity.frame]; ! qfiles.dtrivertx_t[] verts = frame.verts; ! int[] order = paliashdr.glCmds; ! float height = -lheight + 1.0f; int orderIndex = 0; *************** *** 287,290 **** --- 275,279 ---- // TODO shadow drawing with vertex arrays + int count; while (true) { *************** *** 321,333 **** } - - /* - ** R_CullAliasModel - */ // TODO sync with jogl renderer. hoz boolean R_CullAliasModel(entity_t e) { - float[] mins = { 0, 0, 0 }; - float[] maxs = { 0, 0, 0 }; - qfiles.dmdl_t paliashdr = (qfiles.dmdl_t) currentmodel.extradata; --- 310,321 ---- } // TODO sync with jogl renderer. hoz + // stack variable + private final float[] mins = { 0, 0, 0 }; + private final float[] maxs = { 0, 0, 0 }; + /** + * R_CullAliasModel + */ boolean R_CullAliasModel(entity_t e) { qfiles.dmdl_t paliashdr = (qfiles.dmdl_t) currentmodel.extradata; *************** *** 442,460 **** }; - /* - ================= - R_DrawAliasModel - - ================= - */ // TODO sync with jogl renderer. hoz void R_DrawAliasModel(entity_t e) { - int i; - //qfiles.dmdl_t paliashdr; - //float an; - - image_t skin; - if ( ( e.flags & Defines.RF_WEAPONMODEL ) == 0) { --- 430,439 ---- }; // TODO sync with jogl renderer. hoz + /** + * R_DrawAliasModel + */ void R_DrawAliasModel(entity_t e) { if ( ( e.flags & Defines.RF_WEAPONMODEL ) == 0) { *************** *** 477,480 **** --- 456,460 ---- // PMM - 3.20 code .. replaced with original way of doing it to keep mod authors happy // + int i; if ( (currententity.flags & ( Defines.RF_SHELL_HALF_DAM | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_RED | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE )) != 0 ) { *************** *** 621,624 **** --- 601,607 ---- e.angles[PITCH] = -e.angles[PITCH]; // sigh. + + + image_t skin; // select skin if (currententity.skin != null) *************** *** 706,709 **** gl.glColor4f (1,1,1,1); } ! ! } --- 689,691 ---- gl.glColor4f (1,1,1,1); } ! } \ No newline at end of file Index: Surf.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/lwjgl/Surf.java,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -C2 -d -r1.4.2.1 -r1.4.2.2 *** Surf.java 16 Jan 2005 21:21:08 -0000 1.4.2.1 --- Surf.java 23 Jan 2005 21:31:49 -0000 1.4.2.2 *************** *** 115,133 **** */ ! /* ! =============== ! R_TextureAnimation ! ! Returns the proper texture for a given time and base texture ! =============== ! */ image_t R_TextureAnimation(mtexinfo_t tex) { - int c; - if (tex.next == null) return tex.image; ! c = currententity.frame % tex.numframes; while (c != 0) { --- 115,128 ---- */ ! /** ! * R_TextureAnimation ! * Returns the proper texture for a given time and base texture ! */ image_t R_TextureAnimation(mtexinfo_t tex) { if (tex.next == null) return tex.image; ! int c = currententity.frame % tex.numframes; while (c != 0) { *************** *** 139,147 **** } ! /* ! ================ ! DrawGLPoly ! ================ ! */ void DrawGLPoly(glpoly_t p) { --- 134,140 ---- } ! /** ! * DrawGLPoly ! */ void DrawGLPoly(glpoly_t p) { *************** *** 149,165 **** } ! // ============ ! // PGM ! /* ! ================ ! DrawGLFlowingPoly -- version of DrawGLPoly that handles scrolling texture ! ================ ! */ void DrawGLFlowingPoly(glpoly_t p) { ! int i; ! float scroll; ! ! scroll = -64 * ( (r_newrefdef.time / 40.0f) - (int)(r_newrefdef.time / 40.0f) ); if(scroll == 0.0f) scroll = -64.0f; --- 142,152 ---- } ! /** ! * DrawGLFlowingPoly ! * version that handles scrolling texture ! */ void DrawGLFlowingPoly(glpoly_t p) { ! float scroll = -64 * ( (r_newrefdef.time / 40.0f) - (int)(r_newrefdef.time / 40.0f) ); if(scroll == 0.0f) scroll = -64.0f; *************** *** 168,176 **** p.endScrolling(); } - // PGM - // ============ ! /* ! ** R_DrawTriangleOutlines */ void R_DrawTriangleOutlines() --- 155,161 ---- p.endScrolling(); } ! /** ! * R_DrawTriangleOutlines */ void R_DrawTriangleOutlines() *************** *** 183,190 **** gl.glColor4f(1, 1, 1, 1); for (int i = 0; i < MAX_LIGHTMAPS; i++) { ! for (msurface_t surf = gl_lms.lightmap_surfaces[i]; surf != null; surf = surf.lightmapchain) { ! for (glpoly_t p = surf.polys; p != null; p = p.chain) { ! for (int j = 2; j < p.numverts; j++) { gl.glBegin(GL11.GL_LINE_STRIP); gl.glVertex3f(p.x(0), p.y(0), p.z(0)); --- 168,178 ---- gl.glColor4f(1, 1, 1, 1); + msurface_t surf; + glpoly_t p; + int j; for (int i = 0; i < MAX_LIGHTMAPS; i++) { ! for (surf = gl_lms.lightmap_surfaces[i]; surf != null; surf = surf.lightmapchain) { ! for (p = surf.polys; p != null; p = p.chain) { ! for (j = 2; j < p.numverts; j++) { gl.glBegin(GL11.GL_LINE_STRIP); gl.glVertex3f(p.x(0), p.y(0), p.z(0)); *************** *** 202,221 **** } ! private IntBuffer temp2 = Lib.newIntBuffer(34 * 34, ByteOrder.LITTLE_ENDIAN); ! /* ! ================ ! R_RenderBrushPoly ! ================ ! */ void R_RenderBrushPoly(msurface_t fa) { - int maps; - image_t image; - boolean is_dynamic = false; - c_brush_polys++; ! image = R_TextureAnimation(fa.texinfo); if ((fa.flags & Defines.SURF_DRAWTURB) != 0) --- 190,203 ---- } ! private final IntBuffer temp2 = Lib.newIntBuffer(34 * 34, ByteOrder.LITTLE_ENDIAN); ! /** ! * R_RenderBrushPoly ! */ void R_RenderBrushPoly(msurface_t fa) { c_brush_polys++; ! image_t image = R_TextureAnimation(fa.texinfo); if ((fa.flags & Defines.SURF_DRAWTURB) != 0) *************** *** 254,257 **** --- 236,240 ---- ** check for lightmap modification */ + int maps; for ( maps = 0; maps < Defines.MAXLIGHTMAPS && fa.styles[maps] != (byte)255; maps++ ) { *************** *** 266,269 **** --- 249,253 ---- // dynamic this frame or dynamic previously + boolean is_dynamic = false; if ( gotoDynamic || ( fa.dlightframe == r_framecount ) ) { *************** *** 316,333 **** ! /* ! ================ ! R_DrawAlphaSurfaces ! ! Draw water surfaces and windows. ! The BSP tree is waled front to back, so unwinding the chain ! of alpha_surfaces will draw back to front, giving proper ordering. ! ================ ! */ void R_DrawAlphaSurfaces() { - msurface_t s; - float intens; - r_world_matrix.clear(); // --- 300,311 ---- ! /** ! * R_DrawAlphaSurfaces ! * Draw water surfaces and windows. ! * The BSP tree is waled front to back, so unwinding the chain ! * of alpha_surfaces will draw back to front, giving proper ordering. ! */ void R_DrawAlphaSurfaces() { r_world_matrix.clear(); // *************** *** 342,350 **** // the textures are prescaled up for a better lighting range, // so scale it back down ! intens = gl_state.inverse_intensity; gl.glInterleavedArrays(GL11.GL_T2F_V3F, Polygon.BYTE_STRIDE, globalPolygonInterleavedBuf); ! for (s=r_alpha_surfaces ; s != null ; s=s.texturechain) { GL_Bind(s.texinfo.image.texnum); --- 320,328 ---- // the textures are prescaled up for a better lighting range, // so scale it back down ! float intens = gl_state.inverse_intensity; gl.glInterleavedArrays(GL11.GL_T2F_V3F, Polygon.BYTE_STRIDE, globalPolygonInterleavedBuf); ! for (msurface_t s = r_alpha_surfaces ; s != null ; s=s.texturechain) { GL_Bind(s.texinfo.image.texnum); *************** *** 371,387 **** } ! /* ! ================ ! DrawTextureChains ! ================ ! */ void DrawTextureChains() { - int i; - msurface_t s; - image_t image; - c_visible_textures = 0; for (i = 0; i < numgltextures ; i++) { --- 349,362 ---- } ! /** ! * DrawTextureChains ! */ void DrawTextureChains() { c_visible_textures = 0; + msurface_t s; + image_t image; + int i; for (i = 0; i < numgltextures ; i++) { *************** *** 425,445 **** // direct buffer ! private IntBuffer temp = Lib.newIntBuffer(128 * 128, ByteOrder.LITTLE_ENDIAN); ! void GL_RenderLightmappedPoly( msurface_t surf ) { - int i, nv = surf.polys.numverts; - int map = 0; - int index; - float[][] v; - FloatBuffer texCoord = globalPolygonInterleavedBuf; - image_t image = R_TextureAnimation( surf.texinfo ); - boolean is_dynamic = false; - int lmtex = surf.lightmaptexturenum; - glpoly_t p; // ersetzt goto boolean gotoDynamic = false; ! for ( map = 0; map < Defines.MAXLIGHTMAPS && (surf.styles[map] != (byte)255); map++ ) { --- 400,415 ---- // direct buffer ! private final IntBuffer temp = Lib.newIntBuffer(128 * 128, ByteOrder.LITTLE_ENDIAN); ! ! /** ! * GL_RenderLightmappedPoly ! * @param surf ! */ void GL_RenderLightmappedPoly( msurface_t surf ) { // ersetzt goto boolean gotoDynamic = false; ! int map; for ( map = 0; map < Defines.MAXLIGHTMAPS && (surf.styles[map] != (byte)255); map++ ) { *************** *** 454,457 **** --- 424,428 ---- // dynamic this frame or dynamic previously + boolean is_dynamic = false; if ( gotoDynamic || ( surf.dlightframe == r_framecount ) ) { *************** *** 466,469 **** --- 437,445 ---- } + glpoly_t p; + FloatBuffer texCoord = globalPolygonInterleavedBuf; + image_t image = R_TextureAnimation( surf.texinfo ); + int lmtex = surf.lightmaptexturenum; + if ( is_dynamic ) { *************** *** 582,602 **** } ! /* ! ================= ! R_DrawInlineBModel ! ================= ! */ void R_DrawInlineBModel() { - int i, k; - cplane_t pplane; - float dot; - msurface_t psurf; - dlight_t lt; - // calculate dynamic lighting for bmodel if ( gl_flashblend.value == 0 ) { ! for (k=0 ; k<r_newrefdef.num_dlights ; k++) { lt = r_newrefdef.dlights[k]; --- 558,571 ---- } ! /** ! * R_DrawInlineBModel ! */ void R_DrawInlineBModel() { // calculate dynamic lighting for bmodel if ( gl_flashblend.value == 0 ) { ! dlight_t lt; ! for (int k=0 ; k<r_newrefdef.num_dlights ; k++) { lt = r_newrefdef.dlights[k]; *************** *** 607,612 **** // psurf = ¤tmodel->surfaces[currentmodel->firstmodelsurface]; int psurfp = currentmodel.firstmodelsurface; ! msurface_t[] surfaces; ! surfaces = currentmodel.surfaces; //psurf = surfaces[psurfp]; --- 576,580 ---- // psurf = ¤tmodel->surfaces[currentmodel->firstmodelsurface]; int psurfp = currentmodel.firstmodelsurface; ! msurface_t[] surfaces = currentmodel.surfaces; //psurf = surfaces[psurfp]; *************** *** 621,625 **** // draw texture // ! for (i=0 ; i<currentmodel.nummodelsurfaces ; i++) { psurf = surfaces[psurfp++]; --- 589,596 ---- // draw texture // ! msurface_t psurf; ! cplane_t pplane; ! float dot; ! for (int i=0 ; i<currentmodel.nummodelsurfaces ; i++) { psurf = surfaces[psurfp++]; *************** *** 658,673 **** } ! /* ! ================= ! R_DrawBrushModel ! ================= ! */ void R_DrawBrushModel(entity_t e) { - float[] mins = {0, 0, 0}; - float[] maxs = {0, 0, 0}; - int i; - boolean rotated; - if (currentmodel.nummodelsurfaces == 0) return; --- 629,644 ---- } ! // stack variable ! private final float[] mins = {0, 0, 0}; ! private final float[] maxs = {0, 0, 0}; ! private final float[] org = {0, 0, 0}; ! private final float[] forward = {0, 0, 0}; ! private final float[] right = {0, 0, 0}; ! private final float[] up = {0, 0, 0}; ! /** ! * R_DrawBrushModel ! */ void R_DrawBrushModel(entity_t e) { if (currentmodel.nummodelsurfaces == 0) return; *************** *** 676,683 **** gl_state.currenttextures[0] = gl_state.currenttextures[1] = -1; if (e.angles[0] != 0 || e.angles[1] != 0 || e.angles[2] != 0) { rotated = true; ! for (i=0 ; i<3 ; i++) { mins[i] = e.origin[i] - currentmodel.radius; --- 647,655 ---- gl_state.currenttextures[0] = gl_state.currenttextures[1] = -1; + boolean rotated; if (e.angles[0] != 0 || e.angles[1] != 0 || e.angles[2] != 0) { rotated = true; ! for (int i=0 ; i<3 ; i++) { mins[i] = e.origin[i] - currentmodel.radius; *************** *** 704,717 **** if (rotated) { ! float[] temp = {0, 0, 0}; ! float[] forward = {0, 0, 0}; ! float[] right = {0, 0, 0}; ! float[] up = {0, 0, 0}; ! ! Math3D.VectorCopy (modelorg, temp); Math3D.AngleVectors (e.angles, forward, right, up); ! modelorg[0] = Math3D.DotProduct (temp, forward); ! modelorg[1] = -Math3D.DotProduct (temp, right); ! modelorg[2] = Math3D.DotProduct (temp, up); } --- 676,684 ---- if (rotated) { ! Math3D.VectorCopy (modelorg, org); Math3D.AngleVectors (e.angles, forward, right, up); ! modelorg[0] = Math3D.DotProduct (org, forward); ! modelorg[1] = -Math3D.DotProduct (org, right); ! modelorg[2] = Math3D.DotProduct (org, up); } *************** *** 751,769 **** */ ! /* ! ================ ! R_RecursiveWorldNode ! ================ ! */ void R_RecursiveWorldNode (mnode_t node) { - int c, side, sidebit; - cplane_t plane; - msurface_t surf; - msurface_t mark; - mleaf_t pleaf; - float dot = 0; - image_t image; - if (node.contents == Defines.CONTENTS_SOLID) return; // solid --- 718,726 ---- */ ! /** ! * R_RecursiveWorldNode ! */ void R_RecursiveWorldNode (mnode_t node) { if (node.contents == Defines.CONTENTS_SOLID) return; // solid *************** *** 775,782 **** return; // if a leaf node, draw stuff if (node.contents != -1) { ! pleaf = (mleaf_t)node; // check for door connected areas --- 732,741 ---- return; + int c; + msurface_t mark; // if a leaf node, draw stuff if (node.contents != -1) { ! mleaf_t pleaf = (mleaf_t)node; // check for door connected areas *************** *** 807,812 **** // find which side of the node we are on ! plane = node.plane; ! switch (plane.type) { --- 766,771 ---- // find which side of the node we are on ! cplane_t plane = node.plane; ! float dot; switch (plane.type) { *************** *** 825,828 **** --- 784,788 ---- } + int side, sidebit; if (dot >= 0.0f) { *************** *** 840,843 **** --- 800,805 ---- // draw stuff + msurface_t surf; + image_t image; //for ( c = node.numsurfaces, surf = r_worldmodel.surfaces[node.firstsurface]; c != 0 ; c--, surf++) for ( c = 0; c < node.numsurfaces; c++) *************** *** 876,897 **** } } - // recurse down the back side R_RecursiveWorldNode(node.children[1 - side]); } ! ! /* ! ============= ! R_DrawWorld ! ============= ! */ void R_DrawWorld() { - entity_t ent = new entity_t(); - // auto cycle the world frame for texture animation - ent.frame = (int)(r_newrefdef.time*2); - currententity = ent; - if (r_drawworld.value == 0) return; --- 838,852 ---- } } // recurse down the back side R_RecursiveWorldNode(node.children[1 - side]); } ! private final entity_t worldEntity = new entity_t(); ! ! /** ! * R_DrawWorld ! */ void R_DrawWorld() { if (r_drawworld.value == 0) return; *************** *** 904,907 **** --- 859,868 ---- Math3D.VectorCopy(r_newrefdef.vieworg, modelorg); + entity_t ent = worldEntity; + // auto cycle the world frame for texture animation + ent.clear(); + ent.frame = (int)(r_newrefdef.time*2); + currententity = ent; + gl_state.currenttextures[0] = gl_state.currenttextures[1] = -1; *************** *** 939,964 **** } ! byte[] fatvis = new byte[Defines.MAX_MAP_LEAFS / 8]; ! ! /* ! =============== ! R_MarkLeaves ! Mark the leaves and nodes that are in the PVS for the current ! cluster ! =============== ! */ void R_MarkLeaves() { - //byte[] vis; - //byte[] fatvis = new byte[Defines.MAX_MAP_LEAFS / 8]; - - //Arrays.fill(fatvis, (byte)0); - - mnode_t node; - int i, c; - mleaf_t leaf; - int cluster; - if (r_oldviewcluster == r_viewcluster && r_oldviewcluster2 == r_viewcluster2 && r_novis.value == 0 && r_viewcluster != -1) return; --- 900,912 ---- } ! final byte[] fatvis = new byte[Defines.MAX_MAP_LEAFS / 8]; ! /** ! * R_MarkLeaves ! * Mark the leaves and nodes that are in the PVS for the current ! * cluster ! */ void R_MarkLeaves() { if (r_oldviewcluster == r_viewcluster && r_oldviewcluster2 == r_viewcluster2 && r_novis.value == 0 && r_viewcluster != -1) return; *************** *** 973,976 **** --- 921,925 ---- r_oldviewcluster2 = r_viewcluster2; + int i; if (r_novis.value != 0 || r_viewcluster == -1 || r_worldmodel.vis == null) { *************** *** 984,987 **** --- 933,937 ---- byte[] vis = Mod_ClusterPVS(r_viewcluster, r_worldmodel); + int c; // may have to combine two clusters because of solid water boundaries if (r_viewcluster2 != r_viewcluster) *************** *** 1001,1005 **** vis = fatvis; } ! for ( i=0; i < r_worldmodel.numleafs; i++) { --- 951,958 ---- vis = fatvis; } ! ! mnode_t node; ! mleaf_t leaf; ! int cluster; for ( i=0; i < r_worldmodel.numleafs; i++) { *************** *** 1022,1027 **** } - - /* ============================================================================= --- 975,978 ---- *************** *** 1032,1035 **** --- 983,989 ---- */ + /** + * LM_InitBlock + */ void LM_InitBlock() { *************** *** 1037,1053 **** } void LM_UploadBlock( boolean dynamic ) { ! int texture; ! int height = 0; ! ! if ( dynamic ) ! { ! texture = 0; ! } ! else ! { ! texture = gl_lms.current_lightmap_texture; ! } GL_Bind( gl_state.lightmap_textures + texture ); --- 991,1001 ---- } + /** + * LM_UploadBlock + * @param dynamic + */ void LM_UploadBlock( boolean dynamic ) { ! int texture = ( dynamic ) ? 0 : gl_lms.current_lightmap_texture; GL_Bind( gl_state.lightmap_textures + texture ); *************** *** 1058,1064 **** if ( dynamic ) { ! int i; ! ! for ( i = 0; i < BLOCK_WIDTH; i++ ) { if ( gl_lms.allocated[i] > height ) --- 1006,1011 ---- if ( dynamic ) { ! int height = 0; ! for (int i = 0; i < BLOCK_WIDTH; i++ ) { if ( gl_lms.allocated[i] > height ) *************** *** 1087,1106 **** Com.Error( Defines.ERR_DROP, "LM_UploadBlock() - MAX_LIGHTMAPS exceeded\n" ); - //debugLightmap(gl_lms.lightmap_buffer, 128, 128, 4); - } } ! // returns a texture number and the position inside it boolean LM_AllocBlock (int w, int h, pos_t pos) { int x = pos.x; int y = pos.y; - int i, j; - int best, best2; - - best = BLOCK_HEIGHT; for (i=0 ; i<BLOCK_WIDTH-w ; i++) { --- 1034,1056 ---- Com.Error( Defines.ERR_DROP, "LM_UploadBlock() - MAX_LIGHTMAPS exceeded\n" ); //debugLightmap(gl_lms.lightmap_buffer, 128, 128, 4); } } ! /** ! * LM_AllocBlock ! * @param w ! * @param h ! * @param pos ! * @return a texture number and the position inside it ! */ boolean LM_AllocBlock (int w, int h, pos_t pos) { + int best = BLOCK_HEIGHT; int x = pos.x; int y = pos.y; + int best2; + int i, j; for (i=0 ; i<BLOCK_WIDTH-w ; i++) { *************** *** 1130,1154 **** } ! /* ! ================ ! GL_BuildPolygonFromSurface ! ================ ! */ void GL_BuildPolygonFromSurface(msurface_t fa) { - int i, lindex, lnumverts; - medge_t[] pedges; - medge_t r_pedge; - int vertpage; - float[] vec; - float s, t; - float[] total = {0, 0, 0}; - // reconstruct the polygon ! pedges = currentmodel.edges; ! lnumverts = fa.numedges; ! vertpage = 0; ! ! Math3D.VectorClear(total); // // draw texture --- 1080,1092 ---- } ! /** ! * GL_BuildPolygonFromSurface ! */ void GL_BuildPolygonFromSurface(msurface_t fa) { // reconstruct the polygon ! medge_t[] pedges = currentmodel.edges; ! int lnumverts = fa.numedges; ! int vertpage = 0; // // draw texture *************** *** 1161,1165 **** fa.polys = poly; ! for (i=0 ; i<lnumverts ; i++) { lindex = currentmodel.surfedges[fa.firstedge + i]; --- 1099,1107 ---- fa.polys = poly; ! int lindex; ! float[] vec; ! medge_t r_pedge; ! float s, t; ! for (int i=0 ; i<lnumverts ; i++) { lindex = currentmodel.surfedges[fa.firstedge + i]; *************** *** 1181,1185 **** t /= fa.texinfo.image.height; - Math3D.VectorAdd (total, vec, total); poly.x(i, vec[0]); poly.y(i, vec[1]); --- 1123,1126 ---- *************** *** 1209,1227 **** } ! /* ! ======================== ! GL_CreateSurfaceLightmap ! ======================== ! */ void GL_CreateSurfaceLightmap(msurface_t surf) { - int smax, tmax; - IntBuffer base; - if ( (surf.flags & (Defines.SURF_DRAWSKY | Defines.SURF_DRAWTURB)) != 0) return; ! smax = (surf.extents[0]>>4)+1; ! tmax = (surf.extents[1]>>4)+1; pos_t lightPos = new pos_t(surf.light_s, surf.light_t); --- 1150,1163 ---- } ! /** ! * GL_CreateSurfaceLightmap ! */ void GL_CreateSurfaceLightmap(msurface_t surf) { if ( (surf.flags & (Defines.SURF_DRAWSKY | Defines.SURF_DRAWTURB)) != 0) return; ! int smax = (surf.extents[0]>>4)+1; ! int tmax = (surf.extents[1]>>4)+1; pos_t lightPos = new pos_t(surf.light_s, surf.light_t); *************** *** 1244,1248 **** surf.lightmaptexturenum = gl_lms.current_lightmap_texture; ! base = gl_lms.lightmap_buffer; base.position(surf.light_t * BLOCK_WIDTH + surf.light_s); --- 1180,1184 ---- surf.lightmaptexturenum = gl_lms.current_lightmap_texture; ! IntBuffer base = gl_lms.lightmap_buffer; base.position(surf.light_t * BLOCK_WIDTH + surf.light_s); *************** *** 1252,1263 **** lightstyle_t[] lightstyles; ! IntBuffer dummy = BufferUtils.createIntBuffer(128*128); ! ! /* ! ================== ! GL_BeginBuildingLightmaps ! ================== ! */ void GL_BeginBuildingLightmaps(model_t m) { --- 1188,1196 ---- lightstyle_t[] lightstyles; ! private final IntBuffer dummy = BufferUtils.createIntBuffer(128*128); ! /** ! * GL_BeginBuildingLightmaps ! */ void GL_BeginBuildingLightmaps(model_t m) { *************** *** 1358,1366 **** } ! /* ! ======================= ! GL_EndBuildingLightmaps ! ======================= ! */ void GL_EndBuildingLightmaps() { --- 1291,1297 ---- } ! /** ! * GL_EndBuildingLightmaps ! */ void GL_EndBuildingLightmaps() { Index: Main.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/lwjgl/Main.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** Main.java 14 Dec 2004 12:56:58 -0000 1.2 --- Main.java 23 Jan 2005 21:31:48 -0000 1.2.2.1 *************** *** 63,67 **** public abstract class Main extends Base { - public static int[] d_8to24table = new int[256]; --- 63,66 ---- *************** *** 128,132 **** int GL_TEXTURE1 = GL13.GL_TEXTURE1; - model_t r_worldmodel; --- 127,130 ---- *************** *** 240,250 **** // ============================================================================ ! /* ! ================= ! R_CullBox ! ! Returns true if the box is completely outside the frustom ! ================= ! */ final boolean R_CullBox(float[] mins, float[] maxs) { assert(mins.length == 3 && maxs.length == 3) : "vec3_t bug"; --- 238,245 ---- // ============================================================================ ! /** ! * R_CullBox ! * Returns true if the box is completely outside the frustum ! */ final boolean R_CullBox(float[] mins, float[] maxs) { assert(mins.length == 3 && maxs.length == 3) : "vec3_t bug"; *************** *** 260,265 **** } final void R_RotateForEntity(entity_t e) { - gl.glTranslatef(e.origin[0], e.origin[1], e.origin[2]); --- 255,262 ---- } + /** + * R_RotateForEntity + */ final void R_RotateForEntity(entity_t e) { gl.glTranslatef(e.origin[0], e.origin[1], e.origin[2]); *************** *** 277,289 **** */ ! /* ! ================= ! R_DrawSpriteModel ! ! ================= ! */ void R_DrawSpriteModel(entity_t e) { float alpha = 1.0F; - float[] point = { 0, 0, 0 }; qfiles.dsprframe_t frame; --- 274,284 ---- */ ! // stack variable ! private final float[] point = { 0, 0, 0 }; ! /** ! * R_DrawSpriteModel ! */ void R_DrawSpriteModel(entity_t e) { float alpha = 1.0F; qfiles.dsprframe_t frame; *************** *** 351,363 **** // ================================================================================== ! /* ! ============= ! R_DrawNullModel ! ============= ! cwei :-) */ void R_DrawNullModel() { - float[] shadelight = { 0, 0, 0 }; - if ((currententity.flags & Defines.RF_FULLBRIGHT) != 0) { // cwei wollte blau: shadelight[0] = shadelight[1] = shadelight[2] = 1.0F; --- 346,355 ---- // ================================================================================== ! // stack variable ! private final float[] shadelight = { 0, 0, 0 }; ! /** ! * R_DrawNullModel */ void R_DrawNullModel() { if ((currententity.flags & Defines.RF_FULLBRIGHT) != 0) { // cwei wollte blau: shadelight[0] = shadelight[1] = shadelight[2] = 1.0F; *************** *** 399,414 **** } ! /* ! ============= ! R_DrawEntitiesOnList ! ============= ! */ void R_DrawEntitiesOnList() { - int i; - if (r_drawentities.value == 0.0f) return; // draw non-transparent first for (i = 0; i < r_newrefdef.num_entities; i++) { currententity = r_newrefdef.entities[i]; --- 391,403 ---- } ! /** ! * R_DrawEntitiesOnList ! */ void R_DrawEntitiesOnList() { if (r_drawentities.value == 0.0f) return; // draw non-transparent first + int i; for (i = 0; i < r_newrefdef.num_entities; i++) { currententity = r_newrefdef.entities[i]; *************** *** 478,491 **** } ! /* ! ** GL_DrawParticles ! ** ! */ void GL_DrawParticles(int num_particles) { - float[] up = { 0, 0, 0 }; - float[] right = { 0, 0, 0 }; - float scale; - int color; - float origin_x, origin_y, origin_z; --- 467,477 ---- } ! // stack variable ! private final float[] up = { 0, 0, 0 }; ! private final float[] right = { 0, 0, 0 }; ! /** ! * GL_DrawParticles ! */ void GL_DrawParticles(int num_particles) { float origin_x, origin_y, origin_z; *************** *** 502,505 **** --- 488,493 ---- FloatBuffer sourceVertices = particle_t.vertexArray; IntBuffer sourceColors = particle_t.colorArray; + float scale; + int color; for (int j = 0, i = 0; i < num_particles; i++) { origin_x = sourceVertices.get(j++); *************** *** 541,549 **** } ! /* ! =============== ! R_DrawParticles ! =============== ! */ void R_DrawParticles() { --- 529,535 ---- } ! /** ! * R_DrawParticles ! */ void R_DrawParticles() { *************** *** 576,584 **** } ! /* ! ============ ! R_PolyBlend ! ============ ! */ void R_PolyBlend() { if (gl_polyblend.value == 0.0f) --- 562,568 ---- } ! /** ! * R_PolyBlend ! */ void R_PolyBlend() { if (gl_polyblend.value == 0.0f) *************** *** 618,621 **** --- 602,608 ---- // ======================================================================= + /** + * SignbitsForPlane + */ int SignbitsForPlane(cplane_t out) { // for fast box on planeside test *************** *** 628,631 **** --- 615,621 ---- } + /** + * R_SetFrustum + */ void R_SetFrustum() { // rotate VPN right by FOV_X/2 degrees *************** *** 647,659 **** // ======================================================================= ! /* ! =============== ! R_SetupFrame ! =============== ! */ void R_SetupFrame() { - int i; - mleaf_t leaf; - r_framecount++; --- 637,646 ---- // ======================================================================= ! // stack variable ! private final float[] temp = {0, 0, 0}; ! /** ! * R_SetupFrame ! */ void R_SetupFrame() { r_framecount++; *************** *** 664,667 **** --- 651,655 ---- // current viewcluster + mleaf_t leaf; if ((r_newrefdef.rdflags & Defines.RDF_NOWORLDMODEL) == 0) { r_oldviewcluster = r_viewcluster; *************** *** 672,677 **** // check above and below so crossing solid water doesn't draw wrong if (leaf.contents == 0) { // look down a bit - float[] temp = { 0, 0, 0 }; - Math3D.VectorCopy(r_origin, temp); temp[2] -= 16; --- 660,663 ---- *************** *** 681,686 **** } else { // look up a bit - float[] temp = { 0, 0, 0 }; - Math3D.VectorCopy(r_origin, temp); temp[2] += 16; --- 667,670 ---- *************** *** 691,695 **** } ! for (i = 0; i < 4; i++) v_blend[i] = r_newrefdef.blend[i]; --- 675,679 ---- } ! for (int i = 0; i < 4; i++) v_blend[i] = r_newrefdef.blend[i]; *************** *** 712,723 **** } void MYgluPerspective(double fovy, double aspect, double zNear, double zFar) { ! double xmin, xmax, ymin, ymax; ! ! ymax = zNear * Math.tan(fovy * Math.PI / 360.0); ! ymin = -ymax; ! xmin = ymin * aspect; ! xmax = ymax * aspect; xmin += - (2 * gl_state.camera_separation) / zNear; --- 696,713 ---- } + /** + * MYgluPerspective + * + * @param fovy + * @param aspect + * @param zNear + * @param zFar + */ void MYgluPerspective(double fovy, double aspect, double zNear, double zFar) { ! double ymax = zNear * Math.tan(fovy * Math.PI / 360.0); ! double ymin = -ymax; ! double xmin = ymin * aspect; ! double xmax = ymax * aspect; xmin += - (2 * gl_state.camera_separation) / zNear; *************** *** 727,735 **** } ! /* ! ============= ! R_SetupGL ! ============= ! */ void R_SetupGL() { --- 717,723 ---- } ! /** ! * R_SetupGL ! */ void R_SetupGL() { *************** *** 787,797 **** } - /* - ============= - R_Clear - ============= - */ int trickframe = 0; void R_Clear() { if (gl_ztrick.value != 0.0f) { --- 775,783 ---- } int trickframe = 0; + /** + * R_Clear + */ void R_Clear() { if (gl_ztrick.value != 0.0f) { *************** *** 826,840 **** } void R_Flash() { R_PolyBlend(); } ! /* ! ================ ! R_RenderView ! ! r_newrefdef must be set before the first call ! ================ ! */ void R_RenderView(refdef_t fd) { --- 812,826 ---- } + /** + * R_Flash + */ void R_Flash() { R_PolyBlend(); } ! /** ! * R_RenderView ! * r_newrefdef must be set before the first call ! */ void R_RenderView(refdef_t fd) { *************** *** 890,893 **** --- 876,882 ---- } + /** + * R_SetGL2D + */ void R_SetGL2D() { // set 2D virtual screen size *************** *** 905,917 **** } ! /* ! ==================== ! R_SetLightLevel ! ! ==================== ! */ void R_SetLightLevel() { - float[] shadelight = { 0, 0, 0 }; - if ((r_newrefdef.rdflags & Defines.RDF_NOWORLDMODEL) != 0) return; --- 894,903 ---- } ! // stack variable ! private final float[] light = { 0, 0, 0 }; ! /** ! * R_SetLightLevel ! */ void R_SetLightLevel() { if ((r_newrefdef.rdflags & Defines.RDF_NOWORLDMODEL) != 0) return; *************** *** 919,946 **** // save off light value for server to look at (BIG HACK!) ! R_LightPoint(r_newrefdef.vieworg, shadelight); // pick the greatest component, which should be the same // as the mono value returned by software ! if (shadelight[0] > shadelight[1]) { ! if (shadelight[0] > shadelight[2]) ! r_lightlevel.value = 150 * shadelight[0]; else ! r_lightlevel.value = 150 * shadelight[2]; } else { ! if (shadelight[1] > shadelight[2]) ! r_lightlevel.value = 150 * shadelight[1]; else ! r_lightlevel.value = 150 * shadelight[2]; } } ! /* ! @@@@@@@@@@@@@@@@@@@@@ ! R_RenderFrame ! ! @@@@@@@@@@@@@@@@@@@@@ ! */ protected void R_RenderFrame(refdef_t fd) { R_RenderView(fd); --- 905,929 ---- // save off light value for server to look at (BIG HACK!) ! R_LightPoint(r_newrefdef.vieworg, light); // pick the greatest component, which should be the same // as the mono value returned by software ! if (light[0] > light[1]) { ! if (light[0] > light[2]) ! r_lightlevel.value = 150 * light[0]; else ! r_lightlevel.value = 150 * light[2]; } else { ! if (light[1] > light[2]) ! r_lightlevel.value = 150 * light[1]; else ! r_lightlevel.value = 150 * light[2]; } } ! /** ! * R_RenderFrame ! */ protected void R_RenderFrame(refdef_t fd) { R_RenderView(fd); *************** *** 949,952 **** --- 932,938 ---- } + /** + * R_Register + */ protected void R_Register() { r_lefthand = Cvar.Get("hand", "0", Globals.CVAR_USERINFO | Globals.CVAR_ARCHIVE); *************** *** 1015,1019 **** vid_fullscreen = Cvar.Get("vid_fullscreen", "0", Globals.CVAR_ARCHIVE); vid_gamma = Cvar.Get("vid_gamma", "1.0", Globals.CVAR_ARCHIVE); ! vid_ref = Cvar.Get("vid_ref", "fastjogl", Globals.CVAR_ARCHIVE); Cmd.AddCommand("imagelist", new xcommand_t() { --- 1001,1005 ---- vid_fullscreen = Cvar.Get("vid_fullscreen", "0", Globals.CVAR_ARCHIVE); vid_gamma = Cvar.Get("vid_gamma", "1.0", Globals.CVAR_ARCHIVE); ! vid_ref = Cvar.Get("vid_ref", "lwjgl", Globals.CVAR_ARCHIVE); Cmd.AddCommand("imagelist", new xcommand_t() { *************** *** 1040,1060 **** } ! /* ! ================== ! R_SetMode ! ================== ! */ protected boolean R_SetMode() { ! ! int err; // enum rserr_t ! boolean fullscreen; ! ! // if (vid_fullscreen.modified && !gl_config.allow_cds) { ! // VID.Printf(Defines.PRINT_ALL, "R_SetMode() - CDS not allowed with this driver\n"); ! // Cvar.SetValue("vid_fullscreen", (vid_fullscreen.value > 0.0f) ? 0.0f : 1.0f); ! // vid_fullscreen.modified = false; ! // } ! ! fullscreen = (vid_fullscreen.value > 0.0f); vid_fullscreen.modified = false; --- 1026,1034 ---- } ! /** ! * R_SetMode ! */ protected boolean R_SetMode() { ! boolean fullscreen = (vid_fullscreen.value > 0.0f); vid_fullscreen.modified = false; *************** *** 1063,1066 **** --- 1037,1041 ---- Dimension dim = new Dimension(vid.width, vid.height); + int err; // enum rserr_t if ((err = GLimp_SetMode(dim, (int) gl_mode.value, fullscreen)) == rserr_ok) { gl_state.prev_mode = (int) gl_mode.value; *************** *** 1089,1099 **** } - /* - =============== - R_Init - =============== - */ float[] r_turbsin = new float[256]; protected boolean R_Init(int vid_xpos, int vid_ypos) { --- 1064,1072 ---- } float[] r_turbsin = new float[256]; + /** + * R_Init + */ protected boolean R_Init(int vid_xpos, int vid_ypos) { *************** *** 1122,1125 **** --- 1095,1101 ---- } + /** + * R_Init2 + */ protected boolean R_Init2() { VID.MenuInit(); *************** *** 1314,1322 **** } ! /* ! =============== ! R_Shutdown ! =============== ! */ protected void R_Shutdown() { Cmd.RemoveCommand("modellist"); --- 1290,1296 ---- } ! /** ! * R_Shutdown ! */ protected void R_Shutdown() { Cmd.RemoveCommand("modellist"); *************** *** 1335,1343 **** } ! /* ! @@@@@@@@@@@@@@@@@@@@@ ! R_BeginFrame ! @@@@@@@@@@@@@@@@@@@@@ ! */ protected void R_BeginFrame(float camera_separation) { --- 1309,1315 ---- } ! /** ! * R_BeginFrame ! */ protected void R_BeginFrame(float camera_separation) { *************** *** 1351,1355 **** cvar_t ref; ! ref = Cvar.Get("vid_ref", "fastjogl", 0); ref.modified = true; } --- 1323,1327 ---- cvar_t ref; ! ref = Cvar.Get("vid_ref", "lwjgl", 0); ref.modified = true; } *************** *** 1450,1458 **** int[] r_rawpalette = new int[256]; ! /* ! ============= ! R_SetPalette ! ============= ! */ protected void R_SetPalette(byte[] palette) { // 256 RGB values (768 bytes) --- 1422,1428 ---- int[] r_rawpalette = new int[256]; ! /** ! * R_SetPalette ! */ protected void R_SetPalette(byte[] palette) { // 256 RGB values (768 bytes) *************** *** 1488,1506 **** float[][] end_points = new float[NUM_BEAM_SEGS][3]; // array of vec3_t ! /* ! ** R_DrawBeam ! */ void R_DrawBeam(entity_t e) { - - int i; - float r, g, b; - - float[] perpvec = { 0, 0, 0 }; // vec3_t - float[] direction = { 0, 0, 0 }; // vec3_t - float[] normalized_direction = { 0, 0, 0 }; // vec3_t - - float[] oldorigin = { 0, 0, 0 }; // vec3_t - float[] origin = { 0, 0, 0 }; // vec3_t - oldorigin[0] = e.oldorigin[0]; oldorigin[1] = e.oldorigin[1]; --- 1458,1471 ---- float[][] end_points = new float[NUM_BEAM_SEGS][3]; // array of vec3_t ! // stack variable ! private final float[] perpvec = { 0, 0, 0 }; // vec3_t ! private final float[] direction = { 0, 0, 0 }; // vec3_t ! private final float[] normalized_direction = { 0, 0, 0 }; // vec3_t ! private final float[] oldorigin = { 0, 0, 0 }; // vec3_t ! private final float[] origin = { 0, 0, 0 }; // vec3_t ! /** ! * R_DrawBeam ! */ void R_DrawBeam(entity_t e) { oldorigin[0] = e.oldorigin[0]; oldorigin[1] = e.oldorigin[1]; *************** *** 1521,1525 **** Math3D.VectorScale(perpvec, e.frame / 2, perpvec); ! for (i = 0; i < 6; i++) { Math3D.RotatePointAroundVector( start_points[i], --- 1486,1490 ---- Math3D.VectorScale(perpvec, e.frame / 2, perpvec); ! for (int i = 0; i < 6; i++) { Math3D.RotatePointAroundVector( start_points[i], *************** *** 1536,1542 **** gl.glDepthMask(false); ! r = (d_8to24table[e.skinnum & 0xFF]) & 0xFF; ! g = (d_8to24table[e.skinnum & 0xFF] >> 8) & 0xFF; ! b = (d_8to24table[e.skinnum & 0xFF] >> 16) & 0xFF; r *= 1 / 255.0f; --- 1501,1507 ---- gl.glDepthMask(false); ! float r = (d_8to24table[e.skinnum & 0xFF]) & 0xFF; ! float g = (d_8to24table[e.skinnum & 0xFF] >> 8) & 0xFF; ! float b = (d_8to24table[e.skinnum & 0xFF] >> 16) & 0xFF; r *= 1 / 255.0f; *************** *** 1550,1554 **** float[] v; ! for (i = 0; i < NUM_BEAM_SEGS; i++) { v = start_points[i]; gl.glVertex3f(v[0], v[1], v[2]); --- 1515,1519 ---- float[] v; ! for (int i = 0; i < NUM_BEAM_SEGS; i++) { v = start_points[i]; gl.glVertex3f(v[0], v[1], v[2]); *************** *** 1566,1569 **** gl.glDepthMask(true); } ! ! } --- 1531,1533 ---- gl.glDepthMask(true); } ! } \ No newline at end of file |