From: Rene S. <sa...@us...> - 2004-09-22 19:22:56
|
Update of /cvsroot/jake2/jake2/src/jake2/render/fastjogl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11556/src/jake2/render/fastjogl Modified Files: Model.java Misc.java Image.java Surf.java Light.java Mesh.java Warp.java Log Message: major refactoring in game, server and client package Index: Model.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastjogl/Model.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Model.java 19 Jul 2004 19:39:57 -0000 1.4 --- Model.java 22 Sep 2004 19:22:10 -0000 1.5 *************** *** 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, [...2576 lines suppressed...] ! model.counts[i] = count; ! ! count = (count < 0) ? -count : count; ! model.vertexIndexBuf.position(pos); ! model.indexElements[i] = model.vertexIndexBuf.slice(); ! pos += count; ! } ! } ! ! static void resetModelArrays() { ! globalModelTextureCoordBuf.rewind(); ! globalModelVertexIndexBuf.rewind(); ! } ! ! static void modelMemoryUsage() { ! System.out.println("AliasModels: globalVertexBuffer size " ! + globalModelVertexIndexBuf.position()); ! } ! } \ No newline at end of file Index: Surf.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastjogl/Surf.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Surf.java 19 Jul 2004 19:39:57 -0000 1.4 --- Surf.java 22 Sep 2004 19:22:11 -0000 1.5 *************** *** 6,38 **** */ /* ! 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, [...2783 lines suppressed...] ! // pix.get(pixel); ! // ! // BufferedImage image = new BufferedImage(w, h, ! // BufferedImage.TYPE_4BYTE_ABGR); ! // image.setRGB(0, 0, w, h, pixel, 0, w); ! // AffineTransformOp op = new ! // AffineTransformOp(AffineTransform.getScaleInstance(scale, scale), ! // AffineTransformOp.TYPE_NEAREST_NEIGHBOR); ! // BufferedImage tmp = op.filter(image, null); ! // ! // if (frame == null) { ! // frame = new ImageFrame(null); ! // frame.show(); ! // } ! // frame.showImage(tmp); ! // ! // } ! ! } \ No newline at end of file Index: Image.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastjogl/Image.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Image.java 19 Jul 2004 19:39:57 -0000 1.5 --- Image.java 22 Sep 2004 19:22:10 -0000 1.6 *************** *** 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, [...3280 lines suppressed...] ! /* ! * =============== GL_ShutdownImages =============== ! */ ! 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 ! // TODO jogl bug ! gl.glDeleteTextures(1, new int[] { image.texnum }); ! image.clear(); ! } ! } ! ! } \ No newline at end of file Index: Light.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastjogl/Light.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Light.java 10 Sep 2004 19:02:52 -0000 1.8 --- Light.java 22 Sep 2004 19:22:11 -0000 1.9 *************** *** 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, [...1432 lines suppressed...] ! a = 255 - ((r + g + b) / 3); ! r *= a / 255.0f; ! g *= a / 255.0f; ! b *= a / 255.0f; ! break; ! case 'A': ! default: ! r = g = b = 0; ! a = 255 - a; ! break; ! } ! //r &= 0xFF; g &= 0xFF; b &= 0xFF; a &= 0xFF; ! dest.put(destp++, (a << 24) | (b << 16) | (g << 8) ! | (r << 0)); ! } ! } ! } ! } ! } \ No newline at end of file Index: Warp.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastjogl/Warp.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Warp.java 16 Jul 2004 10:11:35 -0000 1.3 --- Warp.java 22 Sep 2004 19:22:11 -0000 1.4 *************** *** 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, [...1365 lines suppressed...] ! } ! ! sky_images[i] = GL_FindImage(pathname, it_sky); ! ! if (sky_images[i] == null) ! sky_images[i] = r_notexture; ! ! if (gl_skymip.value != 0 || skyrotate != 0) { // take less memory ! gl_picmip.value--; ! sky_min = 1.0f / 256; ! sky_max = 255.0f / 256; ! } else { ! sky_min = 1.0f / 512; ! sky_max = 511.0f / 512; ! } ! } ! } ! ! } \ No newline at end of file Index: Mesh.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastjogl/Mesh.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Mesh.java 19 Jul 2004 19:39:57 -0000 1.5 --- Mesh.java 22 Sep 2004 19:22:11 -0000 1.6 *************** *** 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, [...1343 lines suppressed...] ! if ((currententity.flags & Defines.RF_DEPTHHACK) != 0) ! gl.glDepthRange(gldepthmin, gldepthmax); ! ! if (gl_shadows.value != 0.0f ! && (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.glColor4f(0, 0, 0, 0.5f); ! GL_DrawAliasShadow(paliashdr, currententity.frame); ! gl.glEnable(GL.GL_TEXTURE_2D); ! gl.glDisable(GL.GL_BLEND); ! gl.glPopMatrix(); ! } ! gl.glColor4f(1, 1, 1, 1); ! } ! ! } \ No newline at end of file Index: Misc.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastjogl/Misc.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Misc.java 16 Jul 2004 10:11:35 -0000 1.2 --- Misc.java 22 Sep 2004 19:22:10 -0000 1.3 *************** *** 26,34 **** package jake2.render.fastjogl; - import net.java.games.jogl.GL; - import net.java.games.jogl.WGL; - import jake2.Defines; import jake2.client.VID; /** --- 26,33 ---- package jake2.render.fastjogl; import jake2.Defines; import jake2.client.VID; + import net.java.games.jogl.GL; + import net.java.games.jogl.WGL; /** *************** *** 44,62 **** ================== */ ! 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]; --- 43,57 ---- ================== */ ! 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]; *************** *** 64,75 **** // 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); } --- 59,68 ---- // 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); } *************** *** 80,91 **** // 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; } } --- 73,82 ---- // 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; } } *************** *** 93,113 **** } ! ! // /* ! // ============================================================================== ! // ! // SCREEN SHOTS ! // ! // ============================================================================== ! // */ ! // ! // typedef struct _TargaHeader { ! // unsigned char id_length, colormap_type, image_type; ! // unsigned short colormap_index, colormap_length; ! // unsigned char colormap_size; ! // unsigned short x_origin, y_origin, width, height; ! // unsigned char pixel_size, attributes; ! // } TargaHeader; ! /* --- 84,102 ---- } ! // /* ! // ============================================================================== ! // ! // SCREEN SHOTS ! // ! // ============================================================================== ! // */ ! // ! // typedef struct _TargaHeader { ! // unsigned char id_length, colormap_type, image_type; ! // unsigned short colormap_index, colormap_length; ! // unsigned char colormap_size; ! // unsigned short x_origin, y_origin, width, height; ! // unsigned char pixel_size, attributes; ! // } TargaHeader; /* *************** *** 115,185 **** GL_ScreenShot_f ================== ! */ ! void GL_ScreenShot_f() ! { ! // byte *buffer; ! // char picname[80]; ! // char checkname[MAX_OSPATH]; ! // int i, c, temp; ! // FILE *f; ! // ! // // create the scrnshots directory if it doesn't exist ! // Com_sprintf (checkname, sizeof(checkname), "%s/scrnshot", ri.FS_Gamedir()); ! // Sys_Mkdir (checkname); ! // ! //// ! //// find a file name to save it to ! //// ! // strcpy(picname,"quake00.tga"); ! // ! // for (i=0 ; i<=99 ; i++) ! // { ! // picname[5] = i/10 + '0'; ! // picname[6] = i%10 + '0'; ! // Com_sprintf (checkname, sizeof(checkname), "%s/scrnshot/%s", ri.FS_Gamedir(), picname); ! // f = fopen (checkname, "r"); ! // if (!f) ! // break; // file doesn't exist ! // fclose (f); ! // } ! // if (i==100) ! // { ! // VID.Printf (PRINT_ALL, "SCR_ScreenShot_f: Couldn't create a file\n"); ! // return; ! // } ! // ! // ! // buffer = malloc(vid.width*vid.height*3 + 18); ! // memset (buffer, 0, 18); ! // buffer[2] = 2; // uncompressed type ! // buffer[12] = vid.width&255; ! // buffer[13] = vid.width>>8; ! // buffer[14] = vid.height&255; ! // buffer[15] = vid.height>>8; ! // buffer[16] = 24; // pixel size ! // ! // qglReadPixels (0, 0, vid.width, vid.height, GL_RGB, GL_UNSIGNED_BYTE, buffer+18 ); ! // ! // // swap rgb to bgr ! // c = 18+vid.width*vid.height*3; ! // for (i=18 ; i<c ; i+=3) ! // { ! // temp = buffer[i]; ! // buffer[i] = buffer[i+2]; ! // buffer[i+2] = temp; ! // } ! // ! // f = fopen (checkname, "rw"); ! // fwrite (buffer, 1, c, f); ! // fclose (f); ! // ! // free (buffer); ! // VID.Printf (PRINT_ALL, "Wrote %s\n", picname); ! } /* ** 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'); --- 104,173 ---- GL_ScreenShot_f ================== ! */ ! void GL_ScreenShot_f() { ! // byte *buffer; ! // char picname[80]; ! // char checkname[MAX_OSPATH]; ! // int i, c, temp; ! // FILE *f; ! // ! // // create the scrnshots directory if it doesn't exist ! // Com_sprintf (checkname, sizeof(checkname), "%s/scrnshot", ri.FS_Gamedir()); ! // Sys_Mkdir (checkname); ! // ! //// ! //// find a file name to save it to ! //// ! // strcpy(picname,"quake00.tga"); ! // ! // for (i=0 ; i<=99 ; i++) ! // { ! // picname[5] = i/10 + '0'; ! // picname[6] = i%10 + '0'; ! // Com_sprintf (checkname, sizeof(checkname), "%s/scrnshot/%s", ri.FS_Gamedir(), picname); ! // f = fopen (checkname, "r"); ! // if (!f) ! // break; // file doesn't exist ! // fclose (f); ! // } ! // if (i==100) ! // { ! // VID.Printf (PRINT_ALL, "SCR_ScreenShot_f: Couldn't create a file\n"); ! // return; ! // } ! // ! // ! // buffer = malloc(vid.width*vid.height*3 + 18); ! // memset (buffer, 0, 18); ! // buffer[2] = 2; // uncompressed type ! // buffer[12] = vid.width&255; ! // buffer[13] = vid.width>>8; ! // buffer[14] = vid.height&255; ! // buffer[15] = vid.height>>8; ! // buffer[16] = 24; // pixel size ! // ! // qglReadPixels (0, 0, vid.width, vid.height, GL_RGB, GL_UNSIGNED_BYTE, buffer+18 ); ! // ! // // swap rgb to bgr ! // c = 18+vid.width*vid.height*3; ! // for (i=18 ; i<c ; i+=3) ! // { ! // temp = buffer[i]; ! // buffer[i] = buffer[i+2]; ! // buffer[i+2] = temp; ! // } ! // ! // f = fopen (checkname, "rw"); ! // fwrite (buffer, 1, c, f); ! // fclose (f); ! // ! // free (buffer); ! // VID.Printf (PRINT_ALL, "Wrote %s\n", picname); ! } /* ** 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'); *************** *** 191,197 **** ** GL_SetDefaultState */ ! void GL_SetDefaultState() ! { ! gl.glClearColor(1f,0f, 0.5f , 0.5f); // original quake2 //gl.glClearColor(0, 0, 0, 0); // replaced with black gl.glCullFace(GL.GL_FRONT); --- 179,184 ---- ** GL_SetDefaultState */ ! void GL_SetDefaultState() { ! gl.glClearColor(1f, 0f, 0.5f, 0.5f); // original quake2 //gl.glClearColor(0, 0, 0, 0); // replaced with black gl.glCullFace(GL.GL_FRONT); *************** *** 201,216 **** gl.glAlphaFunc(GL.GL_GREATER, 0.666f); ! gl.glDisable (GL.GL_DEPTH_TEST); ! gl.glDisable (GL.GL_CULL_FACE); ! gl.glDisable (GL.GL_BLEND); ! gl.glColor4f (1,1,1,1); ! gl.glPolygonMode (GL.GL_FRONT_AND_BACK, GL.GL_FILL); ! gl.glShadeModel (GL.GL_FLAT); ! GL_TextureMode( gl_texturemode.string ); ! GL_TextureAlphaMode( gl_texturealphamode.string ); ! GL_TextureSolidMode( gl_texturesolidmode.string ); gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, gl_filter_min); --- 188,203 ---- gl.glAlphaFunc(GL.GL_GREATER, 0.666f); ! gl.glDisable(GL.GL_DEPTH_TEST); ! gl.glDisable(GL.GL_CULL_FACE); ! gl.glDisable(GL.GL_BLEND); ! gl.glColor4f(1, 1, 1, 1); ! gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL); ! gl.glShadeModel(GL.GL_FLAT); ! GL_TextureMode(gl_texturemode.string); ! GL_TextureAlphaMode(gl_texturealphamode.string); ! GL_TextureSolidMode(gl_texturesolidmode.string); gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, gl_filter_min); *************** *** 220,246 **** gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_REPEAT); ! gl.glBlendFunc (GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); ! GL_TexEnv( GL.GL_REPLACE ); ! if ( qglPointParameterfEXT ) ! { float[] attenuations = { gl_particle_att_a.value, gl_particle_att_b.value, gl_particle_att_c.value }; ! gl.glEnable( GL.GL_POINT_SMOOTH ); ! gl.glPointParameterfEXT( GL.GL_POINT_SIZE_MIN_EXT, gl_particle_min_size.value ); ! gl.glPointParameterfEXT( GL.GL_POINT_SIZE_MAX_EXT, gl_particle_max_size.value ); ! gl.glPointParameterfvEXT( GL.GL_DISTANCE_ATTENUATION_EXT, attenuations ); } ! if ( qglColorTableEXT && gl_ext_palettedtexture.value != 0.0f ) ! { ! gl.glEnable( GL.GL_SHARED_TEXTURE_PALETTE_EXT ); ! GL_SetTexturePalette( d_8to24table ); } GL_UpdateSwapInterval(); ! /* * vertex array extension --- 207,231 ---- gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_REPEAT); ! gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); ! GL_TexEnv(GL.GL_REPLACE); ! if (qglPointParameterfEXT) { float[] attenuations = { gl_particle_att_a.value, gl_particle_att_b.value, gl_particle_att_c.value }; ! gl.glEnable(GL.GL_POINT_SMOOTH); ! gl.glPointParameterfEXT(GL.GL_POINT_SIZE_MIN_EXT, gl_particle_min_size.value); ! gl.glPointParameterfEXT(GL.GL_POINT_SIZE_MAX_EXT, gl_particle_max_size.value); ! gl.glPointParameterfvEXT(GL.GL_DISTANCE_ATTENUATION_EXT, attenuations); } ! if (qglColorTableEXT && gl_ext_palettedtexture.value != 0.0f) { ! gl.glEnable(GL.GL_SHARED_TEXTURE_PALETTE_EXT); ! GL_SetTexturePalette(d_8to24table); } GL_UpdateSwapInterval(); ! /* * vertex array extension *************** *** 251,263 **** } ! void GL_UpdateSwapInterval() ! { ! if ( gl_swapinterval.modified ) ! { gl_swapinterval.modified = false; ! if ( !gl_state.stereo_enabled ) ! { if (qwglSwapIntervalEXT) { ! ((WGL)gl).wglSwapIntervalEXT((int)gl_swapinterval.value); } } --- 236,245 ---- } ! void GL_UpdateSwapInterval() { ! if (gl_swapinterval.modified) { gl_swapinterval.modified = false; ! if (!gl_state.stereo_enabled) { if (qwglSwapIntervalEXT) { ! ((WGL) gl).wglSwapIntervalEXT((int) gl_swapinterval.value); } } |