From: Holger Z. <hz...@us...> - 2004-09-06 19:40:04
|
Update of /cvsroot/jake2/jake2/src/jake2/render/fastjogl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2637/src/jake2/render/fastjogl Modified Files: Tag: r_0_9 Misc.java Surf.java Light.java Mesh.java Draw.java Warp.java Image.java Anorms.java Base.java Model.java Main.java Removed Files: Tag: r_0_9 Impl.java Log Message: merge changes for 0.9.3 Index: Image.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastjogl/Image.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** Image.java 9 Jul 2004 08:38:27 -0000 1.1.2.1 --- Image.java 6 Sep 2004 19:39:17 -0000 1.1.2.2 *************** *** 27,32 **** --- 27,34 ---- import jake2.Defines; + import jake2.client.VID; import jake2.client.particle_t; import jake2.game.cvar_t; + import jake2.qcommon.*; import jake2.qcommon.longjmpException; import jake2.qcommon.qfiles; *************** *** 246,250 **** if (i == NUM_GL_MODES) { ! ri.Con_Printf(Defines.PRINT_ALL, "bad filter name: [" + string + "]\n"); return; } --- 248,252 ---- if (i == NUM_GL_MODES) { ! VID.Printf(Defines.PRINT_ALL, "bad filter name: [" + string + "]\n"); return; } *************** *** 280,284 **** if (i == NUM_GL_ALPHA_MODES) { ! ri.Con_Printf(Defines.PRINT_ALL, "bad alpha texture mode name: [" + string + "]\n"); return; } --- 282,286 ---- if (i == NUM_GL_ALPHA_MODES) { ! VID.Printf(Defines.PRINT_ALL, "bad alpha texture mode name: [" + string + "]\n"); return; } *************** *** 300,304 **** if (i == NUM_GL_SOLID_MODES) { ! ri.Con_Printf(Defines.PRINT_ALL, "bad solid texture mode name: [" + string + "]\n"); return; } --- 302,306 ---- if (i == NUM_GL_SOLID_MODES) { ! VID.Printf(Defines.PRINT_ALL, "bad solid texture mode name: [" + string + "]\n"); return; } *************** *** 318,322 **** final String[] palstrings = { "RGB", "PAL" }; ! ri.Con_Printf(Defines.PRINT_ALL, "------------------\n"); texels = 0; --- 320,324 ---- final String[] palstrings = { "RGB", "PAL" }; ! VID.Printf(Defines.PRINT_ALL, "------------------\n"); texels = 0; *************** *** 329,349 **** switch (image.type) { case it_skin : ! ri.Con_Printf(Defines.PRINT_ALL, "M"); break; case it_sprite : ! ri.Con_Printf(Defines.PRINT_ALL, "S"); break; case it_wall : ! ri.Con_Printf(Defines.PRINT_ALL, "W"); break; case it_pic : ! ri.Con_Printf(Defines.PRINT_ALL, "P"); break; default : ! ri.Con_Printf(Defines.PRINT_ALL, " "); break; } ! ri.Con_Printf( Defines.PRINT_ALL, " %3i %3i %s: %s\n", --- 331,351 ---- switch (image.type) { case it_skin : ! VID.Printf(Defines.PRINT_ALL, "M"); break; case it_sprite : ! VID.Printf(Defines.PRINT_ALL, "S"); break; case it_wall : ! VID.Printf(Defines.PRINT_ALL, "W"); break; case it_pic : ! VID.Printf(Defines.PRINT_ALL, "P"); break; default : ! VID.Printf(Defines.PRINT_ALL, " "); break; } ! VID.Printf( Defines.PRINT_ALL, " %3i %3i %s: %s\n", *************** *** 351,355 **** image.name)); } ! ri.Con_Printf(Defines.PRINT_ALL, "Total texel count (not counting mipmaps): " + texels + '\n'); } --- 353,357 ---- image.name)); } ! VID.Printf(Defines.PRINT_ALL, "Total texel count (not counting mipmaps): " + texels + '\n'); } *************** *** 447,454 **** // load the file // ! byte[] raw = ri.FS_LoadFile(filename); if (raw == null) { ! ri.Con_Printf(Defines.PRINT_DEVELOPER, "Bad pcx file " + filename + '\n'); return null; } --- 449,456 ---- // load the file // ! byte[] raw = FS.LoadFile(filename); if (raw == null) { ! VID.Printf(Defines.PRINT_DEVELOPER, "Bad pcx file " + filename + '\n'); return null; } *************** *** 466,470 **** || pcx.ymax >= 480) { ! ri.Con_Printf(Defines.PRINT_ALL, "Bad pcx file " + filename + '\n'); return null; } --- 468,472 ---- || pcx.ymax >= 480) { ! VID.Printf(Defines.PRINT_ALL, "Bad pcx file " + filename + '\n'); return null; } *************** *** 542,550 **** // load the file // ! raw = ri.FS_LoadFile (name); if (raw == null) { ! ri.Con_Printf(Defines.PRINT_DEVELOPER, "Bad tga file "+ name +'\n'); return null; } --- 544,552 ---- // load the file // ! raw = FS.LoadFile(name); if (raw == null) { ! VID.Printf(Defines.PRINT_DEVELOPER, "Bad tga file "+ name +'\n'); return null; } *************** *** 553,560 **** if (targa_header.image_type != 2 && targa_header.image_type != 10) ! ri.Sys_Error(Defines.ERR_DROP, "LoadTGA: Only type 2 and 10 targa RGB images supported\n"); if (targa_header.colormap_type != 0 || (targa_header.pixel_size != 32 && targa_header.pixel_size != 24)) ! ri.Sys_Error (Defines.ERR_DROP, "LoadTGA: Only 32 or 24 bit images supported (no colormaps)\n"); columns = targa_header.width; --- 555,562 ---- if (targa_header.image_type != 2 && targa_header.image_type != 10) ! Com.Error(Defines.ERR_DROP, "LoadTGA: Only type 2 and 10 targa RGB images supported\n"); if (targa_header.colormap_type != 0 || (targa_header.pixel_size != 32 && targa_header.pixel_size != 24)) ! Com.Error (Defines.ERR_DROP, "LoadTGA: Only 32 or 24 bit images supported (no colormaps)\n"); columns = targa_header.width; *************** *** 744,760 **** // else if (pos[off] != 255) fdc = pos[off]; // } ! // TODO check this: R_FloodFillSkin( byte[] skin, int skinwidth, int skinheight) void R_FloodFillSkin(byte[] skin, int skinwidth, int skinheight) { // byte fillcolor = *skin; // assume this is the pixel to fill int fillcolor = skin[0] & 0xff; ! floodfill_t[] fifo = new floodfill_t[FLOODFILL_FIFO_SIZE]; int inpt = 0, outpt = 0; int filledcolor = -1; int i; ! for (int j = 0; j < fifo.length; j++) { ! fifo[j] = new floodfill_t(); ! } if (filledcolor == -1) { --- 746,767 ---- // else if (pos[off] != 255) fdc = pos[off]; // } ! static floodfill_t[] fifo = new floodfill_t[FLOODFILL_FIFO_SIZE]; ! static { ! for (int j = 0; j < fifo.length; j++) { ! fifo[j] = new floodfill_t(); ! } ! } // TODO check this: R_FloodFillSkin( byte[] skin, int skinwidth, int skinheight) void R_FloodFillSkin(byte[] skin, int skinwidth, int skinheight) { // byte fillcolor = *skin; // assume this is the pixel to fill int fillcolor = skin[0] & 0xff; ! // floodfill_t[] fifo = new floodfill_t[FLOODFILL_FIFO_SIZE]; int inpt = 0, outpt = 0; int filledcolor = -1; int i; ! // for (int j = 0; j < fifo.length; j++) { ! // fifo[j] = new floodfill_t(); ! // } if (filledcolor == -1) { *************** *** 1084,1088 **** if (scaled_width * scaled_height > 256 * 256) ! ri.Sys_Error(Defines.ERR_DROP, "GL_Upload32: too big"); // scan the texture for any non-255 alpha --- 1091,1095 ---- if (scaled_width * scaled_height > 256 * 256) ! Com.Error(Defines.ERR_DROP, "GL_Upload32: too big"); // scan the texture for any non-255 alpha *************** *** 1102,1106 **** comp = gl_tex_alpha_format; else { ! ri.Con_Printf(Defines.PRINT_ALL, "Unknown number of texture components " + samples + '\n'); comp = samples; } --- 1109,1113 ---- comp = gl_tex_alpha_format; else { ! VID.Printf(Defines.PRINT_ALL, "Unknown number of texture components " + samples + '\n'); comp = samples; } *************** *** 1244,1248 **** if (s > trans.length) ! ri.Sys_Error(Defines.ERR_DROP, "GL_Upload8: too large"); if (qglColorTableEXT && gl_ext_palettedtexture.value != 0.0f && is_sky) { --- 1251,1255 ---- if (s > trans.length) ! Com.Error(Defines.ERR_DROP, "GL_Upload8: too large"); if (qglColorTableEXT && gl_ext_palettedtexture.value != 0.0f && is_sky) { *************** *** 1311,1315 **** { if (numgltextures == MAX_GLTEXTURES) ! ri.Sys_Error (Defines.ERR_DROP, "MAX_GLTEXTURES"); numgltextures++; --- 1318,1322 ---- { if (numgltextures == MAX_GLTEXTURES) ! Com.Error (Defines.ERR_DROP, "MAX_GLTEXTURES"); numgltextures++; *************** *** 1318,1322 **** if (name.length() > Defines.MAX_QPATH) ! ri.Sys_Error(Defines.ERR_DROP, "Draw_LoadPic: \"" + name + "\" is too long"); image.name = name; --- 1325,1329 ---- if (name.length() > Defines.MAX_QPATH) ! Com.Error(Defines.ERR_DROP, "Draw_LoadPic: \"" + name + "\" is too long"); image.name = name; *************** *** 1434,1440 **** image_t image = null; ! byte[] raw = ri.FS_LoadFile(name); if (raw == null) { ! ri.Con_Printf(Defines.PRINT_ALL, "GL_FindImage: can't load " + name + '\n'); return r_notexture; } --- 1441,1447 ---- image_t image = null; ! byte[] raw = FS.LoadFile(name); if (raw == null) { ! VID.Printf(Defines.PRINT_ALL, "GL_FindImage: can't load " + name + '\n'); return r_notexture; } *************** *** 1459,1473 **** image_t GL_FindImage(String name, int type) { image_t image = null; ! ! // TODO loest das grossschreibungs problem ! name = name.toLowerCase(); ! // bughack for bad strings (fuck \0) ! int index = name.indexOf('\0'); ! if (index != -1) ! name = name.substring(0, index); if (name == null || name.length() < 5) ! return null; // ri.Sys_Error (ERR_DROP, "GL_FindImage: NULL name"); ! // ri.Sys_Error (ERR_DROP, "GL_FindImage: bad name: %s", name); // look for it --- 1466,1480 ---- image_t GL_FindImage(String name, int type) { image_t image = null; ! ! // // TODO loest das grossschreibungs problem ! // name = name.toLowerCase(); ! // // bughack for bad strings (fuck \0) ! // int index = name.indexOf('\0'); ! // if (index != -1) ! // name = name.substring(0, index); if (name == null || name.length() < 5) ! return null; // Com.Error (ERR_DROP, "GL_FindImage: NULL name"); ! // Com.Error (ERR_DROP, "GL_FindImage: bad name: %s", name); // look for it *************** *** 1485,1488 **** --- 1492,1496 ---- // load the pic from disk // + image = null; byte[] pic = null; Dimension dim = new Dimension(); *************** *** 1511,1516 **** } - else - return null; return image; --- 1519,1522 ---- *************** *** 1577,1581 **** if (palette[0] == null || palette[0].length != 768) ! ri.Sys_Error(Defines.ERR_FATAL, "Couldn't load pics/colormap.pcx"); byte[] pal = palette[0]; --- 1583,1587 ---- if (palette[0] == null || palette[0].length != 768) ! Com.Error(Defines.ERR_FATAL, "Couldn't load pics/colormap.pcx"); byte[] pal = palette[0]; *************** *** 1607,1614 **** // init intensity conversions ! intensity = ri.Cvar_Get("intensity", "2", 0); if (intensity.value <= 1) ! ri.Cvar_Set("intensity", "1"); gl_state.inverse_intensity = 1 / intensity.value; --- 1613,1620 ---- // init intensity conversions ! intensity = Cvar.Get("intensity", "2", 0); if (intensity.value <= 1) ! Cvar.Set("intensity", "1"); gl_state.inverse_intensity = 1 / intensity.value; *************** *** 1617,1623 **** if (qglColorTableEXT) { ! gl_state.d_16to8table = ri.FS_LoadFile("pics/16to8.dat"); if (gl_state.d_16to8table == null) ! ri.Sys_Error(Defines.ERR_FATAL, "Couldn't load pics/16to8.pcx"); } --- 1623,1629 ---- if (qglColorTableEXT) { ! gl_state.d_16to8table = FS.LoadFile("pics/16to8.dat"); if (gl_state.d_16to8table == null) ! Com.Error(Defines.ERR_FATAL, "Couldn't load pics/16to8.pcx"); } Index: Surf.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastjogl/Surf.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** Surf.java 9 Jul 2004 08:38:27 -0000 1.1.2.1 --- Surf.java 6 Sep 2004 19:39:17 -0000 1.1.2.2 *************** *** 29,32 **** --- 29,33 ---- import jake2.client.*; import jake2.game.cplane_t; + import jake2.qcommon.Com; import jake2.render.*; import jake2.util.Lib; *************** *** 912,915 **** --- 913,919 ---- { entity_t ent = new entity_t(); + // auto cycle the world frame for texture animation + ent.frame = (int)(r_newrefdef.time*2); + currententity = ent; if (r_drawworld.value == 0) *************** *** 923,931 **** Math3D.VectorCopy(r_newrefdef.vieworg, modelorg); - // auto cycle the world frame for texture animation - // memset (&ent, 0, sizeof(ent)); - ent.frame = (int)(r_newrefdef.time*2); - currententity = ent; - gl_state.currenttextures[0] = gl_state.currenttextures[1] = -1; --- 927,930 ---- *************** *** 975,982 **** void R_MarkLeaves() { ! byte[] vis; //byte[] fatvis = new byte[Defines.MAX_MAP_LEAFS / 8]; ! Arrays.fill(fatvis, (byte)0); mnode_t node; --- 974,981 ---- void R_MarkLeaves() { ! //byte[] vis; //byte[] fatvis = new byte[Defines.MAX_MAP_LEAFS / 8]; ! //Arrays.fill(fatvis, (byte)0); mnode_t node; *************** *** 1007,1011 **** } ! vis = Mod_ClusterPVS(r_viewcluster, r_worldmodel); // may have to combine two clusters because of solid water boundaries if (r_viewcluster2 != r_viewcluster) --- 1006,1010 ---- } ! byte[] vis = Mod_ClusterPVS(r_viewcluster, r_worldmodel); // may have to combine two clusters because of solid water boundaries if (r_viewcluster2 != r_viewcluster) *************** *** 1108,1112 **** gl_lms.lightmap_buffer ); if ( ++gl_lms.current_lightmap_texture == MAX_LIGHTMAPS ) ! ri.Sys_Error( Defines.ERR_DROP, "LM_UploadBlock() - MAX_LIGHTMAPS exceeded\n" ); --- 1107,1111 ---- gl_lms.lightmap_buffer ); if ( ++gl_lms.current_lightmap_texture == MAX_LIGHTMAPS ) ! Com.Error( Defines.ERR_DROP, "LM_UploadBlock() - MAX_LIGHTMAPS exceeded\n" ); *************** *** 1261,1265 **** if ( !LM_AllocBlock( smax, tmax, lightPos ) ) { ! ri.Sys_Error( Defines.ERR_FATAL, "Consecutive calls to LM_AllocBlock(" + smax +"," + tmax +") failed\n"); } } --- 1260,1264 ---- if ( !LM_AllocBlock( smax, tmax, lightPos ) ) { ! Com.Error( Defines.ERR_FATAL, "Consecutive calls to LM_AllocBlock(" + smax +"," + tmax +") failed\n"); } } Index: Light.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastjogl/Light.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** Light.java 9 Jul 2004 08:38:27 -0000 1.1.2.1 --- Light.java 6 Sep 2004 19:39:17 -0000 1.1.2.2 *************** *** 29,35 **** import jake2.Globals; import jake2.client.dlight_t; - import jake2.client.lightstyle_t; import jake2.game.GameBase; import jake2.game.cplane_t; import jake2.qcommon.longjmpException; import jake2.render.*; --- 29,35 ---- import jake2.Globals; import jake2.client.dlight_t; import jake2.game.GameBase; import jake2.game.cplane_t; + import jake2.qcommon.Com; import jake2.qcommon.longjmpException; import jake2.render.*; *************** *** 224,235 **** cplane_t lightplane; // used as shadow plane float[] lightspot = {0, 0, 0}; // vec3_t ! int RecursiveLightPoint (mnode_t node, float[] start, float[] end) { ! float front, back, frac; ! boolean side; ! int sideIndex; ! cplane_t plane; ! float[] mid = {0, 0, 0}; msurface_t surf; int s, t, ds, dt; --- 224,233 ---- cplane_t lightplane; // used as shadow plane float[] lightspot = {0, 0, 0}; // vec3_t ! int RecursiveLightPoint (mnode_t node, float[] start, float[] end) { ! if (node.contents != -1) ! return -1; // didn't hit anything ! msurface_t surf; int s, t, ds, dt; *************** *** 238,259 **** ByteBuffer lightmap; int maps; ! int r; ! ! if (node.contents != -1) ! return -1; // didn't hit anything // calculate mid point // FIXME: optimize for axial ! plane = node.plane; ! front = Math3D.DotProduct (start, plane.normal) - plane.dist; ! back = Math3D.DotProduct (end, plane.normal) - plane.dist; ! side = (front < 0); ! sideIndex = (side) ? 1 : 0; if ( (back < 0) == side) return RecursiveLightPoint (node.children[sideIndex], start, end); ! frac = front / (front-back); mid[0] = start[0] + (end[0] - start[0])*frac; mid[1] = start[1] + (end[1] - start[1])*frac; --- 236,254 ---- ByteBuffer lightmap; int maps; ! float[] mid = {0, 0, 0}; // calculate mid point // FIXME: optimize for axial ! cplane_t plane = node.plane; ! float front = Math3D.DotProduct (start, plane.normal) - plane.dist; ! float back = Math3D.DotProduct (end, plane.normal) - plane.dist; ! boolean side = (front < 0); ! int sideIndex = (side) ? 1 : 0; if ( (back < 0) == side) return RecursiveLightPoint (node.children[sideIndex], start, end); ! float frac = front / (front-back); mid[0] = start[0] + (end[0] - start[0])*frac; mid[1] = start[1] + (end[1] - start[1])*frac; *************** *** 261,265 **** // go down front side ! r = RecursiveLightPoint (node.children[sideIndex], start, mid); if (r >= 0) return r; // hit something --- 256,260 ---- // go down front side ! int r = RecursiveLightPoint (node.children[sideIndex], start, mid); if (r >= 0) return r; // hit something *************** *** 273,276 **** --- 268,272 ---- int surfIndex = node.firstsurface; + float[] scale = {0, 0, 0}; for (i=0 ; i<node.numsurfaces ; i++, surfIndex++) { *************** *** 306,310 **** if (lightmap != null) { ! float[] scale = {0, 0, 0}; float[] rgb; lightmapIndex += 3 * (dt * ((surf.extents[0] >> 4) + 1) + ds); --- 302,306 ---- if (lightmap != null) { ! //float[] scale = {0, 0, 0}; float[] rgb; lightmapIndex += 3 * (dt * ((surf.extents[0] >> 4) + 1) + ds); *************** *** 341,349 **** float[] end = {0, 0, 0}; - float r; - int lnum; dlight_t dl; - float light; - float[] dist = {0, 0, 0}; float add; --- 337,341 ---- *************** *** 358,362 **** end[2] = p[2] - 2048; ! r = RecursiveLightPoint(r_worldmodel.nodes[0], p, end); if (r == -1) --- 350,354 ---- end[2] = p[2] - 2048; ! float r = RecursiveLightPoint(r_worldmodel.nodes[0], p, end); if (r == -1) *************** *** 372,382 **** // add dynamic lights // ! light = 0; ! for (lnum=0 ; lnum<r_newrefdef.num_dlights ; lnum++) { dl = r_newrefdef.dlights[lnum]; ! Math3D.VectorSubtract (currententity.origin, dl.origin, dist); ! add = dl.intensity - Math3D.VectorLength(dist); add *= (1.0f/256); if (add > 0) --- 364,373 ---- // add dynamic lights // ! for (int lnum=0 ; lnum<r_newrefdef.num_dlights ; lnum++) { dl = r_newrefdef.dlights[lnum]; ! Math3D.VectorSubtract (currententity.origin, dl.origin, end); ! add = dl.intensity - Math3D.VectorLength(end); add *= (1.0f/256); if (add > 0) *************** *** 389,393 **** } - // =================================================================== --- 380,383 ---- *************** *** 399,405 **** =============== */ void R_AddDynamicLights(msurface_t surf) { - int lnum; int sd, td; float fdist, frad, fminlight; --- 389,395 ---- =============== */ + // TODO sync with jogl renderer. hoz void R_AddDynamicLights(msurface_t surf) { int sd, td; float fdist, frad, fminlight; *************** *** 407,422 **** float[] local = {0, 0, 0}; int s, t; - int i; - int smax, tmax; - mtexinfo_t tex; dlight_t dl; float[] pfBL; float fsacc, ftacc; ! smax = (surf.extents[0]>>4)+1; ! tmax = (surf.extents[1]>>4)+1; ! tex = surf.texinfo; ! for (lnum=0 ; lnum<r_newrefdef.num_dlights ; lnum++) { if ( (surf.dlightbits & (1<<lnum)) == 0 ) --- 397,409 ---- float[] local = {0, 0, 0}; int s, t; dlight_t dl; float[] pfBL; float fsacc, ftacc; ! int smax = (surf.extents[0]>>4)+1; ! int tmax = (surf.extents[1]>>4)+1; ! mtexinfo_t tex = surf.texinfo; ! for (int lnum=0 ; lnum<r_newrefdef.num_dlights ; lnum++) { if ( (surf.dlightbits & (1<<lnum)) == 0 ) *************** *** 435,439 **** fminlight = frad - fminlight; ! for (i=0 ; i<3 ; i++) { impact[i] = dl.origin[i] - --- 422,426 ---- fminlight = frad - fminlight; ! for (int i=0 ; i<3 ; i++) { impact[i] = dl.origin[i] - *************** *** 452,456 **** td = -td; ! for ( s=0, fsacc = 0 ; s<smax ; s++, fsacc += 16, pfBLindex += 3) { sd = (int)( local[0] - fsacc ); --- 439,443 ---- td = -td; ! for (s=0, fsacc = 0 ; s<smax ; s++, fsacc += 16, pfBLindex += 3) { sd = (int)( local[0] - fsacc ); *************** *** 481,488 **** void R_SetCacheState( msurface_t surf ) { ! int maps; ! ! for (maps = 0 ; maps < Defines.MAXLIGHTMAPS && surf.styles[maps] != (byte)255 ; ! maps++) { surf.cached_light[maps] = r_newrefdef.lightstyles[surf.styles[maps] & 0xFF].white; --- 468,472 ---- void R_SetCacheState( msurface_t surf ) { ! for (int maps = 0 ; maps < Defines.MAXLIGHTMAPS && surf.styles[maps] != (byte)255 ; maps++) { surf.cached_light[maps] = r_newrefdef.lightstyles[surf.styles[maps] & 0xFF].white; *************** *** 497,520 **** =============== */ void R_BuildLightMap(msurface_t surf, IntBuffer dest, int stride) { - int smax, tmax; int r, g, b, a, max; ! int i, j, size; ByteBuffer lightmap; ! float[] scale = {0, 0, 0, 0}; int nummaps; float[] bl; ! lightstyle_t style; ! int monolightmap; if ( (surf.texinfo.flags & (Defines.SURF_SKY | Defines.SURF_TRANS33 | Defines.SURF_TRANS66 | Defines.SURF_WARP)) != 0 ) ! ri.Sys_Error(Defines.ERR_DROP, "R_BuildLightMap called for non-lit surface"); ! smax = (surf.extents[0] >> 4) + 1; ! tmax = (surf.extents[1] >> 4) + 1; ! size = smax * tmax; if (size > ((s_blocklights.length * Defines.SIZE_OF_FLOAT) >> 4) ) ! ri.Sys_Error(Defines.ERR_DROP, "Bad s_blocklights size"); try { --- 481,503 ---- =============== */ + // TODO sync with jogl renderer. hoz void R_BuildLightMap(msurface_t surf, IntBuffer dest, int stride) { int r, g, b, a, max; ! int i, j; ByteBuffer lightmap; ! float[] scale = {0, 0, 0}; int nummaps; float[] bl; ! //lightstyle_t style; if ( (surf.texinfo.flags & (Defines.SURF_SKY | Defines.SURF_TRANS33 | Defines.SURF_TRANS66 | Defines.SURF_WARP)) != 0 ) ! Com.Error(Defines.ERR_DROP, "R_BuildLightMap called for non-lit surface"); ! int smax = (surf.extents[0] >> 4) + 1; ! int tmax = (surf.extents[1] >> 4) + 1; ! int size = smax * tmax; if (size > ((s_blocklights.length * Defines.SIZE_OF_FLOAT) >> 4) ) ! Com.Error(Defines.ERR_DROP, "Bad s_blocklights size"); try { *************** *** 526,534 **** for (i=0 ; i<size*3 ; i++) s_blocklights[i] = 255; ! ! for (maps = 0 ; maps < Defines.MAXLIGHTMAPS && surf.styles[maps] != (byte)255; maps++) ! { ! style = r_newrefdef.lightstyles[surf.styles[maps] & 0xFF]; ! } // goto store; throw new longjmpException(); --- 509,519 ---- for (i=0 ; i<size*3 ; i++) s_blocklights[i] = 255; ! ! // TODO useless? hoz ! // for (maps = 0 ; maps < Defines.MAXLIGHTMAPS && surf.styles[maps] != (byte)255; maps++) ! // { ! // style = r_newrefdef.lightstyles[surf.styles[maps] & 0xFF]; ! // } ! // goto store; throw new longjmpException(); *************** *** 633,637 **** int blp = 0; ! monolightmap = gl_monolightmap.string.charAt(0); int destp = 0; --- 618,622 ---- int blp = 0; ! int monolightmap = gl_monolightmap.string.charAt(0); int destp = 0; *************** *** 688,692 **** a = (int)(a*t); } ! r &= 0xFF; g &= 0xFF; b &= 0xFF; a &= 0xFF; dest.put(destp++, (a << 24) | (b << 16) | (g << 8) | (r << 0)); } --- 673,677 ---- a = (int)(a*t); } ! //r &= 0xFF; g &= 0xFF; b &= 0xFF; a &= 0xFF; dest.put(destp++, (a << 24) | (b << 16) | (g << 8) | (r << 0)); } *************** *** 769,773 **** break; } ! r &= 0xFF; g &= 0xFF; b &= 0xFF; a &= 0xFF; dest.put(destp++, (a << 24) | (b << 16) | (g << 8) | (r << 0)); } --- 754,758 ---- break; } ! //r &= 0xFF; g &= 0xFF; b &= 0xFF; a &= 0xFF; dest.put(destp++, (a << 24) | (b << 16) | (g << 8) | (r << 0)); } --- Impl.java DELETED --- Index: Base.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastjogl/Base.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** Base.java 9 Jul 2004 08:38:27 -0000 1.1.2.1 --- Base.java 6 Sep 2004 19:39:17 -0000 1.1.2.2 *************** *** 26,29 **** --- 26,30 ---- package jake2.render.fastjogl; + import jake2.render.JoglBase; import net.java.games.jogl.GL; *************** *** 33,37 **** * @author cwei */ ! public class Base { static final int GL_COLOR_INDEX8_EXT = GL.GL_COLOR_INDEX; --- 34,38 ---- * @author cwei */ ! public abstract class Base extends JoglBase { static final int GL_COLOR_INDEX8_EXT = GL.GL_COLOR_INDEX; *************** *** 76,85 **** // =================================================================== - // enum rserr_t - static final int rserr_ok = 0; - static final int rserr_invalid_fullscreen = 1; - static final int rserr_invalid_mode = 2; - static final int rserr_unknown = 3; - // // #include "gl_model.h" --- 77,80 ---- Index: Draw.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastjogl/Draw.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** Draw.java 9 Jul 2004 08:38:27 -0000 1.1.2.1 --- Draw.java 6 Sep 2004 19:39:17 -0000 1.1.2.2 *************** *** 27,31 **** import jake2.Defines; ! import jake2.Globals; import jake2.render.image_t; --- 27,32 ---- import jake2.Defines; ! import jake2.client.VID; ! import jake2.qcommon.Com; import jake2.render.image_t; *************** *** 33,37 **** import net.java.games.jogl.GL; - import net.java.games.jogl.util.GLUT; /** --- 34,37 ---- *************** *** 139,143 **** if (image == null) { ! ri.Con_Printf (Defines.PRINT_ALL, "Can't find pic: " + pic +'\n'); return; } --- 139,143 ---- if (image == null) { ! VID.Printf (Defines.PRINT_ALL, "Can't find pic: " + pic +'\n'); return; } *************** *** 178,182 **** if (image == null) { ! ri.Con_Printf(Defines.PRINT_ALL, "Can't find pic: " +pic + '\n'); return; } --- 178,182 ---- if (image == null) { ! VID.Printf(Defines.PRINT_ALL, "Can't find pic: " +pic + '\n'); return; } *************** *** 218,222 **** if (image == null) { ! ri.Con_Printf(Defines.PRINT_ALL, "Can't find pic: " + pic + '\n'); return; } --- 218,222 ---- if (image == null) { ! VID.Printf(Defines.PRINT_ALL, "Can't find pic: " + pic + '\n'); return; } *************** *** 252,256 **** if ( colorIndex > 255) ! ri.Sys_Error(Defines.ERR_FATAL, "Draw_Fill: bad color"); gl.glDisable(GL.GL_TEXTURE_2D); --- 252,256 ---- if ( colorIndex > 255) ! Com.Error(Defines.ERR_FATAL, "Draw_Fill: bad color"); gl.glDisable(GL.GL_TEXTURE_2D); *************** *** 276,280 **** } ! // ============================================================================= /* --- 276,280 ---- } ! //============================================================================= /* Index: Model.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastjogl/Model.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** Model.java 9 Jul 2004 08:38:27 -0000 1.1.2.1 --- Model.java 6 Sep 2004 19:39:17 -0000 1.1.2.2 *************** *** 27,30 **** --- 27,31 ---- import jake2.Defines; + import jake2.client.VID; import jake2.game.cplane_t; import jake2.game.cvar_t; *************** *** 75,79 **** if (model == null || model.nodes == null) ! ri.Sys_Error (Defines.ERR_DROP, "Mod_PointInLeaf: bad model"); node = model.nodes[0]; // root node --- 76,80 ---- if (model == null || model.nodes == null) ! Com.Error (Defines.ERR_DROP, "Mod_PointInLeaf: bad model"); node = model.nodes[0]; // root node *************** *** 172,176 **** total = 0; ! ri.Con_Printf(Defines.PRINT_ALL,"Loaded models:\n"); for (i=0; i < mod_numknown ; i++) { --- 173,177 ---- total = 0; ! VID.Printf(Defines.PRINT_ALL,"Loaded models:\n"); for (i=0; i < mod_numknown ; i++) { *************** *** 179,186 **** continue; ! ri.Con_Printf (Defines.PRINT_ALL, "%8i : %s\n", new Vargs(2).add(mod.extradatasize).add(mod.name)); total += mod.extradatasize; } ! ri.Con_Printf (Defines.PRINT_ALL, "Total resident: " + total +'\n'); } --- 180,187 ---- continue; ! VID.Printf (Defines.PRINT_ALL, "%8i : %s\n", new Vargs(2).add(mod.extradatasize).add(mod.name)); total += mod.extradatasize; } ! VID.Printf (Defines.PRINT_ALL, "Total resident: " + total +'\n'); } *************** *** 214,218 **** if (name == null || name.length() == 0) ! ri.Sys_Error(Defines.ERR_DROP, "Mod_ForName: NULL name"); // --- 215,219 ---- if (name == null || name.length() == 0) ! Com.Error(Defines.ERR_DROP, "Mod_ForName: NULL name"); // *************** *** 223,227 **** i = Integer.parseInt(name.substring(1)); if (i < 1 || r_worldmodel == null || i >= r_worldmodel.numsubmodels) ! ri.Sys_Error (Defines.ERR_DROP, "bad inline model number"); return mod_inline[i]; } --- 224,228 ---- i = Integer.parseInt(name.substring(1)); if (i < 1 || r_worldmodel == null || i >= r_worldmodel.numsubmodels) ! Com.Error (Defines.ERR_DROP, "bad inline model number"); return mod_inline[i]; } *************** *** 253,257 **** { if (mod_numknown == MAX_MOD_KNOWN) ! ri.Sys_Error (Defines.ERR_DROP, "mod_numknown == MAX_MOD_KNOWN"); mod_numknown++; mod = mod_known[i]; --- 254,258 ---- { if (mod_numknown == MAX_MOD_KNOWN) ! Com.Error (Defines.ERR_DROP, "mod_numknown == MAX_MOD_KNOWN"); mod_numknown++; mod = mod_known[i]; *************** *** 263,272 **** // load the file // ! fileBuffer = ri.FS_LoadFile(name); if (fileBuffer == null) { if (crash) ! ri.Sys_Error(Defines.ERR_DROP, "Mod_NumForName: " + mod.name + " not found"); mod.name = ""; --- 264,273 ---- // load the file // ! fileBuffer = FS.LoadFile(name); if (fileBuffer == null) { if (crash) ! Com.Error(Defines.ERR_DROP, "Mod_NumForName: " + mod.name + " not found"); mod.name = ""; *************** *** 303,307 **** break; default: ! ri.Sys_Error(Defines.ERR_DROP,"Mod_NumForName: unknown fileid for " + mod.name); break; } --- 304,308 ---- break; default: ! Com.Error(Defines.ERR_DROP,"Mod_NumForName: unknown fileid for " + mod.name); break; } *************** *** 385,389 **** if ( (l.filelen % mvertex_t.DISK_SIZE) != 0) ! ri.Sys_Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / mvertex_t.DISK_SIZE; --- 386,390 ---- if ( (l.filelen % mvertex_t.DISK_SIZE) != 0) ! Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / mvertex_t.DISK_SIZE; *************** *** 432,436 **** if ((l.filelen % qfiles.dmodel_t.SIZE) != 0) ! ri.Sys_Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / qfiles.dmodel_t.SIZE; --- 433,437 ---- if ((l.filelen % qfiles.dmodel_t.SIZE) != 0) ! Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / qfiles.dmodel_t.SIZE; *************** *** 472,476 **** if ( (l.filelen % medge_t.DISK_SIZE) != 0) ! ri.Sys_Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / medge_t.DISK_SIZE; --- 473,477 ---- if ( (l.filelen % medge_t.DISK_SIZE) != 0) ! Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / medge_t.DISK_SIZE; *************** *** 505,513 **** if ((l.filelen % texinfo_t.SIZE) != 0) ! ri.Sys_Error (Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / texinfo_t.SIZE; // out = Hunk_Alloc ( count*sizeof(*out)); out = new mtexinfo_t[count]; loadmodel.texinfo = out; --- 506,517 ---- if ((l.filelen % texinfo_t.SIZE) != 0) ! Com.Error (Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / texinfo_t.SIZE; // out = Hunk_Alloc ( count*sizeof(*out)); out = new mtexinfo_t[count]; + for ( i=0 ; i<count ; i++) { + out[i] = new mtexinfo_t(); + } loadmodel.texinfo = out; *************** *** 517,527 **** bb.order(ByteOrder.LITTLE_ENDIAN); ! for ( i=0 ; i<count ; i++) ! { in = new texinfo_t(bb); ! out[i] = new mtexinfo_t(); ! //for (j=0 ; j<8 ; j++) ! out[i].vecs = in.vecs; ! out[i].flags = in.flags; next = in.nexttexinfo; --- 521,528 ---- bb.order(ByteOrder.LITTLE_ENDIAN); ! for ( i=0 ; i<count ; i++) { ! in = new texinfo_t(bb); ! out[i].vecs = in.vecs; out[i].flags = in.flags; next = in.nexttexinfo; *************** *** 534,540 **** out[i].image = GL_FindImage(name, it_wall); ! if (out[i].image == null) ! { ! ri.Con_Printf(Defines.PRINT_ALL, "Couldn't load " + name + '\n'); out[i].image = r_notexture; } --- 535,540 ---- out[i].image = GL_FindImage(name, it_wall); ! if (out[i].image == null) { ! VID.Printf(Defines.PRINT_ALL, "Couldn't load " + name + '\n'); out[i].image = r_notexture; } *************** *** 542,548 **** // count animation frames ! for (i=0 ; i<count ; i++) ! { ! // out = &loadmodel.texinfo[i]; out[i].numframes = 1; for (step = out[i].next ; (step != null) && (step != out[i]) ; step=step.next) --- 542,546 ---- // count animation frames ! for (i=0 ; i<count ; i++) { out[i].numframes = 1; for (step = out[i].next ; (step != null) && (step != out[i]) ; step=step.next) *************** *** 564,570 **** float val; ! int i, j, e; mvertex_t v; - mtexinfo_t tex; int[] bmins = {0, 0}; int[] bmaxs = {0, 0}; --- 562,567 ---- float val; ! int j, e; mvertex_t v; int[] bmins = {0, 0}; int[] bmaxs = {0, 0}; *************** *** 573,579 **** maxs[0] = maxs[1] = -99999; ! tex = s.texinfo; ! for (i=0 ; i<s.numedges ; i++) { e = loadmodel.surfedges[s.firstedge+i]; --- 570,576 ---- maxs[0] = maxs[1] = -99999; ! mtexinfo_t tex = s.texinfo; ! for (int i=0 ; i<s.numedges ; i++) { e = loadmodel.surfedges[s.firstedge+i]; *************** *** 596,600 **** } ! for (i=0 ; i<2 ; i++) { bmins[i] = (int)Math.floor(mins[i]/16); --- 593,597 ---- } ! for (int i=0 ; i<2 ; i++) { bmins[i] = (int)Math.floor(mins[i]/16); *************** *** 621,625 **** if ((l.filelen % qfiles.dface_t.SIZE) != 0) ! ri.Sys_Error (Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / qfiles.dface_t.SIZE; --- 618,622 ---- if ((l.filelen % qfiles.dface_t.SIZE) != 0) ! Com.Error (Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / qfiles.dface_t.SIZE; *************** *** 655,659 **** ti = in.texinfo; if (ti < 0 || ti >= loadmodel.numtexinfo) ! ri.Sys_Error(Defines.ERR_DROP, "MOD_LoadBmodel: bad texinfo number"); out[surfnum].texinfo = loadmodel.texinfo[ti]; --- 652,656 ---- ti = in.texinfo; if (ti < 0 || ti >= loadmodel.numtexinfo) ! Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: bad texinfo number"); out[surfnum].texinfo = loadmodel.texinfo[ti]; *************** *** 727,731 **** if ((l.filelen % qfiles.dnode_t.SIZE) != 0) ! ri.Sys_Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / qfiles.dnode_t.SIZE; --- 724,728 ---- if ((l.filelen % qfiles.dnode_t.SIZE) != 0) ! Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / qfiles.dnode_t.SIZE; *************** *** 784,788 **** if ((l.filelen % qfiles.dleaf_t.SIZE) != 0) ! ri.Sys_Error (Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / qfiles.dleaf_t.SIZE; --- 781,785 ---- if ((l.filelen % qfiles.dleaf_t.SIZE) != 0) ! Com.Error (Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / qfiles.dleaf_t.SIZE; *************** *** 829,833 **** if ((l.filelen % Defines.SIZE_OF_SHORT) != 0) ! ri.Sys_Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / Defines.SIZE_OF_SHORT; // out = Hunk_Alloc ( count*sizeof(*out)); --- 826,830 ---- if ((l.filelen % Defines.SIZE_OF_SHORT) != 0) ! Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / Defines.SIZE_OF_SHORT; // out = Hunk_Alloc ( count*sizeof(*out)); *************** *** 844,848 **** j = bb.getShort(); if (j < 0 || j >= loadmodel.numsurfaces) ! ri.Sys_Error(Defines.ERR_DROP, "Mod_ParseMarksurfaces: bad surface number"); out[i] = loadmodel.surfaces[j]; --- 841,845 ---- j = bb.getShort(); if (j < 0 || j >= loadmodel.numsurfaces) ! Com.Error(Defines.ERR_DROP, "Mod_ParseMarksurfaces: bad surface number"); out[i] = loadmodel.surfaces[j]; *************** *** 862,870 **** if ( (l.filelen % Defines.SIZE_OF_INT) != 0) ! ri.Sys_Error (Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / Defines.SIZE_OF_INT; if (count < 1 || count >= Defines.MAX_MAP_SURFEDGES) ! ri.Sys_Error (Defines.ERR_DROP, "MOD_LoadBmodel: bad surfedges count in " + loadmodel.name + ": " + count); offsets = new int[count]; --- 859,867 ---- if ( (l.filelen % Defines.SIZE_OF_INT) != 0) ! Com.Error (Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / Defines.SIZE_OF_INT; if (count < 1 || count >= Defines.MAX_MAP_SURFEDGES) ! Com.Error (Defines.ERR_DROP, "MOD_LoadBmodel: bad surfedges count in " + loadmodel.name + ": " + count); offsets = new int[count]; *************** *** 894,898 **** if ((l.filelen % qfiles.dplane_t.SIZE) != 0) ! ri.Sys_Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / qfiles.dplane_t.SIZE; --- 891,895 ---- if ((l.filelen % qfiles.dplane_t.SIZE) != 0) ! Com.Error(Defines.ERR_DROP, "MOD_LoadBmodel: funny lump size in " + loadmodel.name); count = l.filelen / qfiles.dplane_t.SIZE; *************** *** 937,941 **** loadmodel.type = mod_brush; if (loadmodel != mod_known[0]) ! ri.Sys_Error(Defines.ERR_DROP, "Loaded a brush model after the world"); header = new qfiles.dheader_t(buffer); --- 934,938 ---- loadmodel.type = mod_brush; if (loadmodel != mod_known[0]) ! Com.Error(Defines.ERR_DROP, "Loaded a brush model after the world"); header = new qfiles.dheader_t(buffer); *************** *** 943,947 **** i = header.version; if (i != Defines.BSPVERSION) ! ri.Sys_Error (Defines.ERR_DROP, "Mod_LoadBrushModel: " + mod.name + " has wrong version number (" + i + " should be " + Defines.BSPVERSION + ")"); mod_base = fileBuffer; //(byte *)header; --- 940,944 ---- i = header.version; if (i != Defines.BSPVERSION) ! Com.Error (Defines.ERR_DROP, "Mod_LoadBrushModel: " + mod.name + " has wrong version number (" + i + " should be " + Defines.BSPVERSION + ")"); mod_base = fileBuffer; //(byte *)header; *************** *** 977,981 **** starmod.firstnode = bm.headnode; if (starmod.firstnode >= loadmodel.numnodes) ! ri.Sys_Error(Defines.ERR_DROP, "Inline model " + i + " has bad firstnode"); Math3D.VectorCopy(bm.maxs, starmod.maxs); --- 974,978 ---- starmod.firstnode = bm.headnode; if (starmod.firstnode >= loadmodel.numnodes) ! Com.Error(Defines.ERR_DROP, "Inline model " + i + " has bad firstnode"); Math3D.VectorCopy(bm.maxs, starmod.maxs); *************** *** 1015,1038 **** if (pheader.version != qfiles.ALIAS_VERSION) ! ri.Sys_Error(Defines.ERR_DROP, "%s has wrong version number (%i should be %i)", new Vargs(3).add(mod.name).add(pheader.version).add(qfiles.ALIAS_VERSION)); if (pheader.skinheight > MAX_LBM_HEIGHT) ! ri.Sys_Error(Defines.ERR_DROP, "model "+ mod.name +" has a skin taller than " + MAX_LBM_HEIGHT); if (pheader.num_xyz <= 0) ! ri.Sys_Error(Defines.ERR_DROP, "model " + mod.name + " has no vertices"); if (pheader.num_xyz > qfiles.MAX_VERTS) ! ri.Sys_Error(Defines.ERR_DROP, "model " + mod.name +" has too many vertices"); if (pheader.num_st <= 0) ! ri.Sys_Error(Defines.ERR_DROP, "model " + mod.name + " has no st vertices"); if (pheader.num_tris <= 0) ! ri.Sys_Error(Defines.ERR_DROP, "model " + mod.name + " has no triangles"); if (pheader.num_frames <= 0) ! ri.Sys_Error(Defines.ERR_DROP, "model " + mod.name + " has no frames"); // --- 1012,1035 ---- if (pheader.version != qfiles.ALIAS_VERSION) ! Com.Error(Defines.ERR_DROP, "%s has wrong version number (%i should be %i)", new Vargs(3).add(mod.name).add(pheader.version).add(qfiles.ALIAS_VERSION)); if (pheader.skinheight > MAX_LBM_HEIGHT) ! Com.Error(Defines.ERR_DROP, "model "+ mod.name +" has a skin taller than " + MAX_LBM_HEIGHT); if (pheader.num_xyz <= 0) ! Com.Error(Defines.ERR_DROP, "model " + mod.name + " has no vertices"); if (pheader.num_xyz > qfiles.MAX_VERTS) ! Com.Error(Defines.ERR_DROP, "model " + mod.name +" has too many vertices"); if (pheader.num_st <= 0) ! Com.Error(Defines.ERR_DROP, "model " + mod.name + " has no st vertices"); if (pheader.num_tris <= 0) ! Com.Error(Defines.ERR_DROP, "model " + mod.name + " has no triangles"); if (pheader.num_frames <= 0) ! Com.Error(Defines.ERR_DROP, "model " + mod.name + " has no frames"); // *************** *** 1088,1092 **** { buffer.get(nameBuf); ! skinNames[i] = new String(nameBuf).trim(); mod.skins[i] = GL_FindImage(skinNames[i], it_skin); } --- 1085,1093 ---- { buffer.get(nameBuf); ! skinNames[i] = new String(nameBuf); ! int n = skinNames[i].indexOf('\0'); ! if (n > -1) { ! skinNames[i] = skinNames[i].substring(0, n); ! } mod.skins[i] = GL_FindImage(skinNames[i], it_skin); } *************** *** 1129,1137 **** if (sprout.version != qfiles.SPRITE_VERSION) ! ri.Sys_Error(Defines.ERR_DROP, "%s has wrong version number (%i should be %i)", new Vargs(3).add(mod.name).add(sprout.version).add(qfiles.SPRITE_VERSION)); if (sprout.numframes > qfiles.MAX_MD2SKINS) ! ri.Sys_Error(Defines.ERR_DROP, "%s has too many frames (%i > %i)", new Vargs(3).add(mod.name).add(sprout.numframes).add(qfiles.MAX_MD2SKINS)); --- 1130,1138 ---- if (sprout.version != qfiles.SPRITE_VERSION) ! Com.Error(Defines.ERR_DROP, "%s has wrong version number (%i should be %i)", new Vargs(3).add(mod.name).add(sprout.version).add(qfiles.SPRITE_VERSION)); if (sprout.numframes > qfiles.MAX_MD2SKINS) ! Com.Error(Defines.ERR_DROP, "%s has too many frames (%i > %i)", new Vargs(3).add(mod.name).add(sprout.numframes).add(qfiles.MAX_MD2SKINS)); *************** *** 1168,1172 **** // explicitly free the old map if different // this guarantees that mod_known[0] is the world map ! flushmap = ri.Cvar_Get("flushmap", "0", 0); if ( !mod_known[0].name.equals(fullname) || flushmap.value != 0.0f) Mod_Free(mod_known[0]); --- 1169,1173 ---- // explicitly free the old map if different // this guarantees that mod_known[0] is the world map ! flushmap = Cvar.Get("flushmap", "0", 0); if ( !mod_known[0].name.equals(fullname) || flushmap.value != 0.0f) Mod_Free(mod_known[0]); Index: Main.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/render/fastjogl/Main.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** Main.java 9 Jul 2004 08:38:27 -0000 1.1.2.1 --- Main.java 6 Sep 2004 19:39:17 -0000 1.1.2.2 *************** *** 26,33 **** package jake2.render.fastjogl; ! import jake2.*; import jake2.client.*; import jake2.game.cplane_t; import jake2.game.cvar_t; import jake2.qcommon.qfiles; import jake2.qcommon.xcommand_t; --- 26,36 ---- package jake2.render.fastjogl; ! import jake2.Defines; ! import jake2.Globals; import jake2.client.*; + import jake2.game.*; import jake2.game.cplane_t; import jake2.game.cvar_t; + import jake2.qcommon.*; import jake2.qcommon.qfiles; import jake2.qcommon.xcommand_t; *************** *** 41,47 **** import net.java.games.jogl.GL; - import net.java.games.jogl.GLU; - import net.java.games.jogl.util.BufferUtils; - import net.java.games.jogl.util.GLUT; /** --- 44,47 ---- *************** *** 52,58 **** public abstract class Main extends Base { - GL gl; - GLU glu; - GLUT glut = new GLUT(); public static int[] d_8to24table = new int[256]; --- 52,55 ---- *************** *** 84,96 **** abstract mleaf_t Mod_PointInLeaf(float[] point, model_t model); - abstract boolean QGL_Init(String dll_name); - abstract void QGL_Shutdown(); - abstract boolean GLimp_Init(int xpos, int ypos); - abstract void GLimp_BeginFrame(float camera_separation); - abstract int GLimp_SetMode(Dimension dim, int mode, boolean fullscreen); - abstract void GLimp_Shutdown(); - abstract void GLimp_EnableLogging(boolean enable); - abstract void GLimp_LogNewFrame(); - abstract void GL_SetDefaultState(); --- 81,84 ---- *************** *** 126,136 **** */ - // IMPORTED FUNCTIONS - protected refimport_t ri = null; - int GL_TEXTURE0 = GL.GL_TEXTURE0; int GL_TEXTURE1 = GL.GL_TEXTURE1; - viddef_t vid = new viddef_t(); model_t r_worldmodel; --- 114,120 ---- *************** *** 236,240 **** cvar_t gl_3dlabs_broken; - cvar_t vid_fullscreen; cvar_t vid_gamma; cvar_t vid_ref; --- 220,223 ---- *************** *** 440,444 **** break; default : ! ri.Sys_Error(Defines.ERR_DROP, "Bad modeltype"); break; } --- 423,427 ---- break; default : ! Com.Error(Defines.ERR_DROP, "Bad modeltype"); break; } *************** *** 474,478 **** break; default : ! ri.Sys_Error(Defines.ERR_DROP, "Bad modeltype"); break; } --- 457,461 ---- break; default : ! Com.Error(Defines.ERR_DROP, "Bad modeltype"); break; } *************** *** 520,528 **** color = sourceColors.get(i); gl.glColor4ub( ! (byte)((color >> 0) & 0xFF), (byte)((color >> 8) & 0xFF), (byte)((color >> 16) & 0xFF), ! (byte)((color >> 24) & 0xFF) ); // first vertex --- 503,512 ---- color = sourceColors.get(i); + gl.glColor4ub( ! (byte)((color) & 0xFF), (byte)((color >> 8) & 0xFF), (byte)((color >> 16) & 0xFF), ! (byte)((color >>> 24)) ); // first vertex *************** *** 736,752 **** */ void R_SetupGL() { - float screenaspect; - int x, x2, y2, y, w, h; // // set up viewport // ! x = (int) Math.floor(r_newrefdef.x * vid.width / vid.width); ! x2 = (int) Math.ceil((r_newrefdef.x + r_newrefdef.width) * vid.width / vid.width); ! y = (int) Math.floor(vid.height - r_newrefdef.y * vid.height / vid.height); ! y2 = (int) Math.ceil(vid.height - (r_newrefdef.y + r_newrefdef.height) * vid.height / vid.height); ! w = x2 - x; ! h = y - y2; gl.glViewport(x, y2, w, h); --- 720,738 ---- */ void R_SetupGL() { // // set up viewport // ! //int x = (int) Math.floor(r_newrefdef.x * vid.width / vid.width); ! int x = r_newrefdef.x; ! //int x2 = (int) Math.ceil((r_newrefdef.x + r_newrefdef.width) * vid.width / vid.width); ! int x2 = r_newrefdef.x + r_newrefdef.width; ! //int y = (int) Math.floor(vid.height - r_newrefdef.y * vid.height / vid.height); ! int y = vid.height - r_newrefdef.y; ! //int y2 = (int) Math.ceil(vid.height - (r_newrefdef.y + r_newrefdef.height) * vid.height / vid.height); ! int y2 = vid.height - (r_newrefdef.y + r_newrefdef.height); ! int w = x2 - x; ! int h = y - y2; gl.glViewport(x, y2, w, h); *************** *** 755,759 **** // set up projection matrix // ! screenaspect = (float) r_newrefdef.width / r_newrefdef.height; gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); --- 741,745 ---- // set up projection matrix // ! float screenaspect = (float) r_newrefdef.width / r_newrefdef.height; gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); *************** *** 846,854 **** // included by cwei if (r_newrefdef == null) { ! ri.Sys_Error(Defines.ERR_DROP, "R_RenderView: refdef_t fd is null"); } if (r_worldmodel == null && (r_newrefdef.rdflags & Defines.RDF_NOWORLDMODEL) == 0) ! ri.Sys_Error(Defines.ERR_DROP, "R_RenderView: NULL worldmodel"); if (r_speeds.value != 0.0f) { --- 832,840 ---- // included by cwei if (r_newrefdef == null) { ! Com.Error(Defines.ERR_DROP, "R_RenderView: refdef_t fd is null"); } if (r_worldmodel == null && (r_newrefdef.rdflags & Defines.RDF_NOWORLDMODEL) == 0) ! Com.Error(Defines.ERR_DROP, "R_RenderView: NULL worldmodel"); if (r_speeds.value != 0.0f) { *************** *** 883,887 **** if (r_speeds.value != 0.0f) { ! ri.Con_Printf( Defines.PRINT_ALL, "%4i wpoly %4i epoly %i tex %i lmaps\n", --- 869,873 ---- if (r_speeds.value != 0.0f) { ! VID.Printf( Defines.PRINT_ALL, "%4i wpoly %4i epoly %i tex %i lmaps\n", *************** *** 950,1021 **** protected void R_Register() { ! r_lefthand = ri.Cvar_Get("hand", "0", Globals.CVAR_USERINFO | Globals.CVAR_ARCHIVE); ! r_norefresh = ri.Cvar_Get("r_norefresh", "0", 0); ! r_fullbright = ri.Cvar_Get("r_fullbright", "0", 0); ! r_drawentities = ri.Cvar_Get("r_drawentities", "1", 0); ! r_drawworld = ri.Cvar_Get("r_drawworld", "1", 0); ! r_novis = ri.Cvar_Get("r_novis", "0", 0); ! r_nocull = ri.Cvar_Get("r_nocull", "0", 0); ! r_lerpmodels = ri.Cvar_Get("r_lerpmodels", "1", 0); ! r_speeds = ri.Cvar_Get("r_speeds", "0", 0); ! r_lightlevel = ri.Cvar_Get("r_lightlevel", "1", 0); ! gl_nosubimage = ri.Cvar_Get("gl_nosubimage", "0", 0); ! gl_allow_software = ri.Cvar_Get("gl_allow_software", "0", 0); ! gl_particle_min_size = ri.Cvar_Get("gl_particle_min_size", "2", Globals.CVAR_ARCHIVE); ! gl_particle_max_size = ri.Cvar_Get("gl_particle_max_size", "40", Globals.CVAR_ARCHIVE); ! gl_particle_size = ri.Cvar_Get("gl_particle_size", "40", Globals.CVAR_ARCHIVE); ! gl_particle_att_a = ri.Cvar_Get("gl_particle_att_a", "0.01", Globals.CVAR_ARCHIVE); ! gl_particle_att_b = ri.Cvar_Get("gl_particle_att_b", "0.0", Globals.CVAR_ARCHIVE); ! gl_particle_att_c = ri.Cvar_Get("gl_particle_att_c", "0.01", Globals.CVAR_ARCHIVE); ! gl_modulate = ri.Cvar_Get("gl_modulate", "1", Globals.CVAR_ARCHIVE); ! gl_log = ri.Cvar_Get("gl_log", "0", 0); ! gl_bitdepth = ri.Cvar_Get("gl_bitdepth", "0", 0); ! gl_mode = ri.Cvar_Get("gl_mode", "3", Globals.CVAR_ARCHIVE); // 640x480 ! gl_lightmap = ri.Cvar_Get("gl_lightmap", "0", 0); ! gl_shadows = ri.Cvar_Get("gl_shadows", "0", Globals.CVAR_ARCHIVE); ! gl_dynamic = ri.Cvar_Get("gl_dynamic", "1", 0); ! gl_nobind = ri.Cvar_Get("gl_nobind", "0", 0); ! gl_round_down = ri.Cvar_Get("gl_round_down", "1", 0); ! gl_picmip = ri.Cvar_Get("gl_picmip", "0", 0); ! gl_skymip = ri.Cvar_Get("gl_skymip", "0", 0); ! gl_showtris = ri.Cvar_Get("gl_showtris", "0", 0); ! gl_ztrick = ri.Cvar_Get("gl_ztrick", "0", 0); ! gl_finish = ri.Cvar_Get("gl_finish", "0", Globals.CVAR_ARCHIVE); ! gl_clear = ri.Cvar_Get("gl_clear", "0", 0); ! gl_cull = ri.Cvar_Get("gl_cull", "1", 0); ! gl_polyblend = ri.Cvar_Get("gl_polyblend", "1", 0); ! gl_flashblend = ri.Cvar_Get("gl_flashblend", "0", 0); ! gl_playermip = ri.Cvar_Get("gl_playermip", "0", 0); ! gl_monolightmap = ri.Cvar_Get("gl_monolightmap", "0", 0); ! gl_driver = ri.Cvar_Get("gl_driver", "opengl32", Globals.CVAR_ARCHIVE); ! gl_texturemode = ri.Cvar_Get("gl_texturemode", "GL_LINEAR_MIPMAP_NEAREST", Globals.CVAR_ARCHIVE); ! gl_texturealphamode = ri.Cvar_Get("gl_texturealphamode", "default", Globals.CVAR_ARCHIVE); ! gl_texturesolidmode = ri.Cvar_Get("gl_texturesolidmode", "default", Globals.CVAR_ARCHIVE); ! gl_lockpvs = ri.Cvar_Get("gl_lockpvs", "0", 0); ! gl_vertex_arrays = ri.Cvar_Get("gl_vertex_arrays", "1", Globals.CVAR_ARCHIVE); ! gl_ext_swapinterval = ri.Cvar_Get("gl_ext_swapinterval", "1", Globals.CVAR_ARCHIVE); ! gl_ext_palettedtexture = ri.Cvar_Get("gl_ext_palettedtexture", "0", Globals.CVAR_ARCHIVE); ! gl_ext_multitexture = ri.Cvar_Get("gl_ext_multitexture", "1", Globals.CVAR_ARCHIVE); ! gl_ext_pointparameters = ri.Cvar_Get("gl_ext_pointparameters", "1", Globals.CVAR_ARCHIVE); ! gl_ext_compiled_vertex_array = ri.Cvar_Get("gl_ext_compiled_vertex_array", "1", Globals.CVAR_ARCHIVE); ! gl_drawbuffer = ri.Cvar_Get("gl_drawbuffer", "GL_BACK", 0); ! gl_swapinterval = ri.Cvar_Get("gl_swapinterval", "0", Globals.CVAR_ARCHIVE); ! gl_saturatelighting = ri.Cvar_Get("gl_saturatelighting", "0", 0); ! gl_3dlabs_broken = ri.Cvar_Get("gl_3dlabs_broken", "1", Globals.CVAR_ARCHIVE); ! vid_fullscreen = ri.Cvar_Get("vid_fullscreen", "0", Globals.CVAR_ARCHIVE); ! vid_gamma = ri.Cvar_Get("vid_gamma", "1.0", Globals.CVAR_ARCHIVE); ! vid_ref = ri.Cvar_Get("vid_ref", "fastjogl", Globals.CVAR_ARCHIVE); ! ri.Cmd_AddCommand("imagelist", new xcommand_t() { public void execute() { GL_ImageList_f(); --- 936,1007 ---- protected void R_Register() { ! r_lefthand = Cvar.Get("hand", "0", Globals.CVAR_USERINFO | Globals.CVAR_ARCHIVE); ! r_norefresh = Cvar.Get("r_norefresh", "0", 0); ! r_fullbright = Cvar.Get("r_fullbright", "0", 0); ! r_drawentities = Cvar.Get("r_drawentities", "1", 0); ! r_drawworld = Cvar.Get("r_drawworld", "1", 0); ! r_novis = Cvar.Get("r_novis", "0", 0); ! r_nocull = Cvar.Get("r_nocull", "0", 0); ! r_lerpmodels = Cvar.Get("r_lerpmodels", "1", 0); ! r_speeds = Cvar.Get("r_speeds", "0", 0); ! r_lightlevel = Cvar.Get("r_lightlevel", "1", 0); ! gl_nosubimage = Cvar.Get("gl_nosubimage", "0", 0); ! gl_allow_software = Cvar.Get("gl_allow_software", "0", 0); ! gl_particle_min_size = Cvar.Get("gl_particle_min_size", "2", Globals.CVAR_ARCHIVE); ! gl_particle_max_size = Cvar.Get("gl_particle_max_size", "40", Globals.CVAR_ARCHIVE); ! gl_particle_size = Cvar.Get("gl_particle_size", "40", Globals.CVAR_ARCHIVE); ! gl_particle_att_a = Cvar.Get("gl_particle_att_a", "0.01", Globals.CVAR_ARCHIVE); ! gl_particle_att_b = Cvar.Get("gl_particle_att_b", "0.0", Globals.CVAR_ARCHIVE); ! gl_particle_att_c = Cvar.Get("gl_particle_att_c", "0.01", Globals.CVAR_ARCHIVE); ! gl_modulate = Cvar.Get("gl_modulate", "1", Globals.CVAR_ARCHIVE); ! gl_log = Cvar.Get("gl_log", "0", 0); ! gl_bitdepth = Cvar.Get("gl_bitdepth", "0", 0); ! gl_mode = Cvar.Get("gl_mode", "3", Globals.CVAR_ARCHIVE); // 640x480 ! gl_lightmap = Cvar.Get("gl_lightmap", "0", 0); ! gl_shadows = Cvar.Get("gl_shadows", "0", Globals.CVAR_ARCHIVE); ! gl_dynamic = Cvar.Get("gl_dynamic", "1", 0); ! gl_nobind = Cvar.Get("gl_nobind", "0", 0); ! gl_round_down = Cvar.Get("gl_round_down", "1", 0); ! gl_picmip = Cvar.Get("gl_picmip", "0", 0); ! gl_skymip = Cvar.Get("gl_skymip", "0", 0); ! gl_showtris = Cvar.Get("gl_showtris", "0", 0); ! gl_ztrick = Cvar.Get("gl_ztrick", "0", 0); ! gl_finish = Cvar.Get("gl_finish", "0", Globals.CVAR_ARCHIVE); ! gl_clear = Cvar.Get("gl_clear", "0", 0); ! gl_cull = Cvar.Get("gl_cull", "1", 0); ! gl_polyblend = Cvar.Get("gl_polyblend", "1", 0); ! gl_flashblend = Cvar.Get("gl_flashblend", "0", 0); ! gl_playermip = Cvar.Get("gl_playermip", "0", 0); ! gl_monolightmap = Cvar.Get("gl_monolightmap", "0", 0); ! gl_driver = Cvar.Get("gl_driver", "opengl32", Globals.CVAR_ARCHIVE); ! gl_texturemode = Cvar.Get("gl_texturemode", "GL_LINEAR_MIPMAP_NEAREST", Globals.CVAR_ARCHIVE); ! gl_texturealphamode = Cvar.Get("gl_texturealphamode", "default", Globals.CVAR_ARCHIVE); ! gl_texturesolidmode = Cvar.Get("gl_texturesolidmode", "default", Globals.CVAR_ARCHIVE); ! gl_lockpvs = Cvar.Get("gl_lockpvs", "0", 0); ! gl_vertex_arrays = Cvar.Get("gl_vertex_arrays", "1", Globals.CVAR_ARCHIVE); ! gl_ext_swapinterval = Cvar.Get("gl_ext_swapinterval", "1", Globals.CVAR_ARCHIVE); ! gl_ext_palettedtexture = Cvar.Get("gl_ext_palettedtexture", "0", Globals.CVAR_ARCHIVE); ! gl_ext_multitexture = Cvar.Get("gl_ext_multitexture", "1", Globals.CVAR_ARCHIVE); ! gl_ext_pointparameters = Cvar.Get("gl_ext_pointparameters", "1", Globals.CVAR_ARCHIVE); ! gl_ext_compiled_vertex_array = Cvar.Get("gl_ext_compiled_vertex_array", "1", Globals.CVAR_ARCHIVE); ! gl_drawbuffer = Cvar.Get("gl_drawbuffer", "GL_BACK", 0); ! gl_swapinterval = Cvar.Get("gl_swapinterval", "0", Globals.CVAR_ARCHIVE); ! gl_saturatelighting = Cvar.Get("gl_saturatelighting", "0", 0); ! gl_3dlabs_broken = Cvar.Get("gl_3dlabs_broken", "1", Globals.CVAR_ARCHIVE); ! vid_fullscreen = Cvar.Get("vid_fullscreen", "0", Globals.CVAR_ARCHIVE); ! vid_gamma = Cvar.Get("vid_gamma", "1.0", Globals.CVAR_ARCHIVE); ! vid_ref = Cvar.Get("vid_ref", "fastjogl", Globals.CVAR_ARCHIVE); ! Cmd.AddCommand("imagelist", new xcommand_t() { public void execute() { GL_ImageList_f(); *************** *** 1023,1037 **** }); ! ri.Cmd_AddCommand("screenshot", new xcommand_t() { public void execute() { GL_ScreenShot_f(); } }); ! ri.Cmd_AddCommand("modellist", new xcommand_t() { public void execute() { Mod_Modellist_f(); } }); ! ri.Cmd_AddCommand("gl_strings", new xcommand_t() { public void execute() { GL_Strings_f(); --- 1009,1023 ---- }); ! Cmd.AddCommand("screenshot", new xcommand_t() { public void execute() { GL_ScreenShot_f(); } }); ! Cmd.AddCommand("modellist", new xcommand_t() { public void execute() { Mod_Modellist_f(); } }); ! Cmd.AddCommand("gl_strings", new xcommand_t() { public void execute() { GL_Strings_f(); *************** *** 1051,1056 **** // if (vid_fullscreen.modified && !gl_config.allow_cds) { ! // ri.Con_Printf(Defines.PRINT_ALL, "R_SetMode() - CDS not allowed with this driver\n"); ! // ri.Cvar_SetValue("vid_fullscree... [truncated message content] |