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)
}
vglIndexPointerMapped(indices);
glEnableClientState(GL_VERTEX_ARRAY);
gVertexBufferPtr = (float*)malloc(0x400000);
gColorBufferPtr = (uint8_t*)malloc(0x200000);
gTexCoordBufferPtr = (float*)malloc(0x200000);
gVertexBufferPtr = (float*)malloc(0x10000);
gColorBufferPtr = (uint8_t*)malloc(0x10000);
gTexCoordBufferPtr = (float*)malloc(0x10000);
gVertexBuffer = gVertexBufferPtr;
gColorBuffer = gColorBufferPtr;
gTexCoordBuffer = gTexCoordBufferPtr;
......
......@@ -350,15 +350,15 @@ void RB_MDRSurfaceAnim( mdrSurface_t *surface )
triangles = (int *) ((byte *)surface + surface->ofsTriangles);
indexes = surface->numTriangles * 3;
baseIndex = tess.numIndexes;
baseVertex = tess.numVertexes;
baseIndex = tess->numIndexes;
baseVertex = tess->numVertexes;
// Set up all triangles.
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
......@@ -404,21 +404,21 @@ void RB_MDRSurfaceAnim( mdrSurface_t *surface )
tempNormal[2] += w->boneWeight * DotProduct( bone->matrix[2], v->normal );
}
tess.xyz[baseVertex + j][0] = tempVert[0];
tess.xyz[baseVertex + j][1] = tempVert[1];
tess.xyz[baseVertex + j][2] = tempVert[2];
tess->xyz[baseVertex + j][0] = tempVert[0];
tess->xyz[baseVertex + j][1] = tempVert[1];
tess->xyz[baseVertex + j][2] = tempVert[2];
tess.normal[baseVertex + j][0] = tempNormal[0];
tess.normal[baseVertex + j][1] = tempNormal[1];
tess.normal[baseVertex + j][2] = tempNormal[2];
tess->normal[baseVertex + j][0] = tempNormal[0];
tess->normal[baseVertex + j][1] = tempNormal[1];
tess->normal[baseVertex + j][2] = tempNormal[2];
tess.texCoords[baseVertex + j][0][0] = v->texCoords[0];
tess.texCoords[baseVertex + j][0][1] = v->texCoords[1];
tess->texCoords[baseVertex + j][0][0] = v->texCoords[0];
tess->texCoords[baseVertex + j][0][1] = v->texCoords[1];
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 ) {
// we have to reset the shaderTime as well otherwise image animations start
// 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
R_RotateForEntity( backEnd.currentEntity, &backEnd.viewParms, &backEnd.or );
......@@ -567,7 +567,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) {
backEnd.or = backEnd.viewParms.world;
// we have to reset the shaderTime as well otherwise image animations on
// 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 );
}
......@@ -714,7 +714,7 @@ void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte *
}
R_IssuePendingRenderCommands();
if ( tess.numIndexes ) {
if ( tess->numIndexes ) {
RB_EndSurface();
}
......@@ -842,8 +842,8 @@ const void *RB_StretchPic ( const void *data ) {
}
shader = cmd->shader;
if ( shader != tess.shader ) {
if ( tess.numIndexes ) {
if ( shader != tess->shader ) {
if ( tess->numIndexes ) {
RB_EndSurface();
}
backEnd.currentEntity = &backEnd.entity2D;
......@@ -851,51 +851,51 @@ const void *RB_StretchPic ( const void *data ) {
}
RB_CHECKOVERFLOW( 4, 6 );
numVerts = tess.numVertexes;
numIndexes = tess.numIndexes;
numVerts = tess->numVertexes;
numIndexes = tess->numIndexes;
tess.numVertexes += 4;
tess.numIndexes += 6;
tess->numVertexes += 4;
tess->numIndexes += 6;
tess.indexes[ numIndexes ] = numVerts + 3;
tess.indexes[ numIndexes + 1 ] = numVerts + 0;
tess.indexes[ numIndexes + 2 ] = numVerts + 2;
tess.indexes[ numIndexes + 3 ] = numVerts + 2;
tess.indexes[ numIndexes + 4 ] = numVerts + 0;
tess.indexes[ numIndexes + 5 ] = numVerts + 1;
tess->indexes[ numIndexes ] = numVerts + 3;
tess->indexes[ numIndexes + 1 ] = numVerts + 0;
tess->indexes[ numIndexes + 2 ] = numVerts + 2;
tess->indexes[ numIndexes + 3 ] = numVerts + 2;
tess->indexes[ numIndexes + 4 ] = numVerts + 0;
tess->indexes[ numIndexes + 5 ] = numVerts + 1;
*(int *)tess.vertexColors[ numVerts ] =
*(int *)tess.vertexColors[ numVerts + 1 ] =
*(int *)tess.vertexColors[ numVerts + 2 ] =
*(int *)tess.vertexColors[ numVerts + 3 ] = *(int *)backEnd.color2D;
*(int *)tess->vertexColors[ numVerts ] =
*(int *)tess->vertexColors[ numVerts + 1 ] =
*(int *)tess->vertexColors[ numVerts + 2 ] =
*(int *)tess->vertexColors[ numVerts + 3 ] = *(int *)backEnd.color2D;
tess.xyz[ numVerts ][0] = cmd->x;
tess.xyz[ numVerts ][1] = cmd->y;
tess.xyz[ numVerts ][2] = 0;
tess->xyz[ numVerts ][0] = cmd->x;
tess->xyz[ numVerts ][1] = cmd->y;
tess->xyz[ numVerts ][2] = 0;
tess.texCoords[ numVerts ][0][0] = cmd->s1;
tess.texCoords[ numVerts ][0][1] = cmd->t1;
tess->texCoords[ numVerts ][0][0] = cmd->s1;
tess->texCoords[ numVerts ][0][1] = cmd->t1;
tess.xyz[ numVerts + 1 ][0] = cmd->x + cmd->w;
tess.xyz[ numVerts + 1 ][1] = cmd->y;
tess.xyz[ numVerts + 1 ][2] = 0;
tess->xyz[ numVerts + 1 ][0] = cmd->x + cmd->w;
tess->xyz[ numVerts + 1 ][1] = cmd->y;
tess->xyz[ numVerts + 1 ][2] = 0;
tess.texCoords[ numVerts + 1 ][0][0] = cmd->s2;
tess.texCoords[ numVerts + 1 ][0][1] = cmd->t1;
tess->texCoords[ numVerts + 1 ][0][0] = cmd->s2;
tess->texCoords[ numVerts + 1 ][0][1] = cmd->t1;
tess.xyz[ numVerts + 2 ][0] = cmd->x + cmd->w;
tess.xyz[ numVerts + 2 ][1] = cmd->y + cmd->h;
tess.xyz[ numVerts + 2 ][2] = 0;
tess->xyz[ numVerts + 2 ][0] = cmd->x + cmd->w;
tess->xyz[ numVerts + 2 ][1] = cmd->y + cmd->h;
tess->xyz[ numVerts + 2 ][2] = 0;
tess.texCoords[ numVerts + 2 ][0][0] = cmd->s2;
tess.texCoords[ numVerts + 2 ][0][1] = cmd->t2;
tess->texCoords[ numVerts + 2 ][0][0] = cmd->s2;
tess->texCoords[ numVerts + 2 ][0][1] = cmd->t2;
tess.xyz[ numVerts + 3 ][0] = cmd->x;
tess.xyz[ numVerts + 3 ][1] = cmd->y + cmd->h;
tess.xyz[ numVerts + 3 ][2] = 0;
tess->xyz[ numVerts + 3 ][0] = cmd->x;
tess->xyz[ numVerts + 3 ][1] = cmd->y + cmd->h;
tess->xyz[ numVerts + 3 ][2] = 0;
tess.texCoords[ numVerts + 3 ][0][0] = cmd->s1;
tess.texCoords[ numVerts + 3 ][0][1] = cmd->t2;
tess->texCoords[ numVerts + 3 ][0][0] = cmd->s1;
tess->texCoords[ numVerts + 3 ][0][1] = cmd->t2;
return (const void *)(cmd + 1);
}
......@@ -911,7 +911,7 @@ const void *RB_DrawSurfs( const void *data ) {
const drawSurfsCommand_t *cmd;
// finish any 2D drawing if needed
if ( tess.numIndexes ) {
if ( tess->numIndexes ) {
RB_EndSurface();
}
......@@ -1038,7 +1038,7 @@ const void *RB_ClearDepth(const void *data)
{
const clearDepthCommand_t *cmd = data;
if(tess.numIndexes)
if(tess->numIndexes)
RB_EndSurface();
// texture swapping test
......@@ -1060,7 +1060,7 @@ const void *RB_SwapBuffers( const void *data ) {
const swapBuffersCommand_t *cmd;
// finish any 2D drawing if needed
if ( tess.numIndexes ) {
if ( tess->numIndexes ) {
RB_EndSurface();
}
......
......@@ -372,9 +372,9 @@ void RB_RenderFlare( flare_t *f ) {
// Calculations for fogging
if(tr.world && f->fogNum > 0 && f->fogNum < tr.world->numfogs)
{
tess.numVertexes = 1;
VectorCopy(f->origin, tess.xyz[0]);
tess.fogNum = f->fogNum;
tess->numVertexes = 1;
VectorCopy(f->origin, tess->xyz[0]);
tess->fogNum = f->fogNum;
RB_CalcModulateColorsByFog(fogFactors);
......@@ -390,52 +390,52 @@ void RB_RenderFlare( flare_t *f ) {
RB_BeginSurface( tr.flareShader, f->fogNum );
// FIXME: use quadstamp?
tess.xyz[tess.numVertexes][0] = f->windowX - size;
tess.xyz[tess.numVertexes][1] = f->windowY - size;
tess.texCoords[tess.numVertexes][0][0] = 0;
tess.texCoords[tess.numVertexes][0][1] = 0;
tess.vertexColors[tess.numVertexes][0] = iColor[0];
tess.vertexColors[tess.numVertexes][1] = iColor[1];
tess.vertexColors[tess.numVertexes][2] = iColor[2];
tess.vertexColors[tess.numVertexes][3] = 255;
tess.numVertexes++;
tess.xyz[tess.numVertexes][0] = f->windowX - size;
tess.xyz[tess.numVertexes][1] = f->windowY + size;
tess.texCoords[tess.numVertexes][0][0] = 0;
tess.texCoords[tess.numVertexes][0][1] = 1;
tess.vertexColors[tess.numVertexes][0] = iColor[0];
tess.vertexColors[tess.numVertexes][1] = iColor[1];
tess.vertexColors[tess.numVertexes][2] = iColor[2];
tess.vertexColors[tess.numVertexes][3] = 255;
tess.numVertexes++;
tess.xyz[tess.numVertexes][0] = f->windowX + size;
tess.xyz[tess.numVertexes][1] = f->windowY + size;
tess.texCoords[tess.numVertexes][0][0] = 1;
tess.texCoords[tess.numVertexes][0][1] = 1;
tess.vertexColors[tess.numVertexes][0] = iColor[0];
tess.vertexColors[tess.numVertexes][1] = iColor[1];
tess.vertexColors[tess.numVertexes][2] = iColor[2];
tess.vertexColors[tess.numVertexes][3] = 255;
tess.numVertexes++;
tess.xyz[tess.numVertexes][0] = f->windowX + size;
tess.xyz[tess.numVertexes][1] = f->windowY - size;
tess.texCoords[tess.numVertexes][0][0] = 1;
tess.texCoords[tess.numVertexes][0][1] = 0;
tess.vertexColors[tess.numVertexes][0] = iColor[0];
tess.vertexColors[tess.numVertexes][1] = iColor[1];
tess.vertexColors[tess.numVertexes][2] = iColor[2];
tess.vertexColors[tess.numVertexes][3] = 255;
tess.numVertexes++;
tess.indexes[tess.numIndexes++] = 0;
tess.indexes[tess.numIndexes++] = 1;
tess.indexes[tess.numIndexes++] = 2;
tess.indexes[tess.numIndexes++] = 0;
tess.indexes[tess.numIndexes++] = 2;
tess.indexes[tess.numIndexes++] = 3;
tess->xyz[tess->numVertexes][0] = f->windowX - size;
tess->xyz[tess->numVertexes][1] = f->windowY - size;
tess->texCoords[tess->numVertexes][0][0] = 0;
tess->texCoords[tess->numVertexes][0][1] = 0;
tess->vertexColors[tess->numVertexes][0] = iColor[0];
tess->vertexColors[tess->numVertexes][1] = iColor[1];
tess->vertexColors[tess->numVertexes][2] = iColor[2];
tess->vertexColors[tess->numVertexes][3] = 255;
tess->numVertexes++;
tess->xyz[tess->numVertexes][0] = f->windowX - size;
tess->xyz[tess->numVertexes][1] = f->windowY + size;
tess->texCoords[tess->numVertexes][0][0] = 0;
tess->texCoords[tess->numVertexes][0][1] = 1;
tess->vertexColors[tess->numVertexes][0] = iColor[0];
tess->vertexColors[tess->numVertexes][1] = iColor[1];
tess->vertexColors[tess->numVertexes][2] = iColor[2];
tess->vertexColors[tess->numVertexes][3] = 255;
tess->numVertexes++;
tess->xyz[tess->numVertexes][0] = f->windowX + size;
tess->xyz[tess->numVertexes][1] = f->windowY + size;
tess->texCoords[tess->numVertexes][0][0] = 1;
tess->texCoords[tess->numVertexes][0][1] = 1;
tess->vertexColors[tess->numVertexes][0] = iColor[0];
tess->vertexColors[tess->numVertexes][1] = iColor[1];
tess->vertexColors[tess->numVertexes][2] = iColor[2];
tess->vertexColors[tess->numVertexes][3] = 255;
tess->numVertexes++;
tess->xyz[tess->numVertexes][0] = f->windowX + size;
tess->xyz[tess->numVertexes][1] = f->windowY - size;
tess->texCoords[tess->numVertexes][0][0] = 1;
tess->texCoords[tess->numVertexes][0][1] = 0;
tess->vertexColors[tess->numVertexes][0] = iColor[0];
tess->vertexColors[tess->numVertexes][1] = iColor[1];
tess->vertexColors[tess->numVertexes][2] = iColor[2];
tess->vertexColors[tess->numVertexes][3] = 255;
tess->numVertexes++;
tess->indexes[tess->numIndexes++] = 0;
tess->indexes[tess->numIndexes++] = 1;
tess->indexes[tess->numIndexes++] = 2;
tess->indexes[tess->numIndexes++] = 0;
tess->indexes[tess->numIndexes++] = 2;
tess->indexes[tess->numIndexes++] = 3;
RB_EndSurface();
}
......
......@@ -1188,6 +1188,8 @@ void R_Register( void )
ri.Cmd_AddCommand( "minimize", GLimp_Minimize );
}
shaderCommands_t *tess_pool[256];
/*
===============
R_Init
......@@ -1200,19 +1202,24 @@ void R_Init( void ) {
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
Com_Memset( &tr, 0, sizeof( tr ) );
Com_Memset( &backEnd, 0, sizeof( backEnd ) );
Com_Memset( &tess, 0, sizeof( tess ) );
Com_Memset( tess, 0, sizeof( shaderCommands_t ) );
if(sizeof(glconfig_t) != 11332)
ri.Error( ERR_FATAL, "Mod ABI incompatible: sizeof(glconfig_t) == %u != 11332", (unsigned int) sizeof(glconfig_t));
// Swap_Init();
if ( (intptr_t)tess.xyz & 15 ) {
ri.Printf( PRINT_WARNING, "tess.xyz not 16 byte aligned\n" );
if ( (intptr_t)tess->xyz & 15 ) {
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
......
......@@ -33,7 +33,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "../renderercommon/qgl.h"
#define GL_INDEX_TYPE GL_UNSIGNED_INT
typedef unsigned int glIndex_t;
typedef uint16_t glIndex_t;
// 14 bits
// can't be increased without changing bit packing for drawsurfs
......@@ -160,8 +160,8 @@ typedef enum {
CGEN_IDENTITY, // always (1,1,1,1)
CGEN_ENTITY, // grabbed from entity's modulate field
CGEN_ONE_MINUS_ENTITY, // grabbed from 1 - entity.modulate
CGEN_EXACT_VERTEX, // tess.vertexColors
CGEN_VERTEX, // tess.vertexColors * tr.identityLight
CGEN_EXACT_VERTEX, // tess->vertexColors
CGEN_VERTEX, // tess->vertexColors * tr.identityLight
CGEN_ONE_MINUS_VERTEX,
CGEN_WAVEFORM, // programmatically generated
CGEN_LIGHTING_DIFFUSE,
......@@ -1231,12 +1231,14 @@ typedef struct shaderCommands_s
shaderStage_t **xstages;
} 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_EndSurface(void);
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_StageIteratorSky( void );
......
......@@ -864,14 +864,14 @@ static qboolean SurfIsOffscreen( const drawSurf_t *drawSurf, vec4_t clipDest[128
RB_BeginSurface( shader, fogNum );
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;
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++ )
{
......@@ -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
// range to the surface), but it's good enough for the types of portals
// 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;
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
if ( len < shortest )
......@@ -914,7 +914,7 @@ static qboolean SurfIsOffscreen( const drawSurf_t *drawSurf, vec4_t clipDest[128
shortest = len;
}
if ( DotProduct( normal, tess.normal[tess.indexes[i]] ) >= 0 )
if ( DotProduct( normal, tess->normal[tess->indexes[i]] ) >= 0 )
{
numTriangles--;
}
......@@ -931,7 +931,7 @@ static qboolean SurfIsOffscreen( const drawSurf_t *drawSurf, vec4_t clipDest[128
return qfalse;
}
if ( shortest > (tess.shader->portalRange*tess.shader->portalRange) )
if ( shortest > (tess->shader->portalRange*tess->shader->portalRange) )
{
return qtrue;
}
......
......@@ -1035,10 +1035,10 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) {
RB_CHECKOVERFLOW( surf->num_vertexes, surf->num_triangles * 3 );
outXYZ = &tess.xyz[tess.numVertexes];
outNormal = &tess.normal[tess.numVertexes];
outTexCoord = &tess.texCoords[tess.numVertexes];
outColor = &tess.vertexColors[tess.numVertexes];
outXYZ = &tess->xyz[tess->numVertexes];
outNormal = &tess->normal[tess->numVertexes];
outTexCoord = &tess->texCoords[tess->numVertexes];
outColor = &tess->vertexColors[tess->numVertexes];
// compute interpolated joint matrices
if ( data->num_poses > 0 ) {
......@@ -1134,8 +1134,8 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) {
}
tri = data->triangles + 3 * surf->first_triangle;
ptr = &tess.indexes[tess.numIndexes];
base = tess.numVertexes;
ptr = &tess->indexes[tess->numIndexes];
base = tess->numVertexes;
for( i = 0; i < surf->num_triangles; i++ ) {
*ptr++ = base + (*tri++ - surf->first_vertex);
......@@ -1143,8 +1143,8 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) {
*ptr++ = base + (*tri++ - surf->first_vertex);
}
tess.numIndexes += 3 * surf->num_triangles;
tess.numVertexes += surf->num_vertexes;
tess->numIndexes += 3 * surf->num_triangles;
tess->numVertexes += surf->num_vertexes;
}
int R_IQMLerpTag( orientation_t *tag, iqmData_t *data,
......
This diff is collapsed.
......@@ -23,7 +23,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "tr_local.h"
#define WAVEVALUE( table, base, amplitude, phase, freq ) ((base) + table[ ( (int64_t) ( ( (phase) + tess.shaderTime * (freq) ) * FUNCTABLE_SIZE ) ) & FUNCTABLE_MASK ] * (amplitude))
#define WAVEVALUE( table, base, amplitude, phase, freq ) ((base) + table[ ( (int64_t) ( ( (phase) + tess->shaderTime * (freq) ) * FUNCTABLE_SIZE ) ) & FUNCTABLE_MASK ] * (amplitude))
static float *TableForFunc( genFunc_t func )
{
......@@ -44,7 +44,7 @@ static float *TableForFunc( genFunc_t func )
break;
}
ri.Error( ERR_DROP, "TableForFunc called with invalid function '%d' in shader '%s'", func, tess.shader->name );
ri.Error( ERR_DROP, "TableForFunc called with invalid function '%d' in shader '%s'", func, tess->shader->name );
return NULL;
}
......@@ -119,15 +119,15 @@ void RB_CalcDeformVertexes( deformStage_t *ds )
int i;
vec3_t offset;
float scale;
float *xyz = ( float * ) tess.xyz;
float *normal = ( float * ) tess.normal;
float *xyz = ( float * ) tess->xyz;
float *normal = ( float * ) tess->normal;
float *table;
if ( ds->deformationWave.frequency == 0 )
{
scale = EvalWaveForm( &ds->deformationWave );
for ( i = 0; i < tess.numVertexes; i++, xyz += 4, normal += 4 )
for ( i = 0; i < tess->numVertexes; i++, xyz += 4, normal += 4 )
{
VectorScale( normal, scale, offset );
......@@ -140,7 +140,7 @@ void RB_CalcDeformVertexes( deformStage_t *ds )
{
table = TableForFunc( ds->deformationWave.func );
for ( i = 0; i < tess.numVertexes; i++, xyz += 4, normal += 4 )
for ( i = 0; i < tess->numVertexes; i++, xyz += 4, normal += 4 )
{
float off = ( xyz[0] + xyz[1] + xyz[2] ) * ds->deformationSpread;
......@@ -168,23 +168,23 @@ Wiggle the normals for wavy environment mapping
void RB_CalcDeformNormals( deformStage_t *ds ) {
int i;
float scale;
float *xyz = ( float * ) tess.xyz;
float *normal = ( float * ) tess.normal;
float *xyz = ( float * ) tess->xyz;
float *normal = ( float * ) tess->normal;
for ( i = 0; i < tess.numVertexes; i++, xyz += 4, normal += 4 ) {
for ( i = 0; i < tess->numVertexes; i++, xyz += 4, normal += 4 ) {
scale = 0.98f;
scale = R_NoiseGet4f( xyz[0] * scale, xyz[1] * scale, xyz[2] * scale,
tess.shaderTime * ds->deformationWave.frequency );
tess->shaderTime * ds->deformationWave.frequency );
normal[ 0 ] += ds->deformationWave.amplitude * scale;
scale = 0.98f;
scale = R_NoiseGet4f( 100 + xyz[0] * scale, xyz[1] * scale, xyz[2] * scale,
tess.shaderTime * ds->deformationWave.frequency );
tess->shaderTime * ds->deformationWave.frequency );
normal[ 1 ] += ds->deformationWave.amplitude * scale;
scale = 0.98f;
scale = R_NoiseGet4f( 200 + xyz[0] * scale, xyz[1] * scale, xyz[2] * scale,
tess.shaderTime * ds->deformationWave.frequency );
tess->shaderTime * ds->deformationWave.frequency );
normal[ 2 ] += ds->deformationWave.amplitude * scale;
VectorNormalizeFast( normal );
......@@ -199,14 +199,14 @@ RB_CalcBulgeVertexes
*/
void RB_CalcBulgeVertexes( deformStage_t *ds ) {
int i;
const float *st = ( const float * ) tess.texCoords[0];
float *xyz = ( float * ) tess.xyz;
float *normal = ( float * ) tess.normal;
const float *st = ( const float * ) tess->texCoords[0];
float *xyz = ( float * ) tess->xyz;
float *normal = ( float * ) tess->normal;
double now;