From: Holger Z. <hz...@us...> - 2004-07-19 19:40:08
|
Update of /cvsroot/jake2/jake2/src/jake2/render/fastjogl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4704/src/jake2/render/fastjogl Modified Files: Image.java Mesh.java Model.java Surf.java Main.java Light.java Log Message: profiling Index: Model.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastjogl/Model.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Model.java 16 Jul 2004 10:11:35 -0000 1.3 --- Model.java 19 Jul 2004 19:39:57 -0000 1.4 *************** *** 1085,1089 **** { buffer.get(nameBuf); ! skinNames[i] = new String(nameBuf).trim(); mod.skins[i] = GL_FindImage(skinNames[i], it_skin); } --- 1085,1093 ---- { buffer.get(nameBuf); ! skinNames[i] = new String(nameBuf); ! int n = skinNames[i].indexOf('\0'); ! if (n > -1) { ! skinNames[i] = skinNames[i].substring(0, n); ! } mod.skins[i] = GL_FindImage(skinNames[i], it_skin); } Index: Main.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastjogl/Main.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Main.java 16 Jul 2004 10:11:35 -0000 1.3 --- Main.java 19 Jul 2004 19:39:57 -0000 1.4 *************** *** 503,511 **** color = sourceColors.get(i); gl.glColor4ub( ! (byte)((color >> 0) & 0xFF), (byte)((color >> 8) & 0xFF), (byte)((color >> 16) & 0xFF), ! (byte)((color >> 24) & 0xFF) ); // first vertex --- 503,512 ---- color = sourceColors.get(i); + gl.glColor4ub( ! (byte)((color) & 0xFF), (byte)((color >> 8) & 0xFF), (byte)((color >> 16) & 0xFF), ! (byte)((color >>> 24)) ); // first vertex *************** *** 719,735 **** */ void R_SetupGL() { - float screenaspect; - int x, x2, y2, y, w, h; // // set up viewport // ! x = (int) Math.floor(r_newrefdef.x * vid.width / vid.width); ! x2 = (int) Math.ceil((r_newrefdef.x + r_newrefdef.width) * vid.width / vid.width); ! y = (int) Math.floor(vid.height - r_newrefdef.y * vid.height / vid.height); ! y2 = (int) Math.ceil(vid.height - (r_newrefdef.y + r_newrefdef.height) * vid.height / vid.height); ! w = x2 - x; ! h = y - y2; gl.glViewport(x, y2, w, h); --- 720,738 ---- */ void R_SetupGL() { // // set up viewport // ! //int x = (int) Math.floor(r_newrefdef.x * vid.width / vid.width); ! int x = r_newrefdef.x; ! //int x2 = (int) Math.ceil((r_newrefdef.x + r_newrefdef.width) * vid.width / vid.width); ! int x2 = r_newrefdef.x + r_newrefdef.width; ! //int y = (int) Math.floor(vid.height - r_newrefdef.y * vid.height / vid.height); ! int y = vid.height - r_newrefdef.y; ! //int y2 = (int) Math.ceil(vid.height - (r_newrefdef.y + r_newrefdef.height) * vid.height / vid.height); ! int y2 = vid.height - (r_newrefdef.y + r_newrefdef.height); ! int w = x2 - x; ! int h = y - y2; gl.glViewport(x, y2, w, h); *************** *** 738,742 **** // set up projection matrix // ! screenaspect = (float) r_newrefdef.width / r_newrefdef.height; gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); --- 741,745 ---- // set up projection matrix // ! float screenaspect = (float) r_newrefdef.width / r_newrefdef.height; gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); *************** *** 1169,1176 **** } - // #ifdef __linux__ - Cvar.SetValue("gl_finish", 1); - // #endif - // MCD has buffering issues if (gl_config.renderer == GL_RENDERER_MCD) { --- 1172,1175 ---- Index: Surf.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastjogl/Surf.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Surf.java 16 Jul 2004 10:11:35 -0000 1.3 --- Surf.java 19 Jul 2004 19:39:57 -0000 1.4 *************** *** 974,981 **** void R_MarkLeaves() { ! byte[] vis; //byte[] fatvis = new byte[Defines.MAX_MAP_LEAFS / 8]; ! Arrays.fill(fatvis, (byte)0); mnode_t node; --- 974,981 ---- void R_MarkLeaves() { ! //byte[] vis; //byte[] fatvis = new byte[Defines.MAX_MAP_LEAFS / 8]; ! //Arrays.fill(fatvis, (byte)0); mnode_t node; *************** *** 1006,1010 **** } ! vis = Mod_ClusterPVS(r_viewcluster, r_worldmodel); // may have to combine two clusters because of solid water boundaries if (r_viewcluster2 != r_viewcluster) --- 1006,1010 ---- } ! byte[] vis = Mod_ClusterPVS(r_viewcluster, r_worldmodel); // may have to combine two clusters because of solid water boundaries if (r_viewcluster2 != r_viewcluster) Index: Image.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastjogl/Image.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Image.java 16 Jul 2004 10:11:35 -0000 1.4 --- Image.java 19 Jul 2004 19:39:57 -0000 1.5 *************** *** 1466,1476 **** image_t GL_FindImage(String name, int type) { image_t image = null; ! ! // TODO loest das grossschreibungs problem ! name = name.toLowerCase(); ! // bughack for bad strings (fuck \0) ! int index = name.indexOf('\0'); ! if (index != -1) ! name = name.substring(0, index); if (name == null || name.length() < 5) --- 1466,1476 ---- image_t GL_FindImage(String name, int type) { image_t image = null; ! ! // // TODO loest das grossschreibungs problem ! // name = name.toLowerCase(); ! // // bughack for bad strings (fuck \0) ! // int index = name.indexOf('\0'); ! // if (index != -1) ! // name = name.substring(0, index); if (name == null || name.length() < 5) *************** *** 1492,1495 **** --- 1492,1496 ---- // load the pic from disk // + image = null; byte[] pic = null; Dimension dim = new Dimension(); *************** *** 1518,1523 **** } - else - return null; return image; --- 1519,1522 ---- Index: Light.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastjogl/Light.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Light.java 16 Jul 2004 10:11:35 -0000 1.5 --- Light.java 19 Jul 2004 19:39:57 -0000 1.6 *************** *** 571,575 **** // memset( s_blocklights, 0, sizeof( s_blocklights[0] ) * size * 3 ); ! Arrays.fill(s_blocklights, 0, size * 3, 0.0f); for (maps = 0 ; maps < Defines.MAXLIGHTMAPS && surf.styles[maps] != (byte)255 ; --- 571,575 ---- // memset( s_blocklights, 0, sizeof( s_blocklights[0] ) * size * 3 ); ! //Arrays.fill(s_blocklights, 0, size * 3, 0.0f); for (maps = 0 ; maps < Defines.MAXLIGHTMAPS && surf.styles[maps] != (byte)255 ; Index: Mesh.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastjogl/Mesh.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Mesh.java 16 Jul 2004 10:11:35 -0000 1.4 --- Mesh.java 19 Jul 2004 19:39:57 -0000 1.5 *************** *** 69,76 **** float[] shadedots = r_avertexnormal_dots[0]; ! void GL_LerpVerts( int nverts, qfiles.dtrivertx_t[] v, qfiles.dtrivertx_t[] ov, qfiles.dtrivertx_t[] verts, float[] move, float[] frontv, float[] backv ) { - int lerpIndex = 0; - int[] ovv; int[] vv; --- 69,74 ---- float[] shadedots = r_avertexnormal_dots[0]; ! void GL_LerpVerts(int nverts, qfiles.dtrivertx_t[] ov, qfiles.dtrivertx_t[] verts, float[] move, float[] frontv, float[] backv ) { int[] ovv; int[] vv; *************** *** 86,95 **** normal = r_avertexnormals[verts[i].lightnormalindex]; ovv = ov[i].v; ! vv = v[i].v; ! lerp.put(j, move[0] + ovv[0]*backv[0] + vv[0]*frontv[0] + normal[0] * Defines.POWERSUIT_SCALE); ! lerp.put(j + 1, move[1] + ovv[1]*backv[1] + vv[1]*frontv[1] + normal[1] * Defines.POWERSUIT_SCALE); ! lerp.put(j + 2, move[2] + ovv[2]*backv[2] + vv[2]*frontv[2] + normal[2] * Defines.POWERSUIT_SCALE); ! j+=3; } } --- 84,92 ---- normal = r_avertexnormals[verts[i].lightnormalindex]; ovv = ov[i].v; ! vv = verts[i].v; ! lerp.put(j++, move[0] + ovv[0]*backv[0] + vv[0]*frontv[0] + normal[0] * Defines.POWERSUIT_SCALE); ! lerp.put(j++, move[1] + ovv[1]*backv[1] + vv[1]*frontv[1] + normal[1] * Defines.POWERSUIT_SCALE); ! lerp.put(j++, move[2] + ovv[2]*backv[2] + vv[2]*frontv[2] + normal[2] * Defines.POWERSUIT_SCALE); } } *************** *** 100,109 **** { ovv = ov[i].v; ! vv = v[i].v; ! lerp.put(j, move[0] + ovv[0]*backv[0] + vv[0]*frontv[0]); ! lerp.put(j + 1, move[1] + ovv[1]*backv[1] + vv[1]*frontv[1]); ! lerp.put(j + 2, move[2] + ovv[2]*backv[2] + vv[2]*frontv[2]); ! j+=3; } } --- 97,105 ---- { ovv = ov[i].v; ! vv = verts[i].v; ! lerp.put(j++, move[0] + ovv[0]*backv[0] + vv[0]*frontv[0]); ! lerp.put(j++, move[1] + ovv[1]*backv[1] + vv[1]*frontv[1]); ! lerp.put(j++, move[2] + ovv[2]*backv[2] + vv[2]*frontv[2]); } } *************** *** 130,159 **** void GL_DrawAliasFrameLerp(qfiles.dmdl_t paliashdr, float backlerp) { - float l; - qfiles.daliasframe_t frame, oldframe; - qfiles.dtrivertx_t[] v, ov, verts; - - int[] order; - int orderIndex = 0; int count; - - float frontlerp; float alpha; ! float[] move = {0, 0, 0}; // vec3_t ! float[] frontv = {0, 0, 0}; // vec3_t float[] backv = {0, 0, 0}; // vec3_t ! int i; ! int index_xyz; ! ! frame = paliashdr.aliasFrames[currententity.frame]; ! verts = v = frame.verts; ! oldframe = paliashdr.aliasFrames[currententity.oldframe]; ! ov = oldframe.verts; if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0) --- 126,143 ---- 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]; ! qfiles.dtrivertx_t[] verts = frame.verts; ! qfiles.daliasframe_t oldframe = paliashdr.aliasFrames[currententity.oldframe]; ! qfiles.dtrivertx_t[] ov = oldframe.verts; if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0) *************** *** 166,170 **** gl.glDisable( GL.GL_TEXTURE_2D ); ! frontlerp = 1.0f - backlerp; // move should be the delta back to the previous frame * backlerp --- 150,154 ---- gl.glDisable( GL.GL_TEXTURE_2D ); ! float frontlerp = 1.0f - backlerp; // move should be the delta back to the previous frame * backlerp *************** *** 178,182 **** Math3D.VectorAdd (move, oldframe.translate, move); ! for (i=0 ; i<3 ; i++) { move[i] = backlerp*move[i] + frontlerp*frame.translate[i]; --- 162,166 ---- Math3D.VectorAdd (move, oldframe.translate, move); ! for (int i=0 ; i<3 ; i++) { move[i] = backlerp*move[i] + frontlerp*frame.translate[i]; *************** *** 187,191 **** // ab hier wird optimiert ! GL_LerpVerts( paliashdr.num_xyz, v, ov, verts, move, frontv, backv ); //gl.glEnableClientState( GL.GL_VERTEX_ARRAY ); --- 171,175 ---- // ab hier wird optimiert ! GL_LerpVerts( paliashdr.num_xyz, ov, verts, move, frontv, backv ); //gl.glEnableClientState( GL.GL_VERTEX_ARRAY ); *************** *** 207,211 **** FloatBuffer color = colorArrayBuf; int j = 0; ! for ( i = 0; i < paliashdr.num_xyz; i++ ) { l = shadedots[verts[i].lightnormalindex]; --- 191,196 ---- FloatBuffer color = colorArrayBuf; int j = 0; ! float l; ! for (int i = 0; i < paliashdr.num_xyz; i++ ) { l = shadedots[verts[i].lightnormalindex]; *************** *** 242,259 **** srcIndexBuf = paliashdr.indexElements[j]; ! size = (count < 0) ? -count + pos : count + pos; for (int k = pos; k < size; k++) { - srcIndex = 2 * k; dstIndex = 2 * srcIndexBuf.get(k-pos); ! dstTextureCoords.put(dstIndex, srcTextureCoords.get(srcIndex)); ! dstTextureCoords.put(dstIndex + 1, srcTextureCoords.get(srcIndex + 1)); } ! if (count < 0) { ! count = -count; ! gl.glDrawElements(GL.GL_TRIANGLE_FAN, count, GL.GL_UNSIGNED_INT, srcIndexBuf); ! } else { ! gl.glDrawElements(GL.GL_TRIANGLE_STRIP, count, GL.GL_UNSIGNED_INT, srcIndexBuf); ! } pos += count; } --- 227,245 ---- srcIndexBuf = paliashdr.indexElements[j]; ! int mode = GL.GL_TRIANGLE_STRIP; ! if (count < 0) { ! mode = GL.GL_TRIANGLE_FAN; ! count = -count; ! } ! size = count + pos; ! srcIndex = 2 * pos; for (int k = pos; k < size; k++) { dstIndex = 2 * srcIndexBuf.get(k-pos); ! dstTextureCoords.put(dstIndex++, srcTextureCoords.get(srcIndex++)); ! dstTextureCoords.put(dstIndex, srcTextureCoords.get(srcIndex++)); } ! gl.glDrawElements(mode, count, GL.GL_UNSIGNED_INT, srcIndexBuf); ! pos += count; } *************** *** 337,355 **** */ // 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; ! if ( ( e.frame >= paliashdr.num_frames ) || ( e.frame < 0 ) ) ! { ! VID.Printf (Defines.PRINT_ALL, "R_CullAliasModel " + currentmodel.name +": no such frame " + e.frame + '\n'); e.frame = 0; } ! if ( ( e.oldframe >= paliashdr.num_frames ) || ( e.oldframe < 0 ) ) ! { ! VID.Printf (Defines.PRINT_ALL, "R_CullAliasModel " + currentmodel.name + ": no such oldframe " + e.oldframe + '\n'); e.oldframe = 0; } --- 323,338 ---- */ // 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; ! ! if ((e.frame >= paliashdr.num_frames) || (e.frame < 0)) { ! VID.Printf(Defines.PRINT_ALL, "R_CullAliasModel " + currentmodel.name + ": no such frame " + e.frame + '\n'); e.frame = 0; } ! if ((e.oldframe >= paliashdr.num_frames) || (e.oldframe < 0)) { ! VID.Printf(Defines.PRINT_ALL, "R_CullAliasModel " + currentmodel.name + ": no such oldframe " + e.oldframe + '\n'); e.oldframe = 0; } *************** *** 361,395 **** ** compute axially aligned mins and maxs */ ! if ( pframe == poldframe ) ! { ! for ( int i = 0; i < 3; i++ ) ! { mins[i] = pframe.translate[i]; ! maxs[i] = mins[i] + pframe.scale[i]*255; } ! } ! else ! { ! //float[] thismins = {0, 0, 0}; ! //float[] oldmins = {0, 0, 0}; ! float[] thismaxs = {0, 0, 0}; ! float[] oldmaxs = {0, 0, 0}; ! for ( int i = 0; i < 3; i++ ) ! { ! //thismins[i] = pframe.translate[i]; ! thismaxs[i] = pframe.translate[i] + pframe.scale[i]*255; ! //oldmins[i] = poldframe.translate[i]; ! oldmaxs[i] = poldframe.translate[i] + poldframe.scale[i]*255; ! if ( pframe.translate[i] < poldframe.translate[i] ) mins[i] = pframe.translate[i]; else mins[i] = poldframe.translate[i]; ! if ( thismaxs[i] > oldmaxs[i] ) ! maxs[i] = thismaxs[i]; else ! maxs[i] = oldmaxs[i]; } } --- 344,368 ---- ** compute axially aligned mins and maxs */ ! if (pframe == poldframe) { ! for (int i = 0; i < 3; i++) { mins[i] = pframe.translate[i]; ! maxs[i] = mins[i] + pframe.scale[i] * 255; } ! } else { ! float thismaxs, oldmaxs; ! for (int i = 0; i < 3; i++) { ! thismaxs = pframe.translate[i] + pframe.scale[i] * 255; ! oldmaxs = poldframe.translate[i] + poldframe.scale[i] * 255; ! if (pframe.translate[i] < poldframe.translate[i]) mins[i] = pframe.translate[i]; else mins[i] = poldframe.translate[i]; ! if (thismaxs > oldmaxs) ! maxs[i] = thismaxs; else ! maxs[i] = oldmaxs; } } *************** *** 398,421 **** ** compute a full bounding box */ ! float[] tmp = {0, 0, 0}; ! for ( int i = 0; i < 8; i++ ) ! { ! ! if ( (i & 1) != 0 ) tmp[0] = mins[0]; else tmp[0] = maxs[0]; ! if ( (i & 2) != 0) tmp[1] = mins[1]; else tmp[1] = maxs[1]; ! if ( (i & 4) != 0) tmp[2] = mins[2]; else tmp[2] = maxs[2]; - - Math3D.VectorCopy( tmp, bbox[i] ); } --- 371,391 ---- ** compute a full bounding box */ ! float[] tmp; ! for (int i = 0; i < 8; i++) { ! tmp = bbox[i]; ! if ((i & 1) != 0) tmp[0] = mins[0]; else tmp[0] = maxs[0]; ! if ((i & 2) != 0) tmp[1] = mins[1]; else tmp[1] = maxs[1]; ! if ((i & 4) != 0) tmp[2] = mins[2]; else tmp[2] = maxs[2]; } *************** *** 423,456 **** ** rotate the bounding box */ ! //float[] angles = {0, 0, 0}; ! Math3D.VectorCopy( e.angles, tmp ); tmp[YAW] = -tmp[YAW]; ! Math3D.AngleVectors( tmp, vectors[0], vectors[1], vectors[2] ); ! for ( int i = 0; i < 8; i++ ) ! { ! Math3D.VectorCopy( bbox[i], tmp ); ! bbox[i][0] = Math3D.DotProduct( vectors[0], tmp ); ! bbox[i][1] = -Math3D.DotProduct( vectors[1], tmp ); ! bbox[i][2] = Math3D.DotProduct( vectors[2], tmp ); ! Math3D.VectorAdd( e.origin, bbox[i], bbox[i] ); } int f, mask; int aggregatemask = ~0; // 0xFFFFFFFF ! ! for ( int p = 0; p < 8; p++ ) ! { mask = 0; ! for ( f = 0; f < 4; f++ ) ! { ! float dp = Math3D.DotProduct( frustum[f].normal, bbox[p] ); ! if ( ( dp - frustum[f].dist ) < 0 ) ! { ! mask |= ( 1 << f ); } } --- 393,422 ---- ** rotate the bounding box */ ! tmp = mins; ! Math3D.VectorCopy(e.angles, tmp); tmp[YAW] = -tmp[YAW]; ! Math3D.AngleVectors(tmp, vectors[0], vectors[1], vectors[2]); ! for (int i = 0; i < 8; i++) { ! Math3D.VectorCopy(bbox[i], tmp); ! bbox[i][0] = Math3D.DotProduct(vectors[0], tmp); ! bbox[i][1] = -Math3D.DotProduct(vectors[1], tmp); ! bbox[i][2] = Math3D.DotProduct(vectors[2], tmp); ! Math3D.VectorAdd(e.origin, bbox[i], bbox[i]); } int f, mask; int aggregatemask = ~0; // 0xFFFFFFFF ! ! for (int p = 0; p < 8; p++) { mask = 0; ! for (f = 0; f < 4; f++) { ! float dp = Math3D.DotProduct(frustum[f].normal, bbox[p]); ! if ((dp - frustum[f].dist) < 0) { ! mask |= (1 << f); } } *************** *** 459,464 **** } ! if ( aggregatemask != 0 ) ! { return true; } --- 425,429 ---- } ! if (aggregatemask != 0) { return true; } |