From: Carsten W. <ca...@us...> - 2005-05-07 23:44:48
|
Update of /cvsroot/jake2/jake2/src/jake2/render/fastjogl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31831/src/jake2/render/fastjogl Modified Files: Mesh.java Model.java Log Message: model frame animation is now stored in an int[]; an int value contains the x, y, z, lightnormal (8bit for each element) this reduces the memory footprint massive and performs better Index: Model.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastjogl/Model.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Model.java 7 May 2005 18:00:03 -0000 1.10 --- Model.java 7 May 2005 23:44:38 -0000 1.11 *************** *** 995,1001 **** poutframe[i] = new qfiles.daliasframe_t(buffer); // verts are all 8 bit, so no swapping needed ! poutframe[i].verts = new qfiles.dtrivertx_t[pheader.num_xyz]; for (int k = 0; k < pheader.num_xyz; k++) { ! poutframe[i].verts[k] = new qfiles.dtrivertx_t(buffer); } } --- 995,1001 ---- poutframe[i] = new qfiles.daliasframe_t(buffer); // verts are all 8 bit, so no swapping needed ! poutframe[i].verts = new int[pheader.num_xyz]; for (int k = 0; k < pheader.num_xyz; k++) { ! poutframe[i].verts[k] = buffer.getInt(); } } Index: Mesh.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastjogl/Mesh.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Mesh.java 7 May 2005 22:15:05 -0000 1.9 --- Mesh.java 7 May 2005 23:44:38 -0000 1.10 *************** *** 72,79 **** 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) { ! qfiles.dtrivertx_t ovv, vv; FloatBuffer lerp = vertexArrayBuf; --- 72,78 ---- float[] shadedots = r_avertexnormal_dots[0]; ! void GL_LerpVerts(int nverts, int[] ov, int[] v, float[] move, float[] frontv, float[] backv) { ! int ovv, vv; FloatBuffer lerp = vertexArrayBuf; *************** *** 83,111 **** | 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 */ ! ) { ! normal = r_avertexnormals[verts[i].lightnormalindex()]; ! ovv = ov[i]; ! vv = verts[i]; ! ! lerp.put(j++, move[0] + ovv.v0() * backv[0] + vv.v0() * frontv[0] ! + normal[0] * Defines.POWERSUIT_SCALE); ! lerp.put(j++, move[1] + ovv.v1() * backv[1] + vv.v1() * frontv[1] ! + normal[1] * Defines.POWERSUIT_SCALE); ! lerp.put(j++, move[2] + ovv.v2() * backv[2] + vv.v2() * frontv[2] ! + normal[2] * Defines.POWERSUIT_SCALE); ! } } else { ! int j = 0; ! for (int i = 0; i < nverts; i++ /* , v++, ov++, lerp+=4 */ ! ) { ! ovv = ov[i]; ! vv = verts[i]; ! ! lerp.put(j++, move[0] + ovv.v0() * backv[0] + vv.v0() * frontv[0]); ! lerp.put(j++, move[1] + ovv.v1() * backv[1] + vv.v1() * frontv[1]); ! lerp.put(j++, move[2] + ovv.v2() * backv[2] + vv.v2() * frontv[2]); ! } } } --- 82,106 ---- | Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0) { float[] normal; ! int j = -1; ! 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, move[1] + ((ovv >>> 8) & 0xFF) * backv[1] + ((vv >>> 8) & 0xFF) * frontv[1] + normal[1] * Defines.POWERSUIT_SCALE); ! lerp.put(++j, move[2] + ((ovv >>> 16) & 0xFF) * backv[2] + ((vv >>> 16) & 0xFF) * frontv[2] + normal[2] * Defines.POWERSUIT_SCALE); ! } } else { ! int j = -1; ! for (int i=0 ; i < nverts; i++ /* , v++, ov++, lerp+=4 */) ! { ! ovv = ov[i]; ! vv = v[i]; ! ! lerp.put(++j, move[0] + (ovv & 0xFF)* backv[0] + (vv & 0xFF)*frontv[0]); ! lerp.put(++j, move[1] + ((ovv >>> 8) & 0xFF)* backv[1] + ((vv >>> 8) & 0xFF)*frontv[1]); ! lerp.put(++j, move[2] + ((ovv >>> 16) & 0xFF)* backv[2] + ((vv >>> 16) & 0xFF)*frontv[2]); ! } } } *************** *** 141,149 **** 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) --- 136,144 ---- qfiles.daliasframe_t frame = paliashdr.aliasFrames[currententity.frame]; ! int[] verts = frame.verts; qfiles.daliasframe_t oldframe = paliashdr.aliasFrames[currententity.oldframe]; ! int[] ov = oldframe.verts; if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0) *************** *** 206,210 **** float l; for (int i = 0; i < paliashdr.num_xyz; i++) { ! l = shadedots[verts[i].lightnormalindex()]; color.put(j++, l * shadelight[0]); color.put(j++, l * shadelight[1]); --- 201,205 ---- float l; for (int i = 0; i < paliashdr.num_xyz; i++) { ! l = shadedots[(verts[i] >>> 24 ) & 0xFF]; color.put(j++, l * shadelight[0]); color.put(j++, l * shadelight[1]); *************** *** 271,275 **** */ void GL_DrawAliasShadow(qfiles.dmdl_t paliashdr, int posenum) { - qfiles.dtrivertx_t[] verts; int[] order; float height, lheight; --- 266,269 ---- *************** *** 281,286 **** frame = paliashdr.aliasFrames[currententity.frame]; - verts = frame.verts; - height = 0; --- 275,278 ---- |