[iortcw] 252/497: All: Fix stencil shadows not drawing if has 500 or more vertexes

Simon McVittie smcv at debian.org
Fri Sep 8 10:37:02 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to annotated tag 1.42d
in repository iortcw.

commit 79f989aae30fd1ae81e484397aa1af6cffbf553a
Author: M4N4T4RMS at gmail.com <M4N4T4RMS at gmail.com@e65d2741-a53d-b2dc-ae96-bb75fa5e4c4a>
Date:   Mon Nov 17 20:56:10 2014 +0000

    All: Fix stencil shadows not drawing if has 500 or more vertexes
---
 MP/code/rend2/tr_shadows.c    | 20 ++++++++------------
 MP/code/renderer/tr_shadows.c | 20 ++++++++------------
 SP/code/rend2/tr_shadows.c    | 20 ++++++++------------
 SP/code/renderer/tr_shadows.c | 20 ++++++++------------
 4 files changed, 32 insertions(+), 48 deletions(-)

diff --git a/MP/code/rend2/tr_shadows.c b/MP/code/rend2/tr_shadows.c
index 3e38a12..6036ece 100644
--- a/MP/code/rend2/tr_shadows.c
+++ b/MP/code/rend2/tr_shadows.c
@@ -51,6 +51,7 @@ typedef struct {
 static edgeDef_t edgeDefs[SHADER_MAX_VERTEXES][MAX_EDGE_DEFS];
 static int numEdgeDefs[SHADER_MAX_VERTEXES];
 static int facing[SHADER_MAX_INDEXES / 3];
+static vec3_t shadowXyz[SHADER_MAX_VERTEXES];
 
 void R_AddEdgeDef( int i1, int i2, int facing ) {
 	int c;
@@ -87,13 +88,13 @@ void R_RenderShadowEdges( void ) {
 
 		qglBegin( GL_TRIANGLE_STRIP );
 		qglVertex3fv( tess.xyz[ i1 ] );
-		qglVertex3fv( tess.xyz[ i1 + tess.numVertexes ] );
+		qglVertex3fv( shadowXyz[ i1 ] );
 		qglVertex3fv( tess.xyz[ i2 ] );
-		qglVertex3fv( tess.xyz[ i2 + tess.numVertexes ] );
+		qglVertex3fv( shadowXyz[ i2 ] );
 		qglVertex3fv( tess.xyz[ i3 ] );
-		qglVertex3fv( tess.xyz[ i3 + tess.numVertexes ] );
+		qglVertex3fv( shadowXyz[ i3 ] );
 		qglVertex3fv( tess.xyz[ i1 ] );
-		qglVertex3fv( tess.xyz[ i1 + tess.numVertexes ] );
+		qglVertex3fv( shadowXyz[ i1 ] );
 		qglEnd();
 	}
 #else
@@ -133,9 +134,9 @@ void R_RenderShadowEdges( void ) {
 			if ( hit[ 1 ] == 0 ) {
 				qglBegin( GL_TRIANGLE_STRIP );
 				qglVertex3fv( tess.xyz[ i ] );
-				qglVertex3fv( tess.xyz[ i + tess.numVertexes ] );
+				qglVertex3fv( shadowXyz[ i ] );
 				qglVertex3fv( tess.xyz[ i2 ] );
-				qglVertex3fv( tess.xyz[ i2 + tess.numVertexes ] );
+				qglVertex3fv( shadowXyz[ i2 ] );
 				qglEnd();
 				c_edges++;
 			} else {
@@ -164,11 +165,6 @@ void RB_ShadowTessEnd( void ) {
 	vec3_t lightDir;
 	GLboolean rgba[4];
 
-	// we can only do this if we have enough space in the vertex buffers
-	if ( tess.numVertexes >= SHADER_MAX_VERTEXES / 2 ) {
-		return;
-	}
-
 	if ( glConfig.stencilBits < 4 ) {
 		return;
 	}
@@ -177,7 +173,7 @@ void RB_ShadowTessEnd( void ) {
 
 	// project vertexes away from light direction
 	for ( i = 0 ; i < tess.numVertexes ; i++ ) {
-		VectorMA( tess.xyz[i], -512, lightDir, tess.xyz[i + tess.numVertexes] );
+		VectorMA( tess.xyz[i], -512, lightDir, shadowXyz[i] );
 	}
 
 	// decide which triangles face the light
diff --git a/MP/code/renderer/tr_shadows.c b/MP/code/renderer/tr_shadows.c
index 6d81d9a..65214db 100644
--- a/MP/code/renderer/tr_shadows.c
+++ b/MP/code/renderer/tr_shadows.c
@@ -51,6 +51,7 @@ typedef struct {
 static edgeDef_t edgeDefs[SHADER_MAX_VERTEXES][MAX_EDGE_DEFS];
 static int numEdgeDefs[SHADER_MAX_VERTEXES];
 static int facing[SHADER_MAX_INDEXES / 3];
+static vec3_t shadowXyz[SHADER_MAX_VERTEXES];
 
 void R_AddEdgeDef( int i1, int i2, int facing ) {
 	int c;
@@ -87,13 +88,13 @@ void R_RenderShadowEdges( void ) {
 
 		qglBegin( GL_TRIANGLE_STRIP );
 		qglVertex3fv( tess.xyz[ i1 ] );
-		qglVertex3fv( tess.xyz[ i1 + tess.numVertexes ] );
+		qglVertex3fv( shadowXyz[ i1 ] );
 		qglVertex3fv( tess.xyz[ i2 ] );
-		qglVertex3fv( tess.xyz[ i2 + tess.numVertexes ] );
+		qglVertex3fv( shadowXyz[ i2 ] );
 		qglVertex3fv( tess.xyz[ i3 ] );
-		qglVertex3fv( tess.xyz[ i3 + tess.numVertexes ] );
+		qglVertex3fv( shadowXyz[ i3 ] );
 		qglVertex3fv( tess.xyz[ i1 ] );
-		qglVertex3fv( tess.xyz[ i1 + tess.numVertexes ] );
+		qglVertex3fv( shadowXyz[ i1 ] );
 		qglEnd();
 	}
 #else
@@ -143,9 +144,9 @@ void R_RenderShadowEdges( void ) {
 #else
 				qglBegin( GL_TRIANGLE_STRIP );
 				qglVertex3fv( tess.xyz[ i ] );
-				qglVertex3fv( tess.xyz[ i + tess.numVertexes ] );
+				qglVertex3fv( shadowXyz[ i ] );
 				qglVertex3fv( tess.xyz[ i2 ] );
-				qglVertex3fv( tess.xyz[ i2 + tess.numVertexes ] );
+				qglVertex3fv( shadowXyz[ i2 ] );
 				qglEnd();
 #endif
 				c_edges++;
@@ -175,11 +176,6 @@ void RB_ShadowTessEnd( void ) {
 	vec3_t lightDir;
 	GLboolean rgba[4];
 
-	// we can only do this if we have enough space in the vertex buffers
-	if ( tess.numVertexes >= SHADER_MAX_VERTEXES / 2 ) {
-		return;
-	}
-
 	if ( glConfig.stencilBits < 4 ) {
 		return;
 	}
@@ -188,7 +184,7 @@ void RB_ShadowTessEnd( void ) {
 
 	// project vertexes away from light direction
 	for ( i = 0 ; i < tess.numVertexes ; i++ ) {
-		VectorMA( tess.xyz[i], -512, lightDir, tess.xyz[i + tess.numVertexes] );
+		VectorMA( tess.xyz[i], -512, lightDir, shadowXyz[i] );
 	}
 
 	// decide which triangles face the light
diff --git a/SP/code/rend2/tr_shadows.c b/SP/code/rend2/tr_shadows.c
index adc4fb8..7f9f60e 100644
--- a/SP/code/rend2/tr_shadows.c
+++ b/SP/code/rend2/tr_shadows.c
@@ -51,6 +51,7 @@ typedef struct {
 static edgeDef_t edgeDefs[SHADER_MAX_VERTEXES][MAX_EDGE_DEFS];
 static int numEdgeDefs[SHADER_MAX_VERTEXES];
 static int facing[SHADER_MAX_INDEXES / 3];
+static vec3_t shadowXyz[SHADER_MAX_VERTEXES];
 
 void R_AddEdgeDef( int i1, int i2, int facing ) {
 	int c;
@@ -87,13 +88,13 @@ void R_RenderShadowEdges( void ) {
 
 		qglBegin( GL_TRIANGLE_STRIP );
 		qglVertex3fv( tess.xyz[ i1 ] );
-		qglVertex3fv( tess.xyz[ i1 + tess.numVertexes ] );
+		qglVertex3fv( shadowXyz[ i1 ] );
 		qglVertex3fv( tess.xyz[ i2 ] );
-		qglVertex3fv( tess.xyz[ i2 + tess.numVertexes ] );
+		qglVertex3fv( shadowXyz[ i2 ] );
 		qglVertex3fv( tess.xyz[ i3 ] );
-		qglVertex3fv( tess.xyz[ i3 + tess.numVertexes ] );
+		qglVertex3fv( shadowXyz[ i3 ] );
 		qglVertex3fv( tess.xyz[ i1 ] );
-		qglVertex3fv( tess.xyz[ i1 + tess.numVertexes ] );
+		qglVertex3fv( shadowXyz[ i1 ] );
 		qglEnd();
 	}
 #else
@@ -133,9 +134,9 @@ void R_RenderShadowEdges( void ) {
 			if ( hit[ 1 ] == 0 ) {
 				qglBegin( GL_TRIANGLE_STRIP );
 				qglVertex3fv( tess.xyz[ i ] );
-				qglVertex3fv( tess.xyz[ i + tess.numVertexes ] );
+				qglVertex3fv( shadowXyz[ i ] );
 				qglVertex3fv( tess.xyz[ i2 ] );
-				qglVertex3fv( tess.xyz[ i2 + tess.numVertexes ] );
+				qglVertex3fv( shadowXyz[ i2 ] );
 				qglEnd();
 				c_edges++;
 			} else {
@@ -164,11 +165,6 @@ void RB_ShadowTessEnd( void ) {
 	vec3_t lightDir;
 	GLboolean rgba[4];
 
-	// we can only do this if we have enough space in the vertex buffers
-	if ( tess.numVertexes >= SHADER_MAX_VERTEXES / 2 ) {
-		return;
-	}
-
 	if ( glConfig.stencilBits < 4 ) {
 		return;
 	}
@@ -177,7 +173,7 @@ void RB_ShadowTessEnd( void ) {
 
 	// project vertexes away from light direction
 	for ( i = 0 ; i < tess.numVertexes ; i++ ) {
-		VectorMA( tess.xyz[i], -512, lightDir, tess.xyz[i + tess.numVertexes] );
+		VectorMA( tess.xyz[i], -512, lightDir, shadowXyz[i] );
 	}
 
 	// decide which triangles face the light
diff --git a/SP/code/renderer/tr_shadows.c b/SP/code/renderer/tr_shadows.c
index 6688f1c..43bf487 100644
--- a/SP/code/renderer/tr_shadows.c
+++ b/SP/code/renderer/tr_shadows.c
@@ -51,6 +51,7 @@ typedef struct {
 static edgeDef_t edgeDefs[SHADER_MAX_VERTEXES][MAX_EDGE_DEFS];
 static int numEdgeDefs[SHADER_MAX_VERTEXES];
 static int facing[SHADER_MAX_INDEXES / 3];
+static vec3_t shadowXyz[SHADER_MAX_VERTEXES];
 
 void R_AddEdgeDef( int i1, int i2, int facing ) {
 	int c;
@@ -87,13 +88,13 @@ void R_RenderShadowEdges( void ) {
 
 		qglBegin( GL_TRIANGLE_STRIP );
 		qglVertex3fv( tess.xyz[ i1 ] );
-		qglVertex3fv( tess.xyz[ i1 + tess.numVertexes ] );
+		qglVertex3fv( shadowXyz[ i1 ] );
 		qglVertex3fv( tess.xyz[ i2 ] );
-		qglVertex3fv( tess.xyz[ i2 + tess.numVertexes ] );
+		qglVertex3fv( shadowXyz[ i2 ] );
 		qglVertex3fv( tess.xyz[ i3 ] );
-		qglVertex3fv( tess.xyz[ i3 + tess.numVertexes ] );
+		qglVertex3fv( shadowXyz[ i3 ] );
 		qglVertex3fv( tess.xyz[ i1 ] );
-		qglVertex3fv( tess.xyz[ i1 + tess.numVertexes ] );
+		qglVertex3fv( shadowXyz[ i1 ] );
 		qglEnd();
 	}
 #else
@@ -143,9 +144,9 @@ void R_RenderShadowEdges( void ) {
 #else
 				qglBegin( GL_TRIANGLE_STRIP );
 				qglVertex3fv( tess.xyz[ i ] );
-				qglVertex3fv( tess.xyz[ i + tess.numVertexes ] );
+				qglVertex3fv( shadowXyz[ i ] );
 				qglVertex3fv( tess.xyz[ i2 ] );
-				qglVertex3fv( tess.xyz[ i2 + tess.numVertexes ] );
+				qglVertex3fv( shadowXyz[ i2 ] );
 				qglEnd();
 #endif
 				c_edges++;
@@ -175,11 +176,6 @@ void RB_ShadowTessEnd( void ) {
 	vec3_t lightDir;
 	GLboolean rgba[4];
 
-	// we can only do this if we have enough space in the vertex buffers
-	if ( tess.numVertexes >= SHADER_MAX_VERTEXES / 2 ) {
-		return;
-	}
-
 	if ( glConfig.stencilBits < 4 ) {
 		return;
 	}
@@ -188,7 +184,7 @@ void RB_ShadowTessEnd( void ) {
 
 	// project vertexes away from light direction
 	for ( i = 0 ; i < tess.numVertexes ; i++ ) {
-		VectorMA( tess.xyz[i], -512, lightDir, tess.xyz[i + tess.numVertexes] );
+		VectorMA( tess.xyz[i], -512, lightDir, shadowXyz[i] );
 	}
 
 	// decide which triangles face the light

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git



More information about the Pkg-games-commits mailing list