diff options
-rw-r--r-- | src/jake2/qcommon/qfiles.java | 33 | ||||
-rw-r--r-- | src/jake2/render/fastjogl/Mesh.java | 29 | ||||
-rw-r--r-- | src/jake2/render/jogl/Mesh.java | 45 | ||||
-rw-r--r-- | src/jake2/render/lwjgl/Mesh.java | 30 |
4 files changed, 77 insertions, 60 deletions
diff --git a/src/jake2/qcommon/qfiles.java b/src/jake2/qcommon/qfiles.java index 8e524a5..8805ce9 100644 --- a/src/jake2/qcommon/qfiles.java +++ b/src/jake2/qcommon/qfiles.java @@ -2,7 +2,7 @@ * qfiles.java * Copyright (C) 2003 * - * $Id: qfiles.java,v 1.4 2004-07-09 06:50:50 hzi Exp $ + * $Id: qfiles.java,v 1.5 2005-05-07 22:15:04 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -195,14 +195,33 @@ public class qfiles { } public static class dtrivertx_t { - public int v[] = { 0, 0, 0 }; // byte 0..255 scaled byte to fit in frame mins/maxs - public int lightnormalindex; // byte 0 .. 255; + private byte v0; // byte 0..255 scaled byte to fit in frame mins/maxs + private byte v1; + private byte v2; + + private byte lightnormalindex; // byte 0 .. 255; public dtrivertx_t(ByteBuffer b) { - v[0] = b.get() & 0xff; // unsigned byte - v[1] = b.get() & 0xff; // unsigned byte - v[2] = b.get() & 0xff; // unsigned byte - lightnormalindex = b.get() & 0xff; // unsigned byte + v0 = b.get(); // unsigned byte + v1 = b.get(); // unsigned byte + v2 = b.get(); // unsigned byte + lightnormalindex = b.get(); // unsigned byte + } + + public final int v0() { + return v0 & 0xFF; + } + + public final int v1() { + return v1 & 0xFF; + } + + public final int v2() { + return v2 & 0xFF; + } + + public final int lightnormalindex() { + return lightnormalindex & 0xFF; } } diff --git a/src/jake2/render/fastjogl/Mesh.java b/src/jake2/render/fastjogl/Mesh.java index 670722e..9635052 100644 --- a/src/jake2/render/fastjogl/Mesh.java +++ b/src/jake2/render/fastjogl/Mesh.java @@ -2,7 +2,7 @@ * Mesh.java * Copyright (C) 2003 * - * $Id: Mesh.java,v 1.8 2005-01-22 22:30:35 cawe Exp $ + * $Id: Mesh.java,v 1.9 2005-05-07 22:15:05 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -74,8 +74,7 @@ public abstract class Mesh extends Light { void GL_LerpVerts(int nverts, qfiles.dtrivertx_t[] ov, qfiles.dtrivertx_t[] verts, float[] move, float[] frontv, float[] backv) { - int[] ovv; - int[] vv; + qfiles.dtrivertx_t ovv, vv; FloatBuffer lerp = vertexArrayBuf; //PMM -- added RF_SHELL_DOUBLE, RF_SHELL_HALF_DAM @@ -86,27 +85,27 @@ public abstract class Mesh extends Light { int j = 0; for (int i = 0; i < nverts; i++ /* , v++, ov++, lerp+=4 */ ) { - normal = r_avertexnormals[verts[i].lightnormalindex]; - ovv = ov[i].v; - vv = verts[i].v; + normal = r_avertexnormals[verts[i].lightnormalindex()]; + ovv = ov[i]; + vv = verts[i]; - lerp.put(j++, move[0] + ovv[0] * backv[0] + vv[0] * frontv[0] + lerp.put(j++, move[0] + ovv.v0() * backv[0] + vv.v0() * frontv[0] + normal[0] * Defines.POWERSUIT_SCALE); - lerp.put(j++, move[1] + ovv[1] * backv[1] + vv[1] * frontv[1] + lerp.put(j++, move[1] + ovv.v1() * backv[1] + vv.v1() * frontv[1] + normal[1] * Defines.POWERSUIT_SCALE); - lerp.put(j++, move[2] + ovv[2] * backv[2] + vv[2] * frontv[2] + 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].v; - vv = verts[i].v; + ovv = ov[i]; + vv = verts[i]; - 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]); + 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]); } } } @@ -206,7 +205,7 @@ public abstract class Mesh extends Light { int j = 0; float l; for (int i = 0; i < paliashdr.num_xyz; i++) { - l = shadedots[verts[i].lightnormalindex]; + l = shadedots[verts[i].lightnormalindex()]; color.put(j++, l * shadelight[0]); color.put(j++, l * shadelight[1]); color.put(j++, l * shadelight[2]); diff --git a/src/jake2/render/jogl/Mesh.java b/src/jake2/render/jogl/Mesh.java index ee6a8fb..9d85fee 100644 --- a/src/jake2/render/jogl/Mesh.java +++ b/src/jake2/render/jogl/Mesh.java @@ -2,7 +2,7 @@ * Mesh.java * Copyright (C) 2003 * - * $Id: Mesh.java,v 1.8 2005-04-08 14:05:34 cawe Exp $ + * $Id: Mesh.java,v 1.9 2005-05-07 22:15:04 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -84,23 +84,23 @@ public abstract class Mesh extends Light { float[] normal; for (i = 0; i < nverts; i++ /* , v++, ov++, lerp+=4 */ ) { - normal = r_avertexnormals[verts[i].lightnormalindex]; + normal = r_avertexnormals[verts[i].lightnormalindex()]; - lerp[i][0] = move[0] + ov[i].v[0] * backv[0] + v[i].v[0] + lerp[i][0] = move[0] + ov[i].v0() * backv[0] + v[i].v0() * frontv[0] + normal[0] * Defines.POWERSUIT_SCALE; - lerp[i][1] = move[1] + ov[i].v[1] * backv[1] + v[i].v[1] + lerp[i][1] = move[1] + ov[i].v1() * backv[1] + v[i].v1() * frontv[1] + normal[1] * Defines.POWERSUIT_SCALE; - lerp[i][2] = move[2] + ov[i].v[2] * backv[2] + v[i].v[2] + lerp[i][2] = move[2] + ov[i].v2() * backv[2] + v[i].v2() * frontv[2] + normal[2] * Defines.POWERSUIT_SCALE; } } else { for (i = 0; i < nverts; i++ /* , v++, ov++, lerp+=4 */ ) { - lerp[i][0] = move[0] + ov[i].v[0] * backv[0] + v[i].v[0] + lerp[i][0] = move[0] + ov[i].v0() * backv[0] + v[i].v0() * frontv[0]; - lerp[i][1] = move[1] + ov[i].v[1] * backv[1] + v[i].v[1] + lerp[i][1] = move[1] + ov[i].v1() * backv[1] + v[i].v1() * frontv[1]; - lerp[i][2] = move[2] + ov[i].v[2] * backv[2] + v[i].v[2] + lerp[i][2] = move[2] + ov[i].v2() * backv[2] + v[i].v2() * frontv[2]; } } @@ -111,8 +111,7 @@ public abstract class Mesh extends Light { float[] frontv, float[] backv) { int lerpIndex = 0; - int[] ovv; - int[] vv; + qfiles.dtrivertx_t ovv, vv; FloatBuffer lerp = vertexArrayBuf; //PMM -- added RF_SHELL_DOUBLE, RF_SHELL_HALF_DAM @@ -123,15 +122,15 @@ public abstract class Mesh extends Light { int j = 0; for (int i = 0; i < nverts; i++ /* , v++, ov++, lerp+=4 */ ) { - normal = r_avertexnormals[verts[i].lightnormalindex]; - ovv = ov[i].v; - vv = v[i].v; + normal = r_avertexnormals[verts[i].lightnormalindex()]; + ovv = ov[i]; + vv = v[i]; - lerp.put(j, move[0] + ovv[0] * backv[0] + vv[0] * frontv[0] + lerp.put(j, move[0] + ovv.v0() * backv[0] + vv.v0() * frontv[0] + normal[0] * Defines.POWERSUIT_SCALE); - lerp.put(j + 1, move[1] + ovv[1] * backv[1] + vv[1] * frontv[1] + lerp.put(j + 1, move[1] + ovv.v1() * backv[1] + vv.v1() * frontv[1] + normal[1] * Defines.POWERSUIT_SCALE); - lerp.put(j + 2, move[2] + ovv[2] * backv[2] + vv[2] * frontv[2] + lerp.put(j + 2, move[2] + ovv.v2() * backv[2] + vv.v2() * frontv[2] + normal[2] * Defines.POWERSUIT_SCALE); j += 3; } @@ -139,15 +138,15 @@ public abstract class Mesh extends Light { int j = 0; for (int i = 0; i < nverts; i++ /* , v++, ov++, lerp+=4 */ ) { - ovv = ov[i].v; - vv = v[i].v; + ovv = ov[i]; + vv = v[i]; - lerp.put(j, move[0] + ovv[0] * backv[0] + vv[0] * frontv[0]); + lerp.put(j, move[0] + ovv.v0() * backv[0] + vv.v0() * frontv[0]); lerp - .put(j + 1, move[1] + ovv[1] * backv[1] + vv[1] + .put(j + 1, move[1] + ovv.v1() * backv[1] + vv.v1() * frontv[1]); lerp - .put(j + 2, move[2] + ovv[2] * backv[2] + vv[2] + .put(j + 2, move[2] + ovv.v2() * backv[2] + vv.v2() * frontv[2]); j += 3; } @@ -258,7 +257,7 @@ public abstract class Mesh extends Light { FloatBuffer color = colorArrayBuf; int j = 0; for (i = 0; i < paliashdr.num_xyz; i++) { - l = shadedots[verts[i].lightnormalindex]; + l = shadedots[verts[i].lightnormalindex()]; color.put(j++, l * shadelight[0]); color.put(j++, l * shadelight[1]); color.put(j++, l * shadelight[2]); @@ -358,7 +357,7 @@ public abstract class Mesh extends Light { orderIndex += 3; // normals and vertexes come from the frame list - l = shadedots[verts[index_xyz].lightnormalindex]; + l = shadedots[verts[index_xyz].lightnormalindex()]; gl.glColor4f(l * shadelight[0], l * shadelight[1], l * shadelight[2], alpha); diff --git a/src/jake2/render/lwjgl/Mesh.java b/src/jake2/render/lwjgl/Mesh.java index 34af9ec..48a62ff 100644 --- a/src/jake2/render/lwjgl/Mesh.java +++ b/src/jake2/render/lwjgl/Mesh.java @@ -2,7 +2,7 @@ * Mesh.java * Copyright (C) 2003 * - * $Id: Mesh.java,v 1.5 2005-02-01 16:55:07 cawe Exp $ + * $Id: Mesh.java,v 1.6 2005-05-07 22:15:05 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -78,11 +78,11 @@ public abstract class Mesh extends Light { */ void GL_LerpVerts(int nverts, qfiles.dtrivertx_t[] ov, qfiles.dtrivertx_t[] verts, float[] move, float[] frontv, float[] backv ) { - int[] ovv; - int[] vv; FloatBuffer lerp = vertexArrayBuf; lerp.limit((nverts << 2) - nverts); // nverts * 3 + qfiles.dtrivertx_t 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 ) { @@ -90,13 +90,13 @@ public abstract class Mesh extends Light { int j = -1; for (int i=0 ; i < nverts; i++/* , v++, ov++, lerp+=4 */) { - normal = r_avertexnormals[verts[i].lightnormalindex]; - ovv = ov[i].v; - vv = verts[i].v; + normal = r_avertexnormals[verts[i].lightnormalindex()]; + ovv = ov[i]; + vv = verts[i]; - 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); + 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 @@ -104,12 +104,12 @@ public abstract class Mesh extends Light { int j = -1; for (int i=0 ; i < nverts; i++ /* , v++, ov++, lerp+=4 */) { - ovv = ov[i].v; - vv = verts[i].v; + ovv = ov[i]; + vv = verts[i]; - 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]); + 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]); } } } @@ -198,7 +198,7 @@ public abstract class Mesh extends Light { int size = paliashdr.num_xyz; for (int i = 0; i < size; i++ ) { - l = shadedots[verts[i].lightnormalindex]; + l = shadedots[verts[i].lightnormalindex()]; color.put(++j, l * shadelight[0]); color.put(++j, l * shadelight[1]); color.put(++j, l * shadelight[2]); |