Commit cc1a38dc authored by Rinnegatamante's avatar Rinnegatamante
Browse files

Test for better renderer.

parent e46316dd
...@@ -133,9 +133,9 @@ void GLimp_Init( qboolean coreContext) ...@@ -133,9 +133,9 @@ void GLimp_Init( qboolean coreContext)
} }
vglIndexPointerMapped(indices); vglIndexPointerMapped(indices);
glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_VERTEX_ARRAY);
gVertexBufferPtr = (float*)malloc(0x400000); gVertexBufferPtr = (float*)malloc(0x10000);
gColorBufferPtr = (uint8_t*)malloc(0x200000); gColorBufferPtr = (uint8_t*)malloc(0x10000);
gTexCoordBufferPtr = (float*)malloc(0x200000); gTexCoordBufferPtr = (float*)malloc(0x10000);
gVertexBuffer = gVertexBufferPtr; gVertexBuffer = gVertexBufferPtr;
gColorBuffer = gColorBufferPtr; gColorBuffer = gColorBufferPtr;
gTexCoordBuffer = gTexCoordBufferPtr; gTexCoordBuffer = gTexCoordBufferPtr;
......
...@@ -350,15 +350,15 @@ void RB_MDRSurfaceAnim( mdrSurface_t *surface ) ...@@ -350,15 +350,15 @@ void RB_MDRSurfaceAnim( mdrSurface_t *surface )
triangles = (int *) ((byte *)surface + surface->ofsTriangles); triangles = (int *) ((byte *)surface + surface->ofsTriangles);
indexes = surface->numTriangles * 3; indexes = surface->numTriangles * 3;
baseIndex = tess.numIndexes; baseIndex = tess->numIndexes;
baseVertex = tess.numVertexes; baseVertex = tess->numVertexes;
// Set up all triangles. // Set up all triangles.
for (j = 0 ; j < indexes ; j++) for (j = 0 ; j < indexes ; j++)
{ {
tess.indexes[baseIndex + j] = baseVertex + triangles[j]; tess->indexes[baseIndex + j] = baseVertex + triangles[j];
} }
tess.numIndexes += indexes; tess->numIndexes += indexes;
// //
// lerp all the needed bones // lerp all the needed bones
...@@ -404,21 +404,21 @@ void RB_MDRSurfaceAnim( mdrSurface_t *surface ) ...@@ -404,21 +404,21 @@ void RB_MDRSurfaceAnim( mdrSurface_t *surface )
tempNormal[2] += w->boneWeight * DotProduct( bone->matrix[2], v->normal ); tempNormal[2] += w->boneWeight * DotProduct( bone->matrix[2], v->normal );
} }
tess.xyz[baseVertex + j][0] = tempVert[0]; tess->xyz[baseVertex + j][0] = tempVert[0];
tess.xyz[baseVertex + j][1] = tempVert[1]; tess->xyz[baseVertex + j][1] = tempVert[1];
tess.xyz[baseVertex + j][2] = tempVert[2]; tess->xyz[baseVertex + j][2] = tempVert[2];
tess.normal[baseVertex + j][0] = tempNormal[0]; tess->normal[baseVertex + j][0] = tempNormal[0];
tess.normal[baseVertex + j][1] = tempNormal[1]; tess->normal[baseVertex + j][1] = tempNormal[1];
tess.normal[baseVertex + j][2] = tempNormal[2]; tess->normal[baseVertex + j][2] = tempNormal[2];
tess.texCoords[baseVertex + j][0][0] = v->texCoords[0]; tess->texCoords[baseVertex + j][0][0] = v->texCoords[0];
tess.texCoords[baseVertex + j][0][1] = v->texCoords[1]; tess->texCoords[baseVertex + j][0][1] = v->texCoords[1];
v = (mdrVertex_t *)&v->weights[v->numWeights]; v = (mdrVertex_t *)&v->weights[v->numWeights];
} }
tess.numVertexes += surface->numVerts; tess->numVertexes += surface->numVerts;
} }
......
...@@ -543,7 +543,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) { ...@@ -543,7 +543,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
// we have to reset the shaderTime as well otherwise image animations start // we have to reset the shaderTime as well otherwise image animations start
// from the wrong frame // from the wrong frame
tess.shaderTime = backEnd.refdef.floatTime - tess.shader->timeOffset; tess->shaderTime = backEnd.refdef.floatTime - tess->shader->timeOffset;
// set up the transformation matrix // set up the transformation matrix
R_RotateForEntity( backEnd.currentEntity, &backEnd.viewParms, &backEnd.or ); R_RotateForEntity( backEnd.currentEntity, &backEnd.viewParms, &backEnd.or );
...@@ -567,7 +567,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) { ...@@ -567,7 +567,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
backEnd.or = backEnd.viewParms.world; backEnd.or = backEnd.viewParms.world;
// we have to reset the shaderTime as well otherwise image animations on // we have to reset the shaderTime as well otherwise image animations on
// the world (like water) continue with the wrong frame // the world (like water) continue with the wrong frame
tess.shaderTime = backEnd.refdef.floatTime - tess.shader->timeOffset; tess->shaderTime = backEnd.refdef.floatTime - tess->shader->timeOffset;
R_TransformDlights( backEnd.refdef.num_dlights, backEnd.refdef.dlights, &backEnd.or ); R_TransformDlights( backEnd.refdef.num_dlights, backEnd.refdef.dlights, &backEnd.or );
} }
...@@ -714,7 +714,7 @@ void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte * ...@@ -714,7 +714,7 @@ void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte *
} }
R_IssuePendingRenderCommands(); R_IssuePendingRenderCommands();
if ( tess.numIndexes ) { if ( tess->numIndexes ) {
RB_EndSurface(); RB_EndSurface();
} }
...@@ -842,8 +842,8 @@ const void *RB_StretchPic ( const void *data ) { ...@@ -842,8 +842,8 @@ const void *RB_StretchPic ( const void *data ) {
} }
shader = cmd->shader; shader = cmd->shader;
if ( shader != tess.shader ) { if ( shader != tess->shader ) {
if ( tess.numIndexes ) { if ( tess->numIndexes ) {
RB_EndSurface(); RB_EndSurface();
} }
backEnd.currentEntity = &backEnd.entity2D; backEnd.currentEntity = &backEnd.entity2D;
...@@ -851,51 +851,51 @@ const void *RB_StretchPic ( const void *data ) { ...@@ -851,51 +851,51 @@ const void *RB_StretchPic ( const void *data ) {
} }
RB_CHECKOVERFLOW( 4, 6 ); RB_CHECKOVERFLOW( 4, 6 );
numVerts = tess.numVertexes; numVerts = tess->numVertexes;
numIndexes = tess.numIndexes; numIndexes = tess->numIndexes;
tess.numVertexes += 4; tess->numVertexes += 4;
tess.numIndexes += 6; tess->numIndexes += 6;
tess.indexes[ numIndexes ] = numVerts + 3; tess->indexes[ numIndexes ] = numVerts + 3;
tess.indexes[ numIndexes + 1 ] = numVerts + 0; tess->indexes[ numIndexes + 1 ] = numVerts + 0;
tess.indexes[ numIndexes + 2 ] = numVerts + 2; tess->indexes[ numIndexes + 2 ] = numVerts + 2;
tess.indexes[ numIndexes + 3 ] = numVerts + 2; tess->indexes[ numIndexes + 3 ] = numVerts + 2;
tess.indexes[ numIndexes + 4 ] = numVerts + 0; tess->indexes[ numIndexes + 4 ] = numVerts + 0;
tess.indexes[ numIndexes + 5 ] = numVerts + 1; tess->indexes[ numIndexes + 5 ] = numVerts + 1;
*(int *)tess.vertexColors[ numVerts ] = *(int *)tess->vertexColors[ numVerts ] =
*(int *)tess.vertexColors[ numVerts + 1 ] = *(int *)tess->vertexColors[ numVerts + 1 ] =
*(int *)tess.vertexColors[ numVerts + 2 ] = *(int *)tess->vertexColors[ numVerts + 2 ] =
*(int *)tess.vertexColors[ numVerts + 3 ] = *(int *)backEnd.color2D; *(int *)tess->vertexColors[ numVerts + 3 ] = *(int *)backEnd.color2D;
tess.xyz[ numVerts ][0] = cmd->x; tess->xyz[ numVerts ][0] = cmd->x;
tess.xyz[ numVerts ][1] = cmd->y; tess->xyz[ numVerts ][1] = cmd->y;
tess.xyz[ numVerts ][2] = 0; tess->xyz[ numVerts ][2] = 0;
tess.texCoords[ numVerts ][0][0] = cmd->s1; tess->texCoords[ numVerts ][0][0] = cmd->s1;
tess.texCoords[ numVerts ][0][1] = cmd->t1; tess->texCoords[ numVerts ][0][1] = cmd->t1;
tess.xyz[ numVerts + 1 ][0] = cmd->x + cmd->w; tess->xyz[ numVerts + 1 ][0] = cmd->x + cmd->w;
tess.xyz[ numVerts + 1 ][1] = cmd->y; tess->xyz[ numVerts + 1 ][1] = cmd->y;
tess.xyz[ numVerts + 1 ][2] = 0; tess->xyz[ numVerts + 1 ][2] = 0;
tess.texCoords[ numVerts + 1 ][0][0] = cmd->s2; tess->texCoords[ numVerts + 1 ][0][0] = cmd->s2;
tess.texCoords[ numVerts + 1 ][0][1] = cmd->t1; tess->texCoords[ numVerts + 1 ][0][1] = cmd->t1;
tess.xyz[ numVerts + 2 ][0] = cmd->x + cmd->w; tess->xyz[ numVerts + 2 ][0] = cmd->x + cmd->w;
tess.xyz[ numVerts + 2 ][1] = cmd->y + cmd->h; tess->xyz[ numVerts + 2 ][1] = cmd->y + cmd->h;
tess.xyz[ numVerts + 2 ][2] = 0; tess->xyz[ numVerts + 2 ][2] = 0;
tess.texCoords[ numVerts + 2 ][0][0] = cmd->s2; tess->texCoords[ numVerts + 2 ][0][0] = cmd->s2;
tess.texCoords[ numVerts + 2 ][0][1] = cmd->t2; tess->texCoords[ numVerts + 2 ][0][1] = cmd->t2;
tess.xyz[ numVerts + 3 ][0] = cmd->x; tess->xyz[ numVerts + 3 ][0] = cmd->x;
tess.xyz[ numVerts + 3 ][1] = cmd->y + cmd->h; tess->xyz[ numVerts + 3 ][1] = cmd->y + cmd->h;
tess.xyz[ numVerts + 3 ][2] = 0; tess->xyz[ numVerts + 3 ][2] = 0;
tess.texCoords[ numVerts + 3 ][0][0] = cmd->s1; tess->texCoords[ numVerts + 3 ][0][0] = cmd->s1;
tess.texCoords[ numVerts + 3 ][0][1] = cmd->t2; tess->texCoords[ numVerts + 3 ][0][1] = cmd->t2;
return (const void *)(cmd + 1); return (const void *)(cmd + 1);
} }
...@@ -911,7 +911,7 @@ const void *RB_DrawSurfs( const void *data ) { ...@@ -911,7 +911,7 @@ const void *RB_DrawSurfs( const void *data ) {
const drawSurfsCommand_t *cmd; const drawSurfsCommand_t *cmd;
// finish any 2D drawing if needed // finish any 2D drawing if needed
if ( tess.numIndexes ) { if ( tess->numIndexes ) {
RB_EndSurface(); RB_EndSurface();
} }
...@@ -1038,7 +1038,7 @@ const void *RB_ClearDepth(const void *data) ...@@ -1038,7 +1038,7 @@ const void *RB_ClearDepth(const void *data)
{ {
const clearDepthCommand_t *cmd = data; const clearDepthCommand_t *cmd = data;
if(tess.numIndexes) if(tess->numIndexes)
RB_EndSurface(); RB_EndSurface();
// texture swapping test // texture swapping test
...@@ -1060,7 +1060,7 @@ const void *RB_SwapBuffers( const void *data ) { ...@@ -1060,7 +1060,7 @@ const void *RB_SwapBuffers( const void *data ) {
const swapBuffersCommand_t *cmd; const swapBuffersCommand_t *cmd;
// finish any 2D drawing if needed // finish any 2D drawing if needed
if ( tess.numIndexes ) { if ( tess->numIndexes ) {
RB_EndSurface(); RB_EndSurface();
} }
......
...@@ -372,9 +372,9 @@ void RB_RenderFlare( flare_t *f ) { ...@@ -372,9 +372,9 @@ void RB_RenderFlare( flare_t *f ) {
// Calculations for fogging // Calculations for fogging
if(tr.world && f->fogNum > 0 && f->fogNum < tr.world->numfogs) if(tr.world && f->fogNum > 0 && f->fogNum < tr.world->numfogs)
{ {
tess.numVertexes = 1; tess->numVertexes = 1;
VectorCopy(f->origin, tess.xyz[0]); VectorCopy(f->origin, tess->xyz[0]);
tess.fogNum = f->fogNum; tess->fogNum = f->fogNum;
RB_CalcModulateColorsByFog(fogFactors); RB_CalcModulateColorsByFog(fogFactors);
...@@ -390,52 +390,52 @@ void RB_RenderFlare( flare_t *f ) { ...@@ -390,52 +390,52 @@ void RB_RenderFlare( flare_t *f ) {
RB_BeginSurface( tr.flareShader, f->fogNum ); RB_BeginSurface( tr.flareShader, f->fogNum );
// FIXME: use quadstamp? // FIXME: use quadstamp?
tess.xyz[tess.numVertexes][0] = f->windowX - size; tess->xyz[tess->numVertexes][0] = f->windowX - size;
tess.xyz[tess.numVertexes][1] = f->windowY - size; tess->xyz[tess->numVertexes][1] = f->windowY - size;
tess.texCoords[tess.numVertexes][0][0] = 0; tess->texCoords[tess->numVertexes][0][0] = 0;
tess.texCoords[tess.numVertexes][0][1] = 0; tess->texCoords[tess->numVertexes][0][1] = 0;
tess.vertexColors[tess.numVertexes][0] = iColor[0]; tess->vertexColors[tess->numVertexes][0] = iColor[0];
tess.vertexColors[tess.numVertexes][1] = iColor[1]; tess->vertexColors[tess->numVertexes][1] = iColor[1];
tess.vertexColors[tess.numVertexes][2] = iColor[2]; tess->vertexColors[tess->numVertexes][2] = iColor[2];
tess.vertexColors[tess.numVertexes][3] = 255; tess->vertexColors[tess->numVertexes][3] = 255;
tess.numVertexes++; tess->numVertexes++;
tess.xyz[tess.numVertexes][0] = f->windowX - size; tess->xyz[tess->numVertexes][0] = f->windowX - size;
tess.xyz[tess.numVertexes][1] = f->windowY + size; tess->xyz[tess->numVertexes][1] = f->windowY + size;
tess.texCoords[tess.numVertexes][0][0] = 0; tess->texCoords[tess->numVertexes][0][0] = 0;
tess.texCoords[tess.numVertexes][0][1] = 1; tess->texCoords[tess->numVertexes][0][1] = 1;
tess.vertexColors[tess.numVertexes][0] = iColor[0]; tess->vertexColors[tess->numVertexes][0] = iColor[0];
tess.vertexColors[tess.numVertexes][1] = iColor[1]; tess->vertexColors[tess->numVertexes][1] = iColor[1];
tess.vertexColors[tess.numVertexes][2] = iColor[2]; tess->vertexColors[tess->numVertexes][2] = iColor[2];
tess.vertexColors[tess.numVertexes][3] = 255; tess->vertexColors[tess->numVertexes][3] = 255;
tess.numVertexes++; tess->numVertexes++;
tess.xyz[tess.numVertexes][0] = f->windowX + size; tess->xyz[tess->numVertexes][0] = f->windowX + size;
tess.xyz[tess.numVertexes][1] = f->windowY + size; tess->xyz[tess->numVertexes][1] = f->windowY + size;
tess.texCoords[tess.numVertexes][0][0] = 1; tess->texCoords[tess->numVertexes][0][0] = 1;
tess.texCoords[tess.numVertexes][0][1] = 1; tess->texCoords[tess->numVertexes][0][1] = 1;
tess.vertexColors[tess.numVertexes][0] = iColor[0]; tess->vertexColors[tess->numVertexes][0] = iColor[0];
tess.vertexColors[tess.numVertexes][1] = iColor[1]; tess->vertexColors[tess->numVertexes][1] = iColor[1];
tess.vertexColors[tess.numVertexes][2] = iColor[2]; tess->vertexColors[tess->numVertexes][2] = iColor[2];
tess.vertexColors[tess.numVertexes][3] = 255; tess->vertexColors[tess->numVertexes][3] = 255;
tess.numVertexes++; tess->numVertexes++;
tess.xyz[tess.numVertexes][0] = f->windowX + size; tess->xyz[tess->numVertexes][0] = f->windowX + size;
tess.xyz[tess.numVertexes][1] = f->windowY - size; tess->xyz[tess->numVertexes][1] = f->windowY - size;
tess.texCoords[tess.numVertexes][0][0] = 1; tess->texCoords[tess->numVertexes][0][0] = 1;
tess.texCoords[tess.numVertexes][0][1] = 0; tess->texCoords[tess->numVertexes][0][1] = 0;
tess.vertexColors[tess.numVertexes][0] = iColor[0]; tess->vertexColors[tess->numVertexes][0] = iColor[0];
tess.vertexColors[tess.numVertexes][1] = iColor[1]; tess->vertexColors[tess->numVertexes][1] = iColor[1];
tess.vertexColors[tess.numVertexes][2] = iColor[2]; tess->vertexColors[tess->numVertexes][2] = iColor[2];
tess.vertexColors[tess.numVertexes][3] = 255; tess->vertexColors[tess->numVertexes][3] = 255;
tess.numVertexes++; tess->numVertexes++;
tess.indexes[tess.numIndexes++] = 0; tess->indexes[tess->numIndexes++] = 0;
tess.indexes[tess.numIndexes++] = 1; tess->indexes[tess->numIndexes++] = 1;
tess.indexes[tess.numIndexes++] = 2; tess->indexes[tess->numIndexes++] = 2;
tess.indexes[tess.numIndexes++] = 0; tess->indexes[tess->numIndexes++] = 0;
tess.indexes[tess.numIndexes++] = 2; tess->indexes[tess->numIndexes++] = 2;
tess.indexes[tess.numIndexes++] = 3; tess->indexes[tess->numIndexes++] = 3;
RB_EndSurface(); RB_EndSurface();
} }
......
...@@ -1188,6 +1188,8 @@ void R_Register( void ) ...@@ -1188,6 +1188,8 @@ void R_Register( void )
ri.Cmd_AddCommand( "minimize", GLimp_Minimize ); ri.Cmd_AddCommand( "minimize", GLimp_Minimize );
} }
shaderCommands_t *tess_pool[256];
/* /*
=============== ===============
R_Init R_Init
...@@ -1200,19 +1202,24 @@ void R_Init( void ) { ...@@ -1200,19 +1202,24 @@ void R_Init( void ) {
ri.Printf( PRINT_ALL, "----- R_Init -----\n" ); ri.Printf( PRINT_ALL, "----- R_Init -----\n" );
for (i=0; i < 256; i++){
tess_pool[i] = (shaderCommands_t*)malloc(sizeof(shaderCommands_t));
}
tess = tess_pool[0];
// clear all our internal state // clear all our internal state
Com_Memset( &tr, 0, sizeof( tr ) ); Com_Memset( &tr, 0, sizeof( tr ) );
Com_Memset( &backEnd, 0, sizeof( backEnd ) ); Com_Memset( &backEnd, 0, sizeof( backEnd ) );
Com_Memset( &tess, 0, sizeof( tess ) ); Com_Memset( tess, 0, sizeof( shaderCommands_t ) );
if(sizeof(glconfig_t) != 11332) if(sizeof(glconfig_t) != 11332)
ri.Error( ERR_FATAL, "Mod ABI incompatible: sizeof(glconfig_t) == %u != 11332", (unsigned int) sizeof(glconfig_t)); ri.Error( ERR_FATAL, "Mod ABI incompatible: sizeof(glconfig_t) == %u != 11332", (unsigned int) sizeof(glconfig_t));
// Swap_Init(); // Swap_Init();
if ( (intptr_t)tess.xyz & 15 ) { if ( (intptr_t)tess->xyz & 15 ) {
ri.Printf( PRINT_WARNING, "tess.xyz not 16 byte aligned\n" ); ri.Printf( PRINT_WARNING, "tess->xyz not 16 byte aligned\n" );
} }
Com_Memset( tess.constantColor255, 255, sizeof( tess.constantColor255 ) ); Com_Memset( tess->constantColor255, 255, sizeof( tess->constantColor255 ) );
// //
// init function tables // init function tables
......
...@@ -33,7 +33,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ...@@ -33,7 +33,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "../renderercommon/qgl.h" #include "../renderercommon/qgl.h"
#define GL_INDEX_TYPE GL_UNSIGNED_INT #define GL_INDEX_TYPE GL_UNSIGNED_INT
typedef unsigned int glIndex_t; typedef uint16_t glIndex_t;
// 14 bits // 14 bits
// can't be increased without changing bit packing for drawsurfs // can't be increased without changing bit packing for drawsurfs
...@@ -160,8 +160,8 @@ typedef enum { ...@@ -160,8 +160,8 @@ typedef enum {
CGEN_IDENTITY, // always (1,1,1,1) CGEN_IDENTITY, // always (1,1,1,1)
CGEN_ENTITY, // grabbed from entity's modulate field CGEN_ENTITY, // grabbed from entity's modulate field
CGEN_ONE_MINUS_ENTITY, // grabbed from 1 - entity.modulate CGEN_ONE_MINUS_ENTITY, // grabbed from 1 - entity.modulate
CGEN_EXACT_VERTEX, // tess.vertexColors CGEN_EXACT_VERTEX, // tess->vertexColors
CGEN_VERTEX, // tess.vertexColors * tr.identityLight CGEN_VERTEX, // tess->vertexColors * tr.identityLight
CGEN_ONE_MINUS_VERTEX, CGEN_ONE_MINUS_VERTEX,
CGEN_WAVEFORM, // programmatically generated CGEN_WAVEFORM, // programmatically generated
CGEN_LIGHTING_DIFFUSE, CGEN_LIGHTING_DIFFUSE,
...@@ -1231,12 +1231,14 @@ typedef struct shaderCommands_s ...@@ -1231,12 +1231,14 @@ typedef struct shaderCommands_s
shaderStage_t **xstages; shaderStage_t **xstages;
} shaderCommands_t; } shaderCommands_t;
extern shaderCommands_t tess; extern shaderCommands_t *tess;
extern shaderCommands_t *tess_pool[256];
extern uint8_t tess_idx;
void RB_BeginSurface(shader_t *shader, int fogNum ); void RB_BeginSurface(shader_t *shader, int fogNum );
void RB_EndSurface(void); void RB_EndSurface(void);
void RB_CheckOverflow( int verts, int indexes ); void RB_CheckOverflow( int verts, int indexes );
#define RB_CHECKOVERFLOW(v,i) if (tess.numVertexes + (v) >= SHADER_MAX_VERTEXES || tess.numIndexes + (i) >= SHADER_MAX_INDEXES ) {RB_CheckOverflow(v,i);} #define RB_CHECKOVERFLOW(v,i) if (tess->numVertexes + (v) >= SHADER_MAX_VERTEXES || tess->numIndexes + (i) >= SHADER_MAX_INDEXES ) {RB_CheckOverflow(v,i);}
void RB_StageIteratorGeneric( void ); void RB_StageIteratorGeneric( void );
void RB_StageIteratorSky( void ); void RB_StageIteratorSky( void );
......
...@@ -864,14 +864,14 @@ static qboolean SurfIsOffscreen( const drawSurf_t *drawSurf, vec4_t clipDest[128 ...@@ -864,14 +864,14 @@ static qboolean SurfIsOffscreen( const drawSurf_t *drawSurf, vec4_t clipDest[128
RB_BeginSurface( shader, fogNum ); RB_BeginSurface( shader, fogNum );
rb_surfaceTable[ *drawSurf->surface ]( drawSurf->surface ); rb_surfaceTable[ *drawSurf->surface ]( drawSurf->surface );
assert( tess.numVertexes < 128 ); assert( tess->numVertexes < 128 );
for ( i = 0; i < tess.numVertexes; i++ ) for ( i = 0; i < tess->numVertexes; i++ )
{ {
int j; int j;
unsigned int pointFlags = 0; unsigned int pointFlags = 0;
R_TransformModelToClip( tess.xyz[i], tr.or.modelMatrix, tr.viewParms.projectionMatrix, eye, clip ); R_TransformModelToClip( tess->xyz[i], tr.or.modelMatrix, tr.viewParms.projectionMatrix, eye, clip );
for ( j = 0; j < 3; j++ ) for ( j = 0; j < 3; j++ )
{ {
...@@ -899,14 +899,14 @@ static qboolean SurfIsOffscreen( const drawSurf_t *drawSurf, vec4_t clipDest[128 ...@@ -899,14 +899,14 @@ static qboolean SurfIsOffscreen( const drawSurf_t *drawSurf, vec4_t clipDest[128
// based on vertex distance isn't 100% correct (we should be checking for // based on vertex distance isn't 100% correct (we should be checking for
// range to the surface), but it's good enough for the types of portals // range to the surface), but it's good enough for the types of portals
// we have in the game right now. // we have in the game right now.
numTriangles = tess.numIndexes / 3; numTriangles = tess->numIndexes / 3;
for ( i = 0; i < tess.numIndexes; i += 3 ) for ( i = 0; i < tess->numIndexes; i += 3 )
{ {
vec3_t normal; vec3_t normal;
float len; float len;
VectorSubtract( tess.xyz[tess.indexes[i]], tr.viewParms.or.origin, normal ); VectorSubtract( tess->xyz[tess->indexes[i]], tr.viewParms.or.origin, normal );
len = VectorLengthSquared( normal ); // lose the sqrt len = VectorLengthSquared( normal ); // lose the sqrt
if ( len < shortest ) if ( len < shortest )
...@@ -914,7 +914,7 @@ static qboolean SurfIsOffscreen( const drawSurf_t *drawSurf, vec4_t clipDest[128 ...@@ -914,7 +914,7 @@ static qboolean SurfIsOffscreen( const drawSurf_t *drawSurf, vec4_t clipDest[128
shortest = len; shortest = len;
} }
if ( DotProduct( normal, tess.normal[tess.indexes[i]] ) >= 0 ) if ( DotProduct( normal, tess->normal[tess->indexes[i]] ) >= 0 )
{ {
numTriangles--; numTriangles--;
} }
...@@ -931,7 +931,7 @@ static qboolean SurfIsOffscreen( const drawSurf_t *drawSurf, vec4_t clipDest[128 ...@@ -931,7 +931,7 @@ static qboolean SurfIsOffscreen( const drawSurf_t *drawSurf, vec4_t clipDest[128
return qfalse; return qfalse;
} }
if ( shortest > (tess.shader->portalRange*tess.shader->portalRange) ) if ( shortest > (tess->shader->portalRange*tess->shader->portalRange) )
{ {
return qtrue; return qtrue;
} }
......
...@@ -1035,10 +1035,10 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) { ...@@ -1035,10 +1035,10 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) {
RB_CHECKOVERFLOW( surf->num_vertexes, surf->num_triangles * 3 ); RB_CHECKOVERFLOW( surf->num_vertexes, surf->num_triangles * 3 );
outXYZ = &tess.xyz[tess.numVertexes];