summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/renderergl1/tr_shadows.c20
-rw-r--r--src/renderergl2/tr_shadows.c20
2 files changed, 16 insertions, 24 deletions
diff --git a/src/renderergl1/tr_shadows.c b/src/renderergl1/tr_shadows.c
index 670b41d8..285a8d24 100644
--- a/src/renderergl1/tr_shadows.c
+++ b/src/renderergl1/tr_shadows.c
@@ -45,6 +45,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;
@@ -81,13 +82,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
@@ -127,9 +128,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 {
@@ -158,11 +159,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;
}
@@ -171,7 +167,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/src/renderergl2/tr_shadows.c b/src/renderergl2/tr_shadows.c
index 32110175..fdb39091 100644
--- a/src/renderergl2/tr_shadows.c
+++ b/src/renderergl2/tr_shadows.c
@@ -45,6 +45,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;
@@ -81,13 +82,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
@@ -127,9 +128,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 {
@@ -158,11 +159,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;
}
@@ -171,7 +167,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