mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-10 23:02:01 +00:00
OpenGL2: Don't interleave texCoords and lightCoords in tess.
This commit is contained in:
parent
1c1e1f61f1
commit
2349ef038e
9 changed files with 74 additions and 84 deletions
|
@ -414,8 +414,8 @@ void RB_MDRSurfaceAnim( mdrSurface_t *surface )
|
|||
|
||||
R_VaoPackNormal(tess.normal[baseVertex + j], tempNormal);
|
||||
|
||||
tess.texCoords[baseVertex + j][0][0] = v->texCoords[0];
|
||||
tess.texCoords[baseVertex + j][0][1] = v->texCoords[1];
|
||||
tess.texCoords[baseVertex + j][0] = v->texCoords[0];
|
||||
tess.texCoords[baseVertex + j][1] = v->texCoords[1];
|
||||
|
||||
v = (mdrVertex_t *)&v->weights[v->numWeights];
|
||||
}
|
||||
|
|
|
@ -895,29 +895,29 @@ const void *RB_StretchPic ( const void *data ) {
|
|||
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] = cmd->s1;
|
||||
tess.texCoords[ numVerts ][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.texCoords[ numVerts + 1 ][0][0] = cmd->s2;
|
||||
tess.texCoords[ numVerts + 1 ][0][1] = cmd->t1;
|
||||
tess.texCoords[ numVerts + 1 ][0] = cmd->s2;
|
||||
tess.texCoords[ numVerts + 1 ][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.texCoords[ numVerts + 2 ][0][0] = cmd->s2;
|
||||
tess.texCoords[ numVerts + 2 ][0][1] = cmd->t2;
|
||||
tess.texCoords[ numVerts + 2 ][0] = cmd->s2;
|
||||
tess.texCoords[ numVerts + 2 ][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.texCoords[ numVerts + 3 ][0][0] = cmd->s1;
|
||||
tess.texCoords[ numVerts + 3 ][0][1] = cmd->t2;
|
||||
tess.texCoords[ numVerts + 3 ][0] = cmd->s1;
|
||||
tess.texCoords[ numVerts + 3 ][1] = cmd->t2;
|
||||
|
||||
return (const void *)(cmd + 1);
|
||||
}
|
||||
|
|
|
@ -404,8 +404,8 @@ void RB_RenderFlare( flare_t *f ) {
|
|||
// 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.texCoords[tess.numVertexes][0] = 0;
|
||||
tess.texCoords[tess.numVertexes][1] = 0;
|
||||
tess.color[tess.numVertexes][0] = iColor[0];
|
||||
tess.color[tess.numVertexes][1] = iColor[1];
|
||||
tess.color[tess.numVertexes][2] = iColor[2];
|
||||
|
@ -414,8 +414,8 @@ void RB_RenderFlare( flare_t *f ) {
|
|||
|
||||
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.texCoords[tess.numVertexes][0] = 0;
|
||||
tess.texCoords[tess.numVertexes][1] = 1;
|
||||
tess.color[tess.numVertexes][0] = iColor[0];
|
||||
tess.color[tess.numVertexes][1] = iColor[1];
|
||||
tess.color[tess.numVertexes][2] = iColor[2];
|
||||
|
@ -424,8 +424,8 @@ void RB_RenderFlare( flare_t *f ) {
|
|||
|
||||
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.texCoords[tess.numVertexes][0] = 1;
|
||||
tess.texCoords[tess.numVertexes][1] = 1;
|
||||
tess.color[tess.numVertexes][0] = iColor[0];
|
||||
tess.color[tess.numVertexes][1] = iColor[1];
|
||||
tess.color[tess.numVertexes][2] = iColor[2];
|
||||
|
@ -434,8 +434,8 @@ void RB_RenderFlare( flare_t *f ) {
|
|||
|
||||
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.texCoords[tess.numVertexes][0] = 1;
|
||||
tess.texCoords[tess.numVertexes][1] = 0;
|
||||
tess.color[tess.numVertexes][0] = iColor[0];
|
||||
tess.color[tess.numVertexes][1] = iColor[1];
|
||||
tess.color[tess.numVertexes][2] = iColor[2];
|
||||
|
|
|
@ -1983,7 +1983,8 @@ typedef struct shaderCommands_s
|
|||
vec4_t xyz[SHADER_MAX_VERTEXES] QALIGN(16);
|
||||
int16_t normal[SHADER_MAX_VERTEXES][4] QALIGN(16);
|
||||
int16_t tangent[SHADER_MAX_VERTEXES][4] QALIGN(16);
|
||||
vec2_t texCoords[SHADER_MAX_VERTEXES][2] QALIGN(16);
|
||||
vec2_t texCoords[SHADER_MAX_VERTEXES] QALIGN(16);
|
||||
vec2_t lightCoords[SHADER_MAX_VERTEXES] QALIGN(16);
|
||||
uint16_t color[SHADER_MAX_VERTEXES][4] QALIGN(16);
|
||||
int16_t lightdir[SHADER_MAX_VERTEXES][4] QALIGN(16);
|
||||
//int vertexDlightBits[SHADER_MAX_VERTEXES] QALIGN(16);
|
||||
|
|
|
@ -1026,7 +1026,7 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) {
|
|||
vec4_t *outXYZ;
|
||||
int16_t *outNormal;
|
||||
int16_t *outTangent;
|
||||
vec2_t (*outTexCoord)[2];
|
||||
vec2_t *outTexCoord;
|
||||
uint16_t *outColor;
|
||||
|
||||
int frame = data->num_frames ? backEnd.currentEntity->e.frame % data->num_frames : 0;
|
||||
|
@ -1096,10 +1096,8 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) {
|
|||
nrmMat[ 7] = vtxMat[ 2]*vtxMat[ 4] - vtxMat[ 0]*vtxMat[ 6];
|
||||
nrmMat[ 8] = vtxMat[ 0]*vtxMat[ 5] - vtxMat[ 1]*vtxMat[ 4];
|
||||
|
||||
(*outTexCoord)[0][0] = data->texcoords[2*vtx + 0];
|
||||
(*outTexCoord)[0][1] = data->texcoords[2*vtx + 1];
|
||||
(*outTexCoord)[1][0] = (*outTexCoord)[0][0];
|
||||
(*outTexCoord)[1][1] = (*outTexCoord)[0][1];
|
||||
(*outTexCoord)[0] = data->texcoords[2*vtx + 0];
|
||||
(*outTexCoord)[1] = data->texcoords[2*vtx + 1];
|
||||
|
||||
(*outXYZ)[0] =
|
||||
vtxMat[ 0] * data->positions[3*vtx+0] +
|
||||
|
|
|
@ -208,7 +208,7 @@ void RB_CalcBulgeVertexes( deformStage_t *ds ) {
|
|||
|
||||
now = backEnd.refdef.time * ds->bulgeSpeed * 0.001f;
|
||||
|
||||
for ( i = 0; i < tess.numVertexes; i++, xyz += 4, st += 4, normal += 4 ) {
|
||||
for ( i = 0; i < tess.numVertexes; i++, xyz += 4, st += 2, normal += 4 ) {
|
||||
int off;
|
||||
float scale;
|
||||
vec3_t fNormal;
|
||||
|
|
|
@ -386,8 +386,8 @@ static void DrawSkySide( struct image_s *image, const int mins[2], const int max
|
|||
tess.xyz[tess.numVertexes][2] = s_skyPoints[t][s][2];
|
||||
tess.xyz[tess.numVertexes][3] = 1.0;
|
||||
|
||||
tess.texCoords[tess.numVertexes][0][0] = s_skyTexCoords[t][s][0];
|
||||
tess.texCoords[tess.numVertexes][0][1] = s_skyTexCoords[t][s][1];
|
||||
tess.texCoords[tess.numVertexes][0] = s_skyTexCoords[t][s][0];
|
||||
tess.texCoords[tess.numVertexes][1] = s_skyTexCoords[t][s][1];
|
||||
|
||||
tess.numVertexes++;
|
||||
|
||||
|
@ -563,8 +563,8 @@ static void FillCloudySkySide( const int mins[2], const int maxs[2], qboolean ad
|
|||
for ( s = mins[0]+HALF_SKY_SUBDIVISIONS; s <= maxs[0]+HALF_SKY_SUBDIVISIONS; s++ )
|
||||
{
|
||||
VectorAdd( s_skyPoints[t][s], backEnd.viewParms.or.origin, tess.xyz[tess.numVertexes] );
|
||||
tess.texCoords[tess.numVertexes][0][0] = s_skyTexCoords[t][s][0];
|
||||
tess.texCoords[tess.numVertexes][0][1] = s_skyTexCoords[t][s][1];
|
||||
tess.texCoords[tess.numVertexes][0] = s_skyTexCoords[t][s][0];
|
||||
tess.texCoords[tess.numVertexes][1] = s_skyTexCoords[t][s][1];
|
||||
|
||||
tess.numVertexes++;
|
||||
|
||||
|
|
|
@ -135,17 +135,17 @@ void RB_AddQuadStampExt( vec3_t origin, vec3_t left, vec3_t up, float color[4],
|
|||
VectorCopy4(iNormal, tess.normal[ndx + 3]);
|
||||
|
||||
// standard square texture coordinates
|
||||
VectorSet2(tess.texCoords[ndx ][0], s1, t1);
|
||||
VectorSet2(tess.texCoords[ndx ][1], s1, t1);
|
||||
VectorSet2(tess.texCoords[ndx], s1, t1);
|
||||
VectorSet2(tess.lightCoords[ndx], s1, t1);
|
||||
|
||||
VectorSet2(tess.texCoords[ndx+1][0], s2, t1);
|
||||
VectorSet2(tess.texCoords[ndx+1][1], s2, t1);
|
||||
VectorSet2(tess.texCoords[ndx+1], s2, t1);
|
||||
VectorSet2(tess.lightCoords[ndx+1], s2, t1);
|
||||
|
||||
VectorSet2(tess.texCoords[ndx+2][0], s2, t2);
|
||||
VectorSet2(tess.texCoords[ndx+2][1], s2, t2);
|
||||
VectorSet2(tess.texCoords[ndx+2], s2, t2);
|
||||
VectorSet2(tess.lightCoords[ndx+2], s2, t2);
|
||||
|
||||
VectorSet2(tess.texCoords[ndx+3][0], s1, t2);
|
||||
VectorSet2(tess.texCoords[ndx+3][1], s1, t2);
|
||||
VectorSet2(tess.texCoords[ndx+3], s1, t2);
|
||||
VectorSet2(tess.lightCoords[ndx+3], s1, t2);
|
||||
|
||||
// constant color all the way around
|
||||
// should this be identity and let the shader specify from entity?
|
||||
|
@ -187,19 +187,19 @@ void RB_InstantQuad2(vec4_t quadVerts[4], vec2_t texCoords[4])
|
|||
tess.firstIndex = 0;
|
||||
|
||||
VectorCopy4(quadVerts[0], tess.xyz[tess.numVertexes]);
|
||||
VectorCopy2(texCoords[0], tess.texCoords[tess.numVertexes][0]);
|
||||
VectorCopy2(texCoords[0], tess.texCoords[tess.numVertexes]);
|
||||
tess.numVertexes++;
|
||||
|
||||
VectorCopy4(quadVerts[1], tess.xyz[tess.numVertexes]);
|
||||
VectorCopy2(texCoords[1], tess.texCoords[tess.numVertexes][0]);
|
||||
VectorCopy2(texCoords[1], tess.texCoords[tess.numVertexes]);
|
||||
tess.numVertexes++;
|
||||
|
||||
VectorCopy4(quadVerts[2], tess.xyz[tess.numVertexes]);
|
||||
VectorCopy2(texCoords[2], tess.texCoords[tess.numVertexes][0]);
|
||||
VectorCopy2(texCoords[2], tess.texCoords[tess.numVertexes]);
|
||||
tess.numVertexes++;
|
||||
|
||||
VectorCopy4(quadVerts[3], tess.xyz[tess.numVertexes]);
|
||||
VectorCopy2(texCoords[3], tess.texCoords[tess.numVertexes][0]);
|
||||
VectorCopy2(texCoords[3], tess.texCoords[tess.numVertexes]);
|
||||
tess.numVertexes++;
|
||||
|
||||
tess.indexes[tess.numIndexes++] = 0;
|
||||
|
@ -298,8 +298,8 @@ static void RB_SurfacePolychain( srfPoly_t *p ) {
|
|||
numv = tess.numVertexes;
|
||||
for ( i = 0; i < p->numVerts; i++ ) {
|
||||
VectorCopy( p->verts[i].xyz, tess.xyz[numv] );
|
||||
tess.texCoords[numv][0][0] = p->verts[i].st[0];
|
||||
tess.texCoords[numv][0][1] = p->verts[i].st[1];
|
||||
tess.texCoords[numv][0] = p->verts[i].st[0];
|
||||
tess.texCoords[numv][1] = p->verts[i].st[1];
|
||||
tess.color[numv][0] = (int)p->verts[i].modulate[0] * 257;
|
||||
tess.color[numv][1] = (int)p->verts[i].modulate[1] * 257;
|
||||
tess.color[numv][2] = (int)p->verts[i].modulate[2] * 257;
|
||||
|
@ -369,16 +369,16 @@ static void RB_SurfaceVertsAndIndexes( int numVerts, srfVert_t *verts, int numIn
|
|||
if ( tess.shader->vertexAttribs & ATTR_TEXCOORD )
|
||||
{
|
||||
dv = verts;
|
||||
texCoords = tess.texCoords[ tess.numVertexes ][0];
|
||||
for ( i = 0 ; i < numVerts ; i++, dv++, texCoords+=4 )
|
||||
texCoords = tess.texCoords[tess.numVertexes];
|
||||
for ( i = 0 ; i < numVerts ; i++, dv++, texCoords+=2 )
|
||||
VectorCopy2(dv->st, texCoords);
|
||||
}
|
||||
|
||||
if ( tess.shader->vertexAttribs & ATTR_LIGHTCOORD )
|
||||
{
|
||||
dv = verts;
|
||||
lightCoords = tess.texCoords[ tess.numVertexes ][1];
|
||||
for ( i = 0 ; i < numVerts ; i++, dv++, lightCoords+=4 )
|
||||
lightCoords = tess.lightCoords[ tess.numVertexes ];
|
||||
for ( i = 0 ; i < numVerts ; i++, dv++, lightCoords+=2 )
|
||||
VectorCopy2(dv->lightmap, lightCoords);
|
||||
}
|
||||
|
||||
|
@ -641,16 +641,16 @@ static void DoRailCore( const vec3_t start, const vec3_t end, const vec3_t up, f
|
|||
|
||||
// FIXME: use quad stamp?
|
||||
VectorMA( start, spanWidth, up, tess.xyz[tess.numVertexes] );
|
||||
tess.texCoords[tess.numVertexes][0][0] = 0;
|
||||
tess.texCoords[tess.numVertexes][0][1] = 0;
|
||||
tess.texCoords[tess.numVertexes][0] = 0;
|
||||
tess.texCoords[tess.numVertexes][1] = 0;
|
||||
tess.color[tess.numVertexes][0] = backEnd.currentEntity->e.shaderRGBA[0] * 0.25f * 257.0f;
|
||||
tess.color[tess.numVertexes][1] = backEnd.currentEntity->e.shaderRGBA[1] * 0.25f * 257.0f;
|
||||
tess.color[tess.numVertexes][2] = backEnd.currentEntity->e.shaderRGBA[2] * 0.25f * 257.0f;
|
||||
tess.numVertexes++;
|
||||
|
||||
VectorMA( start, spanWidth2, up, tess.xyz[tess.numVertexes] );
|
||||
tess.texCoords[tess.numVertexes][0][0] = 0;
|
||||
tess.texCoords[tess.numVertexes][0][1] = 1;
|
||||
tess.texCoords[tess.numVertexes][0] = 0;
|
||||
tess.texCoords[tess.numVertexes][1] = 1;
|
||||
tess.color[tess.numVertexes][0] = backEnd.currentEntity->e.shaderRGBA[0] * 257;
|
||||
tess.color[tess.numVertexes][1] = backEnd.currentEntity->e.shaderRGBA[1] * 257;
|
||||
tess.color[tess.numVertexes][2] = backEnd.currentEntity->e.shaderRGBA[2] * 257;
|
||||
|
@ -658,16 +658,16 @@ static void DoRailCore( const vec3_t start, const vec3_t end, const vec3_t up, f
|
|||
|
||||
VectorMA( end, spanWidth, up, tess.xyz[tess.numVertexes] );
|
||||
|
||||
tess.texCoords[tess.numVertexes][0][0] = t;
|
||||
tess.texCoords[tess.numVertexes][0][1] = 0;
|
||||
tess.texCoords[tess.numVertexes][0] = t;
|
||||
tess.texCoords[tess.numVertexes][1] = 0;
|
||||
tess.color[tess.numVertexes][0] = backEnd.currentEntity->e.shaderRGBA[0] * 257;
|
||||
tess.color[tess.numVertexes][1] = backEnd.currentEntity->e.shaderRGBA[1] * 257;
|
||||
tess.color[tess.numVertexes][2] = backEnd.currentEntity->e.shaderRGBA[2] * 257;
|
||||
tess.numVertexes++;
|
||||
|
||||
VectorMA( end, spanWidth2, up, tess.xyz[tess.numVertexes] );
|
||||
tess.texCoords[tess.numVertexes][0][0] = t;
|
||||
tess.texCoords[tess.numVertexes][0][1] = 1;
|
||||
tess.texCoords[tess.numVertexes][0] = t;
|
||||
tess.texCoords[tess.numVertexes][1] = 1;
|
||||
tess.color[tess.numVertexes][0] = backEnd.currentEntity->e.shaderRGBA[0] * 257;
|
||||
tess.color[tess.numVertexes][1] = backEnd.currentEntity->e.shaderRGBA[1] * 257;
|
||||
tess.color[tess.numVertexes][2] = backEnd.currentEntity->e.shaderRGBA[2] * 257;
|
||||
|
@ -725,8 +725,8 @@ static void DoRailDiscs( int numSegs, const vec3_t start, const vec3_t dir, cons
|
|||
for ( j = 0; j < 4; j++ )
|
||||
{
|
||||
VectorCopy( pos[j], tess.xyz[tess.numVertexes] );
|
||||
tess.texCoords[tess.numVertexes][0][0] = ( j < 2 );
|
||||
tess.texCoords[tess.numVertexes][0][1] = ( j && j != 3 );
|
||||
tess.texCoords[tess.numVertexes][0] = (j < 2);
|
||||
tess.texCoords[tess.numVertexes][1] = (j && j != 3);
|
||||
tess.color[tess.numVertexes][0] = backEnd.currentEntity->e.shaderRGBA[0] * 257;
|
||||
tess.color[tess.numVertexes][1] = backEnd.currentEntity->e.shaderRGBA[1] * 257;
|
||||
tess.color[tess.numVertexes][2] = backEnd.currentEntity->e.shaderRGBA[2] * 257;
|
||||
|
@ -944,8 +944,8 @@ static void RB_SurfaceMesh(mdvSurface_t *surface) {
|
|||
|
||||
numVerts = surface->numVerts;
|
||||
for ( j = 0; j < numVerts; j++ ) {
|
||||
tess.texCoords[Doug + j][0][0] = texCoords[j].st[0];
|
||||
tess.texCoords[Doug + j][0][1] = texCoords[j].st[1];
|
||||
tess.texCoords[Doug + j][0] = texCoords[j].st[0];
|
||||
tess.texCoords[Doug + j][1] = texCoords[j].st[1];
|
||||
// FIXME: fill in lightmapST for completeness?
|
||||
}
|
||||
|
||||
|
@ -1102,8 +1102,8 @@ static void RB_SurfaceGrid( srfBspSurface_t *srf ) {
|
|||
xyz = tess.xyz[numVertexes];
|
||||
normal = tess.normal[numVertexes];
|
||||
tangent = tess.tangent[numVertexes];
|
||||
texCoords = tess.texCoords[numVertexes][0];
|
||||
lightCoords = tess.texCoords[numVertexes][1];
|
||||
texCoords = tess.texCoords[numVertexes];
|
||||
lightCoords = tess.lightCoords[numVertexes];
|
||||
color = tess.color[numVertexes];
|
||||
lightdir = tess.lightdir[numVertexes];
|
||||
//vDlightBits = &tess.vertexDlightBits[numVertexes];
|
||||
|
@ -1134,13 +1134,13 @@ static void RB_SurfaceGrid( srfBspSurface_t *srf ) {
|
|||
if ( tess.shader->vertexAttribs & ATTR_TEXCOORD )
|
||||
{
|
||||
VectorCopy2(dv->st, texCoords);
|
||||
texCoords += 4;
|
||||
texCoords += 2;
|
||||
}
|
||||
|
||||
if ( tess.shader->vertexAttribs & ATTR_LIGHTCOORD )
|
||||
{
|
||||
VectorCopy2(dv->lightmap, lightCoords);
|
||||
lightCoords += 4;
|
||||
lightCoords += 2;
|
||||
}
|
||||
|
||||
if ( tess.shader->vertexAttribs & ATTR_COLOR )
|
||||
|
|
|
@ -428,7 +428,8 @@ void R_InitVaos(void)
|
|||
vertexesSize += sizeof(tess.normal[0]);
|
||||
vertexesSize += sizeof(tess.tangent[0]);
|
||||
vertexesSize += sizeof(tess.color[0]);
|
||||
vertexesSize += sizeof(tess.texCoords[0][0]) * 2;
|
||||
vertexesSize += sizeof(tess.texCoords[0]);
|
||||
vertexesSize += sizeof(tess.lightCoords[0]);
|
||||
vertexesSize += sizeof(tess.lightdir[0]);
|
||||
vertexesSize *= SHADER_MAX_VERTEXES;
|
||||
|
||||
|
@ -470,29 +471,27 @@ void R_InitVaos(void)
|
|||
tess.vao->attribs[ATTR_INDEX_COLOR ].normalized = GL_TRUE;
|
||||
tess.vao->attribs[ATTR_INDEX_LIGHTDIRECTION].normalized = GL_TRUE;
|
||||
|
||||
tess.vao->attribs[ATTR_INDEX_POSITION ].offset = offset; offset += sizeof(tess.xyz[0]) * SHADER_MAX_VERTEXES;
|
||||
tess.vao->attribs[ATTR_INDEX_NORMAL ].offset = offset; offset += sizeof(tess.normal[0]) * SHADER_MAX_VERTEXES;
|
||||
tess.vao->attribs[ATTR_INDEX_TANGENT ].offset = offset; offset += sizeof(tess.tangent[0]) * SHADER_MAX_VERTEXES;
|
||||
// these next two are actually interleaved
|
||||
tess.vao->attribs[ATTR_INDEX_TEXCOORD ].offset = offset;
|
||||
tess.vao->attribs[ATTR_INDEX_LIGHTCOORD ].offset = offset + sizeof(tess.texCoords[0][0]);
|
||||
offset += sizeof(tess.texCoords[0][0]) * 2 * SHADER_MAX_VERTEXES;
|
||||
|
||||
tess.vao->attribs[ATTR_INDEX_COLOR ].offset = offset; offset += sizeof(tess.color[0]) * SHADER_MAX_VERTEXES;
|
||||
tess.vao->attribs[ATTR_INDEX_POSITION ].offset = offset; offset += sizeof(tess.xyz[0]) * SHADER_MAX_VERTEXES;
|
||||
tess.vao->attribs[ATTR_INDEX_NORMAL ].offset = offset; offset += sizeof(tess.normal[0]) * SHADER_MAX_VERTEXES;
|
||||
tess.vao->attribs[ATTR_INDEX_TANGENT ].offset = offset; offset += sizeof(tess.tangent[0]) * SHADER_MAX_VERTEXES;
|
||||
tess.vao->attribs[ATTR_INDEX_TEXCOORD ].offset = offset; offset += sizeof(tess.texCoords[0]) * SHADER_MAX_VERTEXES;
|
||||
tess.vao->attribs[ATTR_INDEX_LIGHTCOORD ].offset = offset; offset += sizeof(tess.lightCoords[0]) * SHADER_MAX_VERTEXES;
|
||||
tess.vao->attribs[ATTR_INDEX_COLOR ].offset = offset; offset += sizeof(tess.color[0]) * SHADER_MAX_VERTEXES;
|
||||
tess.vao->attribs[ATTR_INDEX_LIGHTDIRECTION].offset = offset;
|
||||
|
||||
tess.vao->attribs[ATTR_INDEX_POSITION ].stride = sizeof(tess.xyz[0]);
|
||||
tess.vao->attribs[ATTR_INDEX_NORMAL ].stride = sizeof(tess.normal[0]);
|
||||
tess.vao->attribs[ATTR_INDEX_TANGENT ].stride = sizeof(tess.tangent[0]);
|
||||
tess.vao->attribs[ATTR_INDEX_TEXCOORD ].stride = sizeof(tess.texCoords[0]);
|
||||
tess.vao->attribs[ATTR_INDEX_LIGHTCOORD ].stride = sizeof(tess.lightCoords[0]);
|
||||
tess.vao->attribs[ATTR_INDEX_COLOR ].stride = sizeof(tess.color[0]);
|
||||
tess.vao->attribs[ATTR_INDEX_TEXCOORD ].stride = sizeof(tess.texCoords[0][0]) * 2;
|
||||
tess.vao->attribs[ATTR_INDEX_LIGHTCOORD ].stride = sizeof(tess.texCoords[0][0]) * 2;
|
||||
tess.vao->attribs[ATTR_INDEX_LIGHTDIRECTION].stride = sizeof(tess.lightdir[0]);
|
||||
|
||||
tess.attribPointers[ATTR_INDEX_POSITION] = tess.xyz;
|
||||
tess.attribPointers[ATTR_INDEX_TEXCOORD] = tess.texCoords;
|
||||
tess.attribPointers[ATTR_INDEX_NORMAL] = tess.normal;
|
||||
tess.attribPointers[ATTR_INDEX_TANGENT] = tess.tangent;
|
||||
tess.attribPointers[ATTR_INDEX_TEXCOORD] = tess.texCoords;
|
||||
tess.attribPointers[ATTR_INDEX_LIGHTCOORD] = tess.lightCoords;
|
||||
tess.attribPointers[ATTR_INDEX_COLOR] = tess.color;
|
||||
tess.attribPointers[ATTR_INDEX_LIGHTDIRECTION] = tess.lightdir;
|
||||
|
||||
|
@ -613,14 +612,6 @@ void RB_UpdateTessVao(unsigned int attribBits)
|
|||
|
||||
attribUpload = attribBits;
|
||||
|
||||
if((attribUpload & ATTR_TEXCOORD) || (attribUpload & ATTR_LIGHTCOORD))
|
||||
{
|
||||
// these are interleaved, so we update both if either need it
|
||||
// this translates to updating ATTR_TEXCOORD twice as large as it needs
|
||||
attribUpload &= ~ATTR_LIGHTCOORD;
|
||||
attribUpload |= ATTR_TEXCOORD;
|
||||
}
|
||||
|
||||
for (attribIndex = 0; attribIndex < ATTR_INDEX_COUNT; attribIndex++)
|
||||
{
|
||||
uint32_t attribBit = 1 << attribIndex;
|
||||
|
|
Loading…
Reference in a new issue