diff options
author | Holger Zickner <[email protected]> | 2004-07-08 15:58:48 +0000 |
---|---|---|
committer | Holger Zickner <[email protected]> | 2004-07-08 15:58:48 +0000 |
commit | 4f13ea26c4f47e54e66926f0700cf631e7bb3352 (patch) | |
tree | a9d434fc462417bb981b1565fd64cea5e7c82c15 /src/jake2/render/jogl | |
parent | 76839da3568e20f51220584d1fc92841b216505a (diff) |
import of Jake2 version hannover
Diffstat (limited to 'src/jake2/render/jogl')
-rw-r--r-- | src/jake2/render/jogl/Draw.java | 3 | ||||
-rw-r--r-- | src/jake2/render/jogl/Impl.java | 15 | ||||
-rw-r--r-- | src/jake2/render/jogl/Main.java | 16 | ||||
-rw-r--r-- | src/jake2/render/jogl/Mesh.java | 4 | ||||
-rw-r--r-- | src/jake2/render/jogl/Warp.java | 20 |
5 files changed, 31 insertions, 27 deletions
diff --git a/src/jake2/render/jogl/Draw.java b/src/jake2/render/jogl/Draw.java index 528425f..eac0a1e 100644 --- a/src/jake2/render/jogl/Draw.java +++ b/src/jake2/render/jogl/Draw.java @@ -2,7 +2,7 @@ * Draw.java * Copyright (C) 2003 * - * $Id: Draw.java,v 1.1 2004-07-07 19:59:36 hzi Exp $ + * $Id: Draw.java,v 1.2 2004-07-08 15:58:45 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -26,7 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. package jake2.render.jogl; import jake2.Defines; -import jake2.Enum; import jake2.Globals; import jake2.render.image_t; diff --git a/src/jake2/render/jogl/Impl.java b/src/jake2/render/jogl/Impl.java index 8b40c40..48241db 100644 --- a/src/jake2/render/jogl/Impl.java +++ b/src/jake2/render/jogl/Impl.java @@ -2,7 +2,7 @@ * Impl.java * Copyright (C) 2003 * - * $Id: Impl.java,v 1.1 2004-07-07 19:59:38 hzi Exp $ + * $Id: Impl.java,v 1.2 2004-07-08 15:58:45 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -25,12 +25,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package jake2.render.jogl; -import jake2.*; +import jake2.Defines; +import jake2.Globals; import jake2.qcommon.xcommand_t; import jake2.sys.KBD; import java.awt.Dimension; -import java.awt.event.FocusAdapter; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; @@ -55,6 +55,7 @@ public class Impl extends Misc implements GLEventListener { // switch to updateScreen callback private boolean switchToCallback = false; private xcommand_t callback = null; + protected boolean contextInUse = false; GLCanvas canvas; JFrame window; @@ -94,7 +95,7 @@ public class Impl extends Misc implements GLEventListener { if (!ri.Vid_GetModeInfo(newDim, mode)) { ri.Con_Printf(Defines.PRINT_ALL, " invalid mode\n"); - return Enum.rserr_invalid_mode; + return rserr_invalid_mode; } ri.Con_Printf(Defines.PRINT_ALL, " " + newDim.width + " " + newDim.height + '\n'); @@ -149,7 +150,7 @@ public class Impl extends Misc implements GLEventListener { // let the sound and input subsystems know about the new window ri.Vid_NewWindow(vid.width, vid.height); - return Enum.rserr_ok; + return rserr_ok; } void GLimp_BeginFrame(float camera_separation) { @@ -217,6 +218,8 @@ public class Impl extends Misc implements GLEventListener { public void display(GLDrawable drawable) { this.gl = drawable.getGL(); this.glu = drawable.getGLU(); + + this.contextInUse = true; if (switchToCallback) { if (callback == null) @@ -242,6 +245,8 @@ public class Impl extends Misc implements GLEventListener { GLimp_EndFrame(); } + + contextInUse = false; } /* diff --git a/src/jake2/render/jogl/Main.java b/src/jake2/render/jogl/Main.java index 36d8fad..32442ba 100644 --- a/src/jake2/render/jogl/Main.java +++ b/src/jake2/render/jogl/Main.java @@ -2,7 +2,7 @@ * Main.java * Copyright (C) 2003 * - * $Id: Main.java,v 1.1 2004-07-07 19:59:40 hzi Exp $ + * $Id: Main.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -958,7 +958,7 @@ public abstract class Main extends Base { 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_fullbright = ri.Cvar_Get("r_fullbright", "1", 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); @@ -966,7 +966,7 @@ public abstract class Main extends Base { 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", "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); @@ -1069,25 +1069,25 @@ public abstract class Main extends Base { Dimension dim = new Dimension(vid.width, vid.height); - if ((err = GLimp_SetMode(dim, (int) gl_mode.value, fullscreen)) == Enum.rserr_ok) { + if ((err = GLimp_SetMode(dim, (int) gl_mode.value, fullscreen)) == rserr_ok) { gl_state.prev_mode = (int) gl_mode.value; } else { - if (err == Enum.rserr_invalid_fullscreen) { + if (err == rserr_invalid_fullscreen) { ri.Cvar_SetValue("vid_fullscreen", 0); vid_fullscreen.modified = false; ri.Con_Printf(Defines.PRINT_ALL, "ref_gl::R_SetMode() - fullscreen unavailable in this mode\n"); - if ((err = GLimp_SetMode(dim, (int) gl_mode.value, false)) == Enum.rserr_ok) + if ((err = GLimp_SetMode(dim, (int) gl_mode.value, false)) == rserr_ok) return true; } - else if (err == Enum.rserr_invalid_mode) { + else if (err == rserr_invalid_mode) { ri.Cvar_SetValue("gl_mode", gl_state.prev_mode); gl_mode.modified = false; ri.Con_Printf(Defines.PRINT_ALL, "ref_gl::R_SetMode() - invalid mode\n"); } // try setting it back to something safe - if ((err = GLimp_SetMode(dim, gl_state.prev_mode, false)) != Enum.rserr_ok) { + if ((err = GLimp_SetMode(dim, gl_state.prev_mode, false)) != rserr_ok) { ri.Con_Printf(Defines.PRINT_ALL, "ref_gl::R_SetMode() - could not revert to safe mode\n"); return false; } diff --git a/src/jake2/render/jogl/Mesh.java b/src/jake2/render/jogl/Mesh.java index da7017d..45d28bb 100644 --- a/src/jake2/render/jogl/Mesh.java +++ b/src/jake2/render/jogl/Mesh.java @@ -2,7 +2,7 @@ * Mesh.java * Copyright (C) 2003 * - * $Id: Mesh.java,v 1.1 2004-07-07 19:59:41 hzi Exp $ + * $Id: Mesh.java,v 1.2 2004-07-08 15:58:45 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -237,7 +237,7 @@ public abstract class Mesh extends Light { for ( i = 0; i < paliashdr.num_xyz; i++ ) { l = shadedots[verts[i].lightnormalindex]; - colorArrayBuf.put(l * shadelight[0]).put(l * shadelight[2]).put(l * shadelight[2]); + colorArrayBuf.put(l * shadelight[0]).put(l * shadelight[1]).put(l * shadelight[2]); } } diff --git a/src/jake2/render/jogl/Warp.java b/src/jake2/render/jogl/Warp.java index 770d50b..f02acbb 100644 --- a/src/jake2/render/jogl/Warp.java +++ b/src/jake2/render/jogl/Warp.java @@ -2,7 +2,7 @@ * Warp.java * Copyright (C) 2003 * - * $Id: Warp.java,v 1.1 2004-07-07 19:59:44 hzi Exp $ + * $Id: Warp.java,v 1.2 2004-07-08 15:58:45 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -446,7 +446,7 @@ public abstract class Warp extends Model { float[] dists = new float[MAX_CLIP_VERTS]; int[] sides = new int[MAX_CLIP_VERTS]; - float[][][] newv = new float[2][MAX_CLIP_VERTS][3]; + float[][][][] newv = new float[6][2][MAX_CLIP_VERTS][3]; void ClipSkyPolygon(int nump, float[][] vecs, int stage) { @@ -503,17 +503,17 @@ public abstract class Warp extends Model { switch (sides[i]) { case SIDE_FRONT: - Math3D.VectorCopy(v, newv[0][newc[0]]); + Math3D.VectorCopy(v, newv[stage][0][newc[0]]); newc[0]++; break; case SIDE_BACK: - Math3D.VectorCopy(v, newv[1][newc[1]]); + Math3D.VectorCopy(v, newv[stage][1][newc[1]]); newc[1]++; break; case SIDE_ON: - Math3D.VectorCopy(v, newv[0][newc[0]]); + Math3D.VectorCopy(v, newv[stage][0][newc[0]]); newc[0]++; - Math3D.VectorCopy (v, newv[1][newc[1]]); + Math3D.VectorCopy (v, newv[stage][1][newc[1]]); newc[1]++; break; } @@ -525,16 +525,16 @@ public abstract class Warp extends Model { for (j=0 ; j<3 ; j++) { e = v[j] + d * (vecs[i + 1][j] - v[j]); - newv[0][newc[0]][j] = e; - newv[1][newc[1]][j] = e; + newv[stage][0][newc[0]][j] = e; + newv[stage][1][newc[1]][j] = e; } newc[0]++; newc[1]++; } // continue - ClipSkyPolygon(newc[0], newv[0], stage+1); - ClipSkyPolygon(newc[1], newv[1], stage+1); + ClipSkyPolygon(newc[0], newv[stage][0], stage+1); + ClipSkyPolygon(newc[1], newv[stage][1], stage+1); } float[][] verts = new float[MAX_CLIP_VERTS][3]; |