diff options
author | Carsten Weisse <[email protected]> | 2005-11-21 21:19:35 +0000 |
---|---|---|
committer | Carsten Weisse <[email protected]> | 2005-11-21 21:19:35 +0000 |
commit | 03843343c5f3e9e1b47103b01578345ad0278e9c (patch) | |
tree | 35d334108ae0de59aab8faf2b6c707690bfae30d | |
parent | b25052fa5e55cb91372c7543cc2b4b602d3bbf2f (diff) |
use a shared texture buffer (DirectBuffer) for cinematics
-rw-r--r-- | src/jake2/render/fastjogl/Draw.java | 19 | ||||
-rw-r--r-- | src/jake2/render/jogl/Draw.java | 23 | ||||
-rw-r--r-- | src/jake2/render/lwjgl/Draw.java | 10 |
3 files changed, 34 insertions, 18 deletions
diff --git a/src/jake2/render/fastjogl/Draw.java b/src/jake2/render/fastjogl/Draw.java index d3c62b6..ab4d3ef 100644 --- a/src/jake2/render/fastjogl/Draw.java +++ b/src/jake2/render/fastjogl/Draw.java @@ -2,7 +2,7 @@ * Draw.java * Copyright (C) 2003 * - * $Id: Draw.java,v 1.4 2004-08-22 14:25:14 salomo Exp $ + * $Id: Draw.java,v 1.5 2005-11-21 21:16:36 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -29,8 +29,13 @@ import jake2.Defines; import jake2.client.VID; import jake2.qcommon.Com; import jake2.render.image_t; +import jake2.util.Lib; import java.awt.Dimension; +import java.nio.ByteBuffer; +import java.nio.IntBuffer; + +import org.lwjgl.BufferUtils; import net.java.games.jogl.GL; @@ -301,7 +306,11 @@ public abstract class Draw extends Image { // ==================================================================== - + // allocate a 256 * 256 texture buffer + private ByteBuffer image8 = Lib.newByteBuffer(256 * 256 * Defines.SIZE_OF_INT); + // share the buffer + private IntBuffer image32 = image8.asIntBuffer(); + /* ============= Draw_StretchRaw @@ -332,7 +341,6 @@ public abstract class Draw extends Image { if ( !qglColorTableEXT ) { - int[] image32 = new int[256*256]; int destIndex = 0; for (i=0 ; i<trows ; i++) @@ -346,7 +354,7 @@ public abstract class Draw extends Image { frac = fracstep >> 1; for (j=0 ; j<256 ; j++) { - image32[destIndex + j] = r_rawpalette[data[sourceIndex + (frac>>16)] & 0xff]; + image32.put(destIndex + j, r_rawpalette[data[sourceIndex + (frac>>16)] & 0xff]); frac += fracstep; } } @@ -354,7 +362,6 @@ public abstract class Draw extends Image { } else { - byte[] image8 = new byte[256*256]; int destIndex = 0;; for (i=0 ; i<trows ; i++) @@ -368,7 +375,7 @@ public abstract class Draw extends Image { frac = fracstep >> 1; for (j=0 ; j<256 ; j++) { - image8[destIndex + j] = data[sourceIndex + (frac>>16)]; + image8.put(destIndex + j, data[sourceIndex + (frac>>16)]); frac += fracstep; } } diff --git a/src/jake2/render/jogl/Draw.java b/src/jake2/render/jogl/Draw.java index 5047ddb..6ae4197 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.5 2004-07-16 10:11:35 cawe Exp $ + * $Id: Draw.java,v 1.6 2005-11-21 21:19:35 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -29,8 +29,11 @@ import jake2.Defines; import jake2.client.VID; import jake2.qcommon.Com; import jake2.render.image_t; +import jake2.util.Lib; import java.awt.Dimension; +import java.nio.ByteBuffer; +import java.nio.IntBuffer; import net.java.games.jogl.GL; @@ -301,8 +304,12 @@ public abstract class Draw extends Image { // ==================================================================== - - /* + // allocate a 256 * 256 texture buffer + private ByteBuffer image8 = Lib.newByteBuffer(256 * 256 * Defines.SIZE_OF_INT); + // share the buffer + private IntBuffer image32 = image8.asIntBuffer(); + + /* ============= Draw_StretchRaw ============= @@ -332,8 +339,8 @@ public abstract class Draw extends Image { if ( !qglColorTableEXT ) { - int[] image32 = new int[256*256]; int destIndex = 0; + image32.clear(); for (i=0 ; i<trows ; i++) { @@ -346,7 +353,7 @@ public abstract class Draw extends Image { frac = fracstep >> 1; for (j=0 ; j<256 ; j++) { - image32[destIndex + j] = r_rawpalette[data[sourceIndex + (frac>>16)] & 0xff]; + image32.put(destIndex + j, r_rawpalette[data[sourceIndex + (frac>>16)] & 0xff]); frac += fracstep; } } @@ -354,8 +361,8 @@ public abstract class Draw extends Image { } else { - byte[] image8 = new byte[256*256]; - int destIndex = 0;; + int destIndex = 0; + image8.clear(); for (i=0 ; i<trows ; i++) { @@ -368,7 +375,7 @@ public abstract class Draw extends Image { frac = fracstep >> 1; for (j=0 ; j<256 ; j++) { - image8[destIndex + j] = data[sourceIndex + (frac>>16)]; + image8.put(destIndex + j, data[sourceIndex + (frac>>16)]); frac += fracstep; } } diff --git a/src/jake2/render/lwjgl/Draw.java b/src/jake2/render/lwjgl/Draw.java index 7329191..dc0fa4a 100644 --- a/src/jake2/render/lwjgl/Draw.java +++ b/src/jake2/render/lwjgl/Draw.java @@ -2,7 +2,7 @@ * Draw.java * Copyright (C) 2003 * - * $Id: Draw.java,v 1.2 2004-12-14 12:56:59 cawe Exp $ + * $Id: Draw.java,v 1.3 2005-11-21 21:16:58 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -29,6 +29,7 @@ import jake2.Defines; import jake2.client.VID; import jake2.qcommon.Com; import jake2.render.image_t; +import jake2.util.Lib; import java.awt.Dimension; import java.nio.ByteBuffer; @@ -304,9 +305,10 @@ public abstract class Draw extends Image { // ==================================================================== - IntBuffer image32=BufferUtils.createIntBuffer(256*256); - ByteBuffer image8=BufferUtils.createByteBuffer(256*256); - + // allocate a 256 * 256 texture buffer + private ByteBuffer image8 = Lib.newByteBuffer(256 * 256 * Defines.SIZE_OF_INT); + // share the buffer + private IntBuffer image32 = image8.asIntBuffer(); /* ============= |