diff options
Diffstat (limited to 'src/jake2')
-rw-r--r-- | src/jake2/render/fastjogl/Mesh.java | 31 | ||||
-rw-r--r-- | src/jake2/render/fastjogl/Surf.java | 18 | ||||
-rw-r--r-- | src/jake2/render/lwjgl/Mesh.java | 31 | ||||
-rw-r--r-- | src/jake2/render/lwjgl/Surf.java | 14 |
4 files changed, 50 insertions, 44 deletions
diff --git a/src/jake2/render/fastjogl/Mesh.java b/src/jake2/render/fastjogl/Mesh.java index e15e698..a6326e9 100644 --- a/src/jake2/render/fastjogl/Mesh.java +++ b/src/jake2/render/fastjogl/Mesh.java @@ -2,7 +2,7 @@ * Mesh.java * Copyright (C) 2003 * - * $Id: Mesh.java,v 1.10 2005-05-07 23:44:38 cawe Exp $ + * $Id: Mesh.java,v 1.11 2005-06-08 21:27:09 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -81,26 +81,28 @@ public abstract class Mesh extends Light { | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0) { float[] normal; - int j = -1; + int j = 0; for (int i=0 ; i < nverts; i++/* , v++, ov++, lerp+=4 */) { vv = v[i]; normal = r_avertexnormals[(vv >>> 24 ) & 0xFF]; ovv = ov[i]; - lerp.put(++j, move[0] + (ovv & 0xFF)* backv[0] + (vv & 0xFF) * frontv[0] + normal[0] * Defines.POWERSUIT_SCALE); - lerp.put(++j, move[1] + ((ovv >>> 8) & 0xFF) * backv[1] + ((vv >>> 8) & 0xFF) * frontv[1] + normal[1] * Defines.POWERSUIT_SCALE); - lerp.put(++j, move[2] + ((ovv >>> 16) & 0xFF) * backv[2] + ((vv >>> 16) & 0xFF) * frontv[2] + normal[2] * Defines.POWERSUIT_SCALE); + lerp.put(j, move[0] + (ovv & 0xFF)* backv[0] + (vv & 0xFF) * frontv[0] + normal[0] * Defines.POWERSUIT_SCALE); + lerp.put(j + 1, move[1] + ((ovv >>> 8) & 0xFF) * backv[1] + ((vv >>> 8) & 0xFF) * frontv[1] + normal[1] * Defines.POWERSUIT_SCALE); + lerp.put(j + 2, move[2] + ((ovv >>> 16) & 0xFF) * backv[2] + ((vv >>> 16) & 0xFF) * frontv[2] + normal[2] * Defines.POWERSUIT_SCALE); + j += 3; } } else { - int j = -1; - for (int i=0 ; i < nverts; i++ /* , v++, ov++, lerp+=4 */) + int j = 0; + for (int i=0 ; i < nverts; i++/* , v++, ov++, lerp+=4 */) { ovv = ov[i]; vv = v[i]; - lerp.put(++j, move[0] + (ovv & 0xFF)* backv[0] + (vv & 0xFF)*frontv[0]); - lerp.put(++j, move[1] + ((ovv >>> 8) & 0xFF)* backv[1] + ((vv >>> 8) & 0xFF)*frontv[1]); - lerp.put(++j, move[2] + ((ovv >>> 16) & 0xFF)* backv[2] + ((vv >>> 16) & 0xFF)*frontv[2]); + lerp.put(j, move[0] + (ovv & 0xFF)* backv[0] + (vv & 0xFF)*frontv[0]); + lerp.put(j + 1, move[1] + ((ovv >>> 8) & 0xFF)* backv[1] + ((vv >>> 8) & 0xFF)*frontv[1]); + lerp.put(j + 2, move[2] + ((ovv >>> 16) & 0xFF)* backv[2] + ((vv >>> 16) & 0xFF)*frontv[2]); + j +=3; } } } @@ -201,10 +203,11 @@ public abstract class Mesh extends Light { float l; for (int i = 0; i < paliashdr.num_xyz; i++) { l = shadedots[(verts[i] >>> 24 ) & 0xFF]; - color.put(j++, l * shadelight[0]); - color.put(j++, l * shadelight[1]); - color.put(j++, l * shadelight[2]); - color.put(j++, alpha); + color.put(j, l * shadelight[0]); + color.put(j + 1, l * shadelight[1]); + color.put(j + 2, l * shadelight[2]); + color.put(j + 4, alpha); + j += 4; } } diff --git a/src/jake2/render/fastjogl/Surf.java b/src/jake2/render/fastjogl/Surf.java index 08516f9..5c90ed4 100644 --- a/src/jake2/render/fastjogl/Surf.java +++ b/src/jake2/render/fastjogl/Surf.java @@ -2,7 +2,7 @@ * Surf.java * Copyright (C) 2003 * - * $Id: Surf.java,v 1.9 2005-01-17 23:50:50 cawe Exp $ + * $Id: Surf.java,v 1.10 2005-06-08 21:27:09 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -924,15 +924,15 @@ public abstract class Surf extends Draw { // memcpy (fatvis, vis, (r_worldmodel.numleafs+7)/8); System .arraycopy(vis, 0, fatvis, 0, - (r_worldmodel.numleafs + 7) / 8); + (r_worldmodel.numleafs + 7) >> 3); vis = Mod_ClusterPVS(r_viewcluster2, r_worldmodel); - c = (r_worldmodel.numleafs + 31) / 32; - int k = 0; - for (i = 0; i < c; i++) { - fatvis[k] |= vis[k++]; - fatvis[k] |= vis[k++]; - fatvis[k] |= vis[k++]; - fatvis[k] |= vis[k++]; + c = (r_worldmodel.numleafs + 31) >> 5; + c <<= 2; + for (int k = 0; k < c; k+=4) { + fatvis[k] |= vis[k]; + fatvis[k + 1] |= vis[k + 1]; + fatvis[k + 2] |= vis[k + 2]; + fatvis[k + 3] |= vis[k + 3]; } vis = fatvis; diff --git a/src/jake2/render/lwjgl/Mesh.java b/src/jake2/render/lwjgl/Mesh.java index db5faba..ab5e409 100644 --- a/src/jake2/render/lwjgl/Mesh.java +++ b/src/jake2/render/lwjgl/Mesh.java @@ -2,7 +2,7 @@ * Mesh.java * Copyright (C) 2003 * - * $Id: Mesh.java,v 1.7 2005-05-07 23:44:37 cawe Exp $ + * $Id: Mesh.java,v 1.8 2005-06-08 21:27:10 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -86,28 +86,30 @@ public abstract class Mesh extends Light { if ( (currententity.flags & ( Defines.RF_SHELL_RED | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0 ) { float[] normal; - int j = -1; + int j = 0; for (int i=0 ; i < nverts; i++/* , v++, ov++, lerp+=4 */) { vv = v[i]; normal = r_avertexnormals[(vv >>> 24 ) & 0xFF]; ovv = ov[i]; - lerp.put(++j, move[0] + (ovv & 0xFF)* backv[0] + (vv & 0xFF) * frontv[0] + normal[0] * Defines.POWERSUIT_SCALE); - lerp.put(++j, move[1] + ((ovv >>> 8) & 0xFF) * backv[1] + ((vv >>> 8) & 0xFF) * frontv[1] + normal[1] * Defines.POWERSUIT_SCALE); - lerp.put(++j, move[2] + ((ovv >>> 16) & 0xFF) * backv[2] + ((vv >>> 16) & 0xFF) * frontv[2] + normal[2] * Defines.POWERSUIT_SCALE); + lerp.put(j, move[0] + (ovv & 0xFF)* backv[0] + (vv & 0xFF) * frontv[0] + normal[0] * Defines.POWERSUIT_SCALE); + lerp.put(j + 1, move[1] + ((ovv >>> 8) & 0xFF) * backv[1] + ((vv >>> 8) & 0xFF) * frontv[1] + normal[1] * Defines.POWERSUIT_SCALE); + lerp.put(j + 2, move[2] + ((ovv >>> 16) & 0xFF) * backv[2] + ((vv >>> 16) & 0xFF) * frontv[2] + normal[2] * Defines.POWERSUIT_SCALE); + j += 3; } } else { - int j = -1; + int j = 0; for (int i=0 ; i < nverts; i++ /* , v++, ov++, lerp+=4 */) { ovv = ov[i]; vv = v[i]; - lerp.put(++j, move[0] + (ovv & 0xFF)* backv[0] + (vv & 0xFF)*frontv[0]); - lerp.put(++j, move[1] + ((ovv >>> 8) & 0xFF)* backv[1] + ((vv >>> 8) & 0xFF)*frontv[1]); - lerp.put(++j, move[2] + ((ovv >>> 16) & 0xFF)* backv[2] + ((vv >>> 16) & 0xFF)*frontv[2]); + lerp.put(j, move[0] + (ovv & 0xFF)* backv[0] + (vv & 0xFF)*frontv[0]); + lerp.put(j + 1, move[1] + ((ovv >>> 8) & 0xFF)* backv[1] + ((vv >>> 8) & 0xFF)*frontv[1]); + lerp.put(j + 2, move[2] + ((ovv >>> 16) & 0xFF)* backv[2] + ((vv >>> 16) & 0xFF)*frontv[2]); + j += 3; } } } @@ -191,16 +193,17 @@ public abstract class Mesh extends Light { // pre light everything // FloatBuffer color = colorArrayBuf; - int j = -1; float l; int size = paliashdr.num_xyz; + int j = 0; for (int i = 0; i < size; i++ ) { l = shadedots[(verts[i] >>> 24) & 0xFF]; - color.put(++j, l * shadelight[0]); - color.put(++j, l * shadelight[1]); - color.put(++j, l * shadelight[2]); - color.put(++j, alpha); + color.put(j, l * shadelight[0]); + color.put(j + 1, l * shadelight[1]); + color.put(j + 2, l * shadelight[2]); + color.put(j + 3, alpha); + j += 4; } } diff --git a/src/jake2/render/lwjgl/Surf.java b/src/jake2/render/lwjgl/Surf.java index 40e9bcf..3ab5ae7 100644 --- a/src/jake2/render/lwjgl/Surf.java +++ b/src/jake2/render/lwjgl/Surf.java @@ -2,7 +2,7 @@ * Surf.java * Copyright (C) 2003 * - * $Id: Surf.java,v 1.8 2005-02-01 16:55:28 cawe Exp $ + * $Id: Surf.java,v 1.9 2005-06-08 21:27:10 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -940,12 +940,12 @@ public abstract class Surf extends Draw { System.arraycopy(vis, 0, fatvis, 0, (r_worldmodel.numleafs+7) >> 3); vis = Mod_ClusterPVS(r_viewcluster2, r_worldmodel); c = (r_worldmodel.numleafs + 31) >> 5; - int k = -1; - for (i=0 ; i<c ; i++) { - fatvis[++k] |= vis[k]; - fatvis[++k] |= vis[k]; - fatvis[++k] |= vis[k]; - fatvis[++k] |= vis[k]; + c <<= 2; + for (int k=0 ; k<c ; k+=4) { + fatvis[k] |= vis[k]; + fatvis[k + 1] |= vis[k + 1]; + fatvis[k + 2] |= vis[k + 2]; + fatvis[k + 3] |= vis[k + 3]; } vis = fatvis; |