diff options
Diffstat (limited to 'src/jake2/render/fastjogl/Mesh.java')
-rw-r--r-- | src/jake2/render/fastjogl/Mesh.java | 77 |
1 files changed, 35 insertions, 42 deletions
diff --git a/src/jake2/render/fastjogl/Mesh.java b/src/jake2/render/fastjogl/Mesh.java index 0b52ad8..f774d13 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.12 2005-06-09 07:59:58 cawe Exp $ + * $Id: Mesh.java,v 1.12.4.1 2005-10-24 22:41:11 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -30,15 +30,11 @@ 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 jake2.util.*; import java.nio.FloatBuffer; import java.nio.IntBuffer; -import net.java.games.jogl.GL; -import net.java.games.jogl.util.BufferUtils; - /** * Mesh * @@ -107,14 +103,11 @@ public abstract class Mesh extends Light { } } - FloatBuffer colorArrayBuf = BufferUtils - .newFloatBuffer(qfiles.MAX_VERTS * 4); + FloatBuffer colorArrayBuf = Lib.newFloatBuffer(qfiles.MAX_VERTS * 4); - FloatBuffer vertexArrayBuf = BufferUtils - .newFloatBuffer(qfiles.MAX_VERTS * 3); + FloatBuffer vertexArrayBuf = Lib.newFloatBuffer(qfiles.MAX_VERTS * 3); - FloatBuffer textureArrayBuf = BufferUtils - .newFloatBuffer(qfiles.MAX_VERTS * 2); + FloatBuffer textureArrayBuf = Lib.newFloatBuffer(qfiles.MAX_VERTS * 2); boolean isFilled = false; @@ -152,7 +145,7 @@ public abstract class Mesh extends Light { 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) - gl.glDisable(GL.GL_TEXTURE_2D); + gl.glDisable(GL_TEXTURE_2D); float frontlerp = 1.0f - backlerp; @@ -183,8 +176,8 @@ public abstract class Mesh extends Light { Vec3Cache.release(3); // frontv, move, backv - //gl.glEnableClientState( GL.GL_VERTEX_ARRAY ); - gl.glVertexPointer(3, GL.GL_FLOAT, 0, vertexArrayBuf); + //gl.glEnableClientState( GL_VERTEX_ARRAY ); + gl.glVertexPointer(3, 0, vertexArrayBuf); // PMM - added double damage shell if ((currententity.flags & (Defines.RF_SHELL_RED @@ -192,8 +185,8 @@ public abstract class Mesh extends Light { | Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0) { gl.glColor4f(shadelight[0], shadelight[1], shadelight[2], alpha); } else { - gl.glEnableClientState(GL.GL_COLOR_ARRAY); - gl.glColorPointer(4, GL.GL_FLOAT, 0, colorArrayBuf); + gl.glEnableClientState(GL_COLOR_ARRAY); + gl.glColorPointer(4, 0, colorArrayBuf); // // pre light everything @@ -212,8 +205,8 @@ public abstract class Mesh extends Light { } gl.glClientActiveTextureARB(GL_TEXTURE0); - gl.glTexCoordPointer(2, GL.GL_FLOAT, 0, textureArrayBuf); - //gl.glEnableClientState( GL.GL_TEXTURE_COORD_ARRAY); + gl.glTexCoordPointer(2, 0, textureArrayBuf); + //gl.glEnableClientState( GL_TEXTURE_COORD_ARRAY); int pos = 0; int[] counts = paliashdr.counts; @@ -235,9 +228,9 @@ public abstract class Mesh extends Light { srcIndexBuf = paliashdr.indexElements[j]; - int mode = GL.GL_TRIANGLE_STRIP; + int mode = GL_TRIANGLE_STRIP; if (count < 0) { - mode = GL.GL_TRIANGLE_FAN; + mode = GL_TRIANGLE_FAN; count = -count; } srcIndex = pos << 1; @@ -249,7 +242,7 @@ public abstract class Mesh extends Light { .put(dstIndex, srcTextureCoords.get(srcIndex++)); } - gl.glDrawElements(mode, count, GL.GL_UNSIGNED_INT, srcIndexBuf); + gl.glDrawElements(mode, srcIndexBuf); pos += count; } @@ -258,9 +251,9 @@ public abstract class Mesh extends Light { 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) - gl.glEnable(GL.GL_TEXTURE_2D); + gl.glEnable(GL_TEXTURE_2D); - gl.glDisableClientState(GL.GL_COLOR_ARRAY); + gl.glDisableClientState(GL_COLOR_ARRAY); } @@ -296,9 +289,9 @@ public abstract class Mesh extends Light { break; // done if (count < 0) { count = -count; - gl.glBegin(GL.GL_TRIANGLE_FAN); + gl.glBegin(GL_TRIANGLE_FAN); } else - gl.glBegin(GL.GL_TRIANGLE_STRIP); + gl.glBegin(GL_TRIANGLE_STRIP); do { index = order[orderIndex + 2] * 3; @@ -594,15 +587,15 @@ public abstract class Mesh extends Light { if ((currententity.flags & Defines.RF_WEAPONMODEL) != 0 && (r_lefthand.value == 1.0f)) { - gl.glMatrixMode(GL.GL_PROJECTION); + gl.glMatrixMode(GL_PROJECTION); gl.glPushMatrix(); gl.glLoadIdentity(); gl.glScalef(-1, 1, 1); MYgluPerspective(r_newrefdef.fov_y, (float) r_newrefdef.width / r_newrefdef.height, 4, 4096); - gl.glMatrixMode(GL.GL_MODELVIEW); + gl.glMatrixMode(GL_MODELVIEW); - gl.glCullFace(GL.GL_BACK); + gl.glCullFace(GL_BACK); } gl.glPushMatrix(); @@ -628,11 +621,11 @@ public abstract class Mesh extends Light { // draw it - gl.glShadeModel(GL.GL_SMOOTH); + gl.glShadeModel(GL_SMOOTH); - GL_TexEnv(GL.GL_MODULATE); + GL_TexEnv(GL_MODULATE); if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0) { - gl.glEnable(GL.GL_BLEND); + gl.glEnable(GL_BLEND); } if ((currententity.frame >= paliashdr.num_frames) @@ -658,21 +651,21 @@ public abstract class Mesh extends Light { GL_DrawAliasFrameLerp(paliashdr, currententity.backlerp); - GL_TexEnv(GL.GL_REPLACE); - gl.glShadeModel(GL.GL_FLAT); + GL_TexEnv(GL_REPLACE); + gl.glShadeModel(GL_FLAT); gl.glPopMatrix(); if ((currententity.flags & Defines.RF_WEAPONMODEL) != 0 && (r_lefthand.value == 1.0F)) { - gl.glMatrixMode(GL.GL_PROJECTION); + gl.glMatrixMode(GL_PROJECTION); gl.glPopMatrix(); - gl.glMatrixMode(GL.GL_MODELVIEW); - gl.glCullFace(GL.GL_FRONT); + gl.glMatrixMode(GL_MODELVIEW); + gl.glCullFace(GL_FRONT); } if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0) { - gl.glDisable(GL.GL_BLEND); + gl.glDisable(GL_BLEND); } if ((currententity.flags & Defines.RF_DEPTHHACK) != 0) @@ -682,12 +675,12 @@ public abstract class Mesh extends Light { && (currententity.flags & (Defines.RF_TRANSLUCENT | Defines.RF_WEAPONMODEL)) == 0) { gl.glPushMatrix(); R_RotateForEntity(e); - gl.glDisable(GL.GL_TEXTURE_2D); - gl.glEnable(GL.GL_BLEND); + gl.glDisable(GL_TEXTURE_2D); + gl.glEnable(GL_BLEND); gl.glColor4f(0, 0, 0, 0.5f); GL_DrawAliasShadow(paliashdr, currententity.frame); - gl.glEnable(GL.GL_TEXTURE_2D); - gl.glDisable(GL.GL_BLEND); + gl.glEnable(GL_TEXTURE_2D); + gl.glDisable(GL_BLEND); gl.glPopMatrix(); } gl.glColor4f(1, 1, 1, 1); |