From: Rene S. <sa...@us...> - 2006-10-31 13:06:35
|
Update of /cvsroot/jake2/jake2/src/jake2/render/fastjogl In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv15592/src/jake2/render/fastjogl Modified Files: Misc.java Image.java Main.java Added Files: GLWrapJogl.java Removed Files: Light.java Model.java Anorms.java Polygon.java Mesh.java Base.java Draw.java Warp.java Surf.java Log Message: major refactoring of the render module --- Base.java DELETED --- Index: Image.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastjogl/Image.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Image.java 10 Nov 2004 20:35:36 -0000 1.8 --- Image.java 31 Oct 2006 13:06:32 -0000 1.9 *************** *** 32,35 **** --- 32,37 ---- import jake2.qcommon.*; import jake2.render.image_t; + import jake2.render.common.Image.glmode_t; + import jake2.render.common.Image.gltmode_t; import jake2.util.Lib; import jake2.util.Vargs; *************** *** 47,1591 **** */ [...1850 lines suppressed...] ! } ! /* ! * GL_ShutdownImages ! */ ! protected void GL_ShutdownImages() { ! image_t image; ! for (int i = 0; i < numgltextures; i++) { ! image = gltextures[i]; ! if (image.registration_sequence == 0) ! continue; // free image_t slot ! // free it ! gl.glDeleteTextures(1, new int[] { image.texnum }); ! image.clear(); ! } ! } } \ No newline at end of file --- Surf.java DELETED --- --- Light.java DELETED --- --- Mesh.java DELETED --- --- Model.java DELETED --- Index: Main.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastjogl/Main.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Main.java 7 May 2005 18:23:26 -0000 1.8 --- Main.java 31 Oct 2006 13:06:32 -0000 1.9 *************** *** 29,37 **** import jake2.Globals; import jake2.client.*; ! import jake2.game.Cmd; ! import jake2.game.cplane_t; ! import jake2.game.cvar_t; import jake2.qcommon.*; import jake2.render.*; import jake2.util.Math3D; import jake2.util.Vargs; --- 29,37 ---- [...1342 lines suppressed...] - - for (i = 0; i < NUM_BEAM_SEGS; i++) { - v = start_points[i]; - gl.glVertex3f(v[0], v[1], v[2]); - v = end_points[i]; - gl.glVertex3f(v[0], v[1], v[2]); - v = start_points[(i + 1) % NUM_BEAM_SEGS]; - gl.glVertex3f(v[0], v[1], v[2]); - v = end_points[(i + 1) % NUM_BEAM_SEGS]; - gl.glVertex3f(v[0], v[1], v[2]); - } - gl.glEnd(); - - gl.glEnable(GL.GL_TEXTURE_2D); - gl.glDisable(GL.GL_BLEND); - gl.glDepthMask(true); - } - } --- 443,445 ---- --- Polygon.java DELETED --- --- NEW FILE: GLWrapJogl.java --- /* Copyright (C) 1997-2001 Id Software, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 28.10.2006 by RST. // $Id: GLWrapJogl.java,v 1.1 2006/10/31 13:06:31 salomo Exp $ package jake2.render.fastjogl; import java.nio.*; import net.java.games.jogl.GL; import jake2.*; import jake2.client.*; import jake2.game.*; import jake2.qcommon.*; import jake2.render.*; import jake2.render.common.GenericGL; import jake2.server.*; import net.java.games.jogl.*; public class GLWrapJogl implements GenericGL{ protected GL gl; public GLWrapJogl(GL gl) { this.gl = gl; } public void glTexParameterf(int gl_texture_2d, int gl_texture_min_filter, int gl_nearest) { gl.glTexParameterf(gl_texture_2d, gl_texture_min_filter, gl_nearest); } public void glBegin(int gl_triangle_fan2) { gl.glBegin(gl_triangle_fan2); } public void glTexCoord2f(float s, float t) { gl.glTexCoord2f(s, t); } public void glVertex3f(float f, float g, float h) { gl.glVertex3f(f, g, h); } public void glEnd() { gl.glEnd(); } public void glPushMatrix() { gl.glPushMatrix(); } public void glTranslatef(float f, float g, float h) { gl.glTranslatef(f, g, h); } public void glRotatef(float f, float g, float h, float i) { gl.glRotatef(f, g, h, i); } public void glPopMatrix() { gl.glPopMatrix(); } public void glColor3f(float f, float g, float h) { gl.glColor3f(f, g, h); } public void glDepthMask(boolean b) { gl.glDepthMask(b); } public void glDisable(int gl_texture_2d2) { gl.glDisable(gl_texture_2d2); } public void glBlendFunc(int gl_src_alpha2, int gl_one_minus_src_alpha2) { gl.glBlendFunc(gl_src_alpha2, gl_one_minus_src_alpha2); } public void glShadeModel(int gl_smooth2) { gl.glShadeModel(gl_smooth2); } public void glDrawArrays(int gl_polygon2, int pos, int numverts) { gl.glDrawArrays(gl_polygon2, pos, numverts); } public void glBindTexture(int gl_texture_2d2, int texnum) { gl.glBindTexture(gl_texture_2d2, texnum); } public void glActiveTextureARB(int texture) { gl.glActiveTextureARB( texture); } public void glClientActiveTextureARB(int texture) { gl.glClientActiveTextureARB(texture); } public void glTexEnvi(int gl_texture_env2, int gl_texture_env_mode2, int mode) { gl.glTexEnvi(gl_texture_env2, gl_texture_env_mode2, mode); } public void glVertex2f(int x, int y) { gl.glVertex2f(x, y); } public void glEnable(int gl_alpha_test2) { gl.glEnable(gl_alpha_test2); } public void glColor3ub(byte b, byte c, byte d) { gl.glColor3ub(b, c, d); } public void glColor4f(int i, int j, int k, float f) { gl.glColor4f(i, j, k, f); } public void glTexImage2D(int gl_texture_2d2, int i, int gl_tex_solid_format, int j, int k, int l, int gl_rgba3, int gl_unsigned_byte2, IntBuffer image32) { gl.glTexImage2D(gl_texture_2d2, i, gl_tex_solid_format, j, k, l, gl_rgba3, gl_unsigned_byte2, image32); } public void glTexImage2D(int gl_texture_2d2, int i, int gl_color_index8_ext, int j, int k, int l, int gl_color_index2, int gl_unsigned_byte2, ByteBuffer image8) { gl.glTexImage2D(gl_texture_2d2, i, gl_color_index8_ext, j, k, l, gl_color_index2, gl_unsigned_byte2, image8); } public void glColor4ub(byte b, byte c, byte d, byte e) { gl.glColor4ub(b, c, d, e); } public void glTexParameteri(int gl_texture_2d2, int gl_texture_min_filter2, int gl_filter_min) { gl.glTexParameteri(gl_texture_2d2, gl_texture_min_filter2, gl_filter_min); } public void glTexSubImage2D(int gl_texture_2d2, int i, int j, int k, int lm_block_width, int height, int gl_lightmap_format, int gl_unsigned_byte2, IntBuffer lightmap_buffer) { gl.glTexSubImage2D(gl_texture_2d2, i, j, k, lm_block_width, height, gl_lightmap_format, gl_unsigned_byte2, lightmap_buffer); } public final void glColor4f(float intens, float intens2, float intens3, float f) { gl.glColor4f(intens, intens2, intens3, f); } public final void glLoadMatrixf(float[] r_world_matrix) { gl.glLoadMatrixf(r_world_matrix); } public final void glInterleavedArrays(int gl_t2f_v3f2, int byte_stride, FloatBuffer globalPolygonInterleavedBuf) { gl.glInterleavedArrays(gl_t2f_v3f2, byte_stride, globalPolygonInterleavedBuf); } public final void glDrawElements(int mode, int count, int gl_unsigned_int2, IntBuffer srcIndexBuf) { gl.glDrawElements(mode, count, gl_unsigned_int2, srcIndexBuf); } public final void glDisableClientState(int gl_color_array2) { gl.glDisableClientState(gl_color_array2); } public final void glVertexPointer(int i, int gl_float2, int j, FloatBuffer vertexArrayBuf) { gl.glVertexPointer(i, gl_float2, j, vertexArrayBuf); } public final void glEnableClientState(int gl_color_array2) { gl.glEnableClientState(gl_color_array2); } public final void glColorPointer(int i, int gl_float2, int j, FloatBuffer colorArrayBuf) { gl.glColorPointer(i, gl_float2, j, colorArrayBuf); } public final void glTexCoordPointer(int i, int gl_float2, int j, FloatBuffer textureArrayBuf) { gl.glTexCoordPointer(i, gl_float2, j, textureArrayBuf); } public final void glDepthRange(float gldepthmin, double d) { gl.glDepthRange(gldepthmin, d); } public final void glMatrixMode(int gl_projection2) { gl.glMatrixMode(gl_projection2); } public final void glLoadIdentity() { gl.glLoadIdentity(); } public final void glScalef(int i, int j, int k) { gl.glScalef(i, j, k); } public final void glCullFace(int gl_back2) { gl.glCullFace(gl_back2); } public final void glClear(int gl_color_buffer_bit2) { gl.glClear(gl_color_buffer_bit2); } public final void glDepthFunc(int gl_lequal2) { gl.glDepthFunc(gl_lequal2); } public final void glFrustum(double xmin, double xmax, double ymin, double ymax, double near, double far) { gl.glFrustum(xmin, xmax, ymin, ymax, near, far); } public final void glViewport(int i, int j, int width, int height) { gl.glViewport(i, j, width, height); } public final void glOrtho(int i, int width, int height, int j, int k, int l) { gl.glOrtho(i, width, height, j, k, l); } public void glColorPointer(int i, int gl_unsigned_byte2, int j, ByteBuffer bb) { gl.glColorPointer(i, gl_unsigned_byte2, j, bb.asIntBuffer()); } public void glPointSize(float value) { gl.glPointSize(value); } public void glClearColor(float f, float g, float h, float i) { gl.glClearColor(f, g, h, i); } } --- Warp.java DELETED --- --- Anorms.java DELETED --- --- Draw.java DELETED --- Index: Misc.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastjogl/Misc.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Misc.java 11 May 2005 21:44:55 -0000 1.7 --- Misc.java 31 Oct 2006 13:06:32 -0000 1.8 *************** *** 6,27 **** */ /* ! Copyright (C) 1997-2001 Id Software, Inc. ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ! See the GNU General Public License for more details. ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ package jake2.render.fastjogl; --- 6,27 ---- */ /* ! Copyright (C) 1997-2001 Id Software, Inc. ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ! See the GNU General Public License for more details. ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ package jake2.render.fastjogl; *************** *** 30,33 **** --- 30,34 ---- import jake2.qcommon.FS; import jake2.qcommon.xcommand_t; + import jake2.render.common.Base; import java.io.*; *************** *** 41,94 **** /** * Misc ! * * @author cwei */ ! public abstract class Misc extends Mesh { ! ! /* ! ================== ! R_InitParticleTexture ! ================== ! */ ! byte[][] dottexture = { { 0, 0, 0, 0, 0, 0, 0, 0 }, { ! 0, 0, 1, 1, 0, 0, 0, 0 }, { ! 0, 1, 1, 1, 1, 0, 0, 0 }, ! { 0, 1, 1, 1, 1, 0, 0, 0 }, { ! 0, 0, 1, 1, 0, 0, 0, 0 }, { ! 0, 0, 0, 0, 0, 0, 0, 0 }, { ! 0, 0, 0, 0, 0, 0, 0, 0 }, { ! 0, 0, 0, 0, 0, 0, 0, 0 }, }; ! ! void R_InitParticleTexture() { ! int x, y; ! byte[] data = new byte[8 * 8 * 4]; ! ! // ! // particle texture ! // ! for (x = 0; x < 8; x++) { ! for (y = 0; y < 8; y++) { ! data[y * 32 + x * 4 + 0] = (byte) 255; ! data[y * 32 + x * 4 + 1] = (byte) 255; ! data[y * 32 + x * 4 + 2] = (byte) 255; ! data[y * 32 + x * 4 + 3] = (byte) (dottexture[x][y] * 255); ! ! } ! } ! r_particletexture = GL_LoadPic("***particle***", data, 8, 8, it_sprite, 32); ! ! // ! // also use this for bad textures, but without alpha ! // ! for (x = 0; x < 8; x++) { ! for (y = 0; y < 8; y++) { ! data[y * 32 + x * 4 + 0] = (byte) (dottexture[x & 3][y & 3] * 255); ! data[y * 32 + x * 4 + 1] = 0; // dottexture[x&3][y&3]*255; ! data[y * 32 + x * 4 + 2] = 0; //dottexture[x&3][y&3]*255; ! data[y * 32 + x * 4 + 3] = (byte) 255; ! } ! } ! r_notexture = GL_LoadPic("***r_notexture***", data, 8, 8, it_wall, 32); ! } // /* --- 42,49 ---- /** * Misc ! * * @author cwei */ ! public abstract class Misc extends Image { // /* *************** *** 113,117 **** * GL_ScreenShot_f */ ! void GL_ScreenShot_f() { if (contextInUse) { screenshot_f(); --- 68,72 ---- * GL_ScreenShot_f */ ! protected void GL_ScreenShot_f() { if (contextInUse) { screenshot_f(); *************** *** 197,215 **** VID.Printf(Defines.PRINT_ALL, "Wrote " + file + '\n'); } - - /* - ** GL_Strings_f - */ - void GL_Strings_f() { - VID.Printf(Defines.PRINT_ALL, "GL_VENDOR: " + gl_config.vendor_string + '\n'); - VID.Printf(Defines.PRINT_ALL, "GL_RENDERER: " + gl_config.renderer_string + '\n'); - VID.Printf(Defines.PRINT_ALL, "GL_VERSION: " + gl_config.version_string + '\n'); - VID.Printf(Defines.PRINT_ALL, "GL_EXTENSIONS: " + gl_config.extensions_string + '\n'); - } /* ** GL_SetDefaultState */ ! void GL_SetDefaultState() { gl.glClearColor(1f, 0f, 0.5f, 0.5f); // original quake2 //gl.glClearColor(0, 0, 0, 0); // replaced with black --- 152,160 ---- VID.Printf(Defines.PRINT_ALL, "Wrote " + file + '\n'); } /* ** GL_SetDefaultState */ ! protected void GL_SetDefaultState() { gl.glClearColor(1f, 0f, 0.5f, 0.5f); // original quake2 //gl.glClearColor(0, 0, 0, 0); // replaced with black *************** *** 268,272 **** } ! void GL_UpdateSwapInterval() { if (gl_swapinterval.modified) { gl_swapinterval.modified = false; --- 213,217 ---- } ! protected void GL_UpdateSwapInterval() { if (gl_swapinterval.modified) { gl_swapinterval.modified = false; |