diff options
author | Carsten Weisse <[email protected]> | 2008-03-02 14:56:23 +0000 |
---|---|---|
committer | Carsten Weisse <[email protected]> | 2008-03-02 14:56:23 +0000 |
commit | 78d0a1f33aaca5d734122371c43fd51ff43ad3fd (patch) | |
tree | eb01e518130289d77dbdb3331042c5da399cc15a /src/jake2/render/basic | |
parent | adaf8e215e6dfff3435d59867661b4cd8946569f (diff) |
use getters and setters of modified viddef_t
Diffstat (limited to 'src/jake2/render/basic')
-rw-r--r-- | src/jake2/render/basic/Draw.java | 8 | ||||
-rw-r--r-- | src/jake2/render/basic/Main.java | 24 | ||||
-rw-r--r-- | src/jake2/render/basic/Misc.java | 18 |
3 files changed, 26 insertions, 24 deletions
diff --git a/src/jake2/render/basic/Draw.java b/src/jake2/render/basic/Draw.java index a4347cb..52ee9fc 100644 --- a/src/jake2/render/basic/Draw.java +++ b/src/jake2/render/basic/Draw.java @@ -2,7 +2,7 @@ * Draw.java * Copyright (C) 2003 * - * $Id: Draw.java,v 1.2 2006-11-21 00:50:46 cawe Exp $ + * $Id: Draw.java,v 1.3 2008-03-02 14:56:23 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -290,9 +290,9 @@ public abstract class Draw extends Image { gl.glBegin(GL_QUADS); gl.glVertex2f(0,0); - gl.glVertex2f(vid.width, 0); - gl.glVertex2f(vid.width, vid.height); - gl.glVertex2f(0, vid.height); + gl.glVertex2f(vid.getWidth(), 0); + gl.glVertex2f(vid.getWidth(), vid.getHeight()); + gl.glVertex2f(0, vid.getHeight()); gl.glEnd(); gl.glColor4f(1,1,1,1); diff --git a/src/jake2/render/basic/Main.java b/src/jake2/render/basic/Main.java index 34545d7..8f46270 100644 --- a/src/jake2/render/basic/Main.java +++ b/src/jake2/render/basic/Main.java @@ -679,7 +679,7 @@ public abstract class Main extends Base { gl.glClearColor(0.3f, 0.3f, 0.3f, 1.0f); gl.glScissor( r_newrefdef.x, - vid.height - r_newrefdef.height - r_newrefdef.y, + vid.getHeight() - r_newrefdef.height - r_newrefdef.y, r_newrefdef.width, r_newrefdef.height); gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -715,10 +715,10 @@ public abstract class Main extends Base { // // 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); + x = (int) Math.floor(r_newrefdef.x * vid.getWidth() / vid.getWidth()); + x2 = (int) Math.ceil((r_newrefdef.x + r_newrefdef.width) * vid.getWidth() / vid.getWidth()); + y = (int) Math.floor(vid.getHeight() - r_newrefdef.y * vid.getHeight() / vid.getHeight()); + y2 = (int) Math.ceil(vid.getHeight() - (r_newrefdef.y + r_newrefdef.height) * vid.getHeight() / vid.getHeight()); w = x2 - x; h = y - y2; @@ -866,10 +866,10 @@ public abstract class Main extends Base { void R_SetGL2D() { // set 2D virtual screen size - gl.glViewport(0, 0, vid.width, vid.height); + gl.glViewport(0, 0, vid.getWidth(), vid.getHeight()); gl.glMatrixMode(GL_PROJECTION); gl.glLoadIdentity(); - gl.glOrtho(0, vid.width, vid.height, 0, -99999, 99999); + gl.glOrtho(0, vid.getWidth(), vid.getHeight(), 0, -99999, 99999); gl.glMatrixMode(GL_MODELVIEW); gl.glLoadIdentity(); gl.glDisable(GL_DEPTH_TEST); @@ -1035,7 +1035,7 @@ public abstract class Main extends Base { vid_fullscreen.modified = false; gl_mode.modified = false; - Dimension dim = new Dimension(vid.width, vid.height); + Dimension dim = new Dimension(vid.getWidth(), vid.getHeight()); if ((err = glImpl.setMode(dim, (int) gl_mode.value, fullscreen)) == rserr_ok) { gl_state.prev_mode = (int) gl_mode.value; @@ -1358,7 +1358,9 @@ public abstract class Main extends Base { @@@@@@@@@@@@@@@@@@@@@ */ public void R_BeginFrame(float camera_separation) { - + + vid.update(); + gl_state.camera_separation = camera_separation; /* @@ -1410,10 +1412,10 @@ public abstract class Main extends Base { /* ** go into 2D mode */ - gl.glViewport(0, 0, vid.width, vid.height); + gl.glViewport(0, 0, vid.getWidth(), vid.getHeight()); gl.glMatrixMode(GL_PROJECTION); gl.glLoadIdentity(); - gl.glOrtho(0, vid.width, vid.height, 0, -99999, 99999); + gl.glOrtho(0, vid.getWidth(), vid.getHeight(), 0, -99999, 99999); gl.glMatrixMode(GL_MODELVIEW); gl.glLoadIdentity(); gl.glDisable(GL_DEPTH_TEST); diff --git a/src/jake2/render/basic/Misc.java b/src/jake2/render/basic/Misc.java index bc56f0e..a8c4b3e 100644 --- a/src/jake2/render/basic/Misc.java +++ b/src/jake2/render/basic/Misc.java @@ -2,7 +2,7 @@ * Misc.java * Copyright (C) 2003 * - * $Id: Misc.java,v 1.4 2007-01-11 23:36:15 cawe Exp $ + * $Id: Misc.java,v 1.5 2008-03-02 14:56:23 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -143,7 +143,7 @@ public final class Misc extends Mesh { try { RandomAccessFile out = new RandomAccessFile(file, "rw"); FileChannel ch = out.getChannel(); - int fileLength = TGA_HEADER_SIZE + vid.width * vid.height * 3; + int fileLength = TGA_HEADER_SIZE + vid.getWidth() * vid.getHeight() * 3; out.setLength(fileLength); MappedByteBuffer image = ch.map(FileChannel.MapMode.READ_WRITE, 0, fileLength); @@ -151,10 +151,10 @@ public final class Misc extends Mesh { // write the TGA header image.put(0, (byte) 0).put(1, (byte) 0); image.put(2, (byte) 2); // uncompressed type - image.put(12, (byte) (vid.width & 0xFF)); // vid.width - image.put(13, (byte) (vid.width >> 8)); // vid.width - image.put(14, (byte) (vid.height & 0xFF)); // vid.height - image.put(15, (byte) (vid.height >> 8)); // vid.height + image.put(12, (byte) (vid.getWidth() & 0xFF)); // vid.getWidth() + image.put(13, (byte) (vid.getWidth() >> 8)); // vid.getWidth() + image.put(14, (byte) (vid.getHeight() & 0xFF)); // vid.getHeight() + image.put(15, (byte) (vid.getHeight() >> 8)); // vid.getHeight() image.put(16, (byte) 24); // pixel size // go to image data position @@ -163,7 +163,7 @@ public final class Misc extends Mesh { ByteBuffer rgb = image.slice(); // change pixel alignment for reading - if (vid.width % 4 != 0) { + if (vid.getWidth() % 4 != 0) { gl.glPixelStorei(GL_PACK_ALIGNMENT, 1); } @@ -172,10 +172,10 @@ public final class Misc extends Mesh { // e.g.: 1.5.2 NVIDIA 66.29 if (gl_config.getOpenGLVersion() >= 1.2f) { // read the BGR values into the image buffer - gl.glReadPixels(0, 0, vid.width, vid.height, GL_BGR, GL_UNSIGNED_BYTE, rgb); + gl.glReadPixels(0, 0, vid.getWidth(), vid.getHeight(), GL_BGR, GL_UNSIGNED_BYTE, rgb); } else { // read the RGB values into the image buffer - gl.glReadPixels(0, 0, vid.width, vid.height, GL_RGB, GL_UNSIGNED_BYTE, rgb); + gl.glReadPixels(0, 0, vid.getWidth(), vid.getHeight(), GL_RGB, GL_UNSIGNED_BYTE, rgb); // flip RGB to BGR byte tmp; for (i = TGA_HEADER_SIZE; i < fileLength; i += 3) { |