OpenGL2: Remove per fragment tangent space calculation code.

This commit is contained in:
SmileTheory 2016-09-14 03:57:51 -07:00
parent 4faf1008a0
commit 8749d62bbd
13 changed files with 5 additions and 130 deletions

View file

@ -53,14 +53,9 @@ varying vec4 var_ColorAmbient;
#endif
#if (defined(USE_LIGHT) && !defined(USE_FAST_LIGHT))
#if defined(USE_VERT_TANGENT_SPACE)
varying vec4 var_Normal;
varying vec4 var_Tangent;
varying vec4 var_Bitangent;
#else
varying vec3 var_Normal;
varying vec3 var_ViewDir;
#endif
#endif
#if defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
@ -196,25 +191,6 @@ float CalcLightAttenuation(float point, float normDist)
return attenuation;
}
// from http://www.thetenthplanet.de/archives/1180
mat3 cotangent_frame( vec3 N, vec3 p, vec2 uv )
{
// get edge vectors of the pixel triangle
vec3 dp1 = dFdx( p );
vec3 dp2 = dFdy( p );
vec2 duv1 = dFdx( uv );
vec2 duv2 = dFdy( uv );
// solve the linear system
vec3 dp2perp = cross( dp2, N );
vec3 dp1perp = cross( N, dp1 );
vec3 T = dp2perp * duv1.x + dp1perp * duv2.x;
vec3 B = dp2perp * duv1.y + dp1perp * duv2.y;
// construct a scale-invariant frame
float invmax = inversesqrt( max( dot(T,T), dot(B,B) ) );
return mat3( T * invmax, B * invmax, N );
}
void main()
{
@ -223,13 +199,8 @@ void main()
float NL, NH, NE, EH, attenuation;
#if defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
#if defined(USE_VERT_TANGENT_SPACE)
mat3 tangentToWorld = mat3(var_Tangent.xyz, var_Bitangent.xyz, var_Normal.xyz);
viewDir = vec3(var_Normal.w, var_Tangent.w, var_Bitangent.w);
#else
mat3 tangentToWorld = cotangent_frame(var_Normal, -var_ViewDir, var_TexCoords.xy);
viewDir = var_ViewDir;
#endif
E = normalize(viewDir);
#endif

View file

@ -6,16 +6,12 @@ attribute vec4 attr_Color;
attribute vec3 attr_Position;
attribute vec3 attr_Normal;
#if defined(USE_VERT_TANGENT_SPACE)
attribute vec4 attr_Tangent;
#endif
#if defined(USE_VERTEX_ANIMATION)
attribute vec3 attr_Position2;
attribute vec3 attr_Normal2;
#if defined(USE_VERT_TANGENT_SPACE)
attribute vec4 attr_Tangent2;
#endif
#endif
#if defined(USE_LIGHT) && !defined(USE_LIGHT_VECTOR)
@ -74,14 +70,9 @@ varying vec4 var_ColorAmbient;
#endif
#if defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
#if defined(USE_VERT_TANGENT_SPACE)
varying vec4 var_Normal;
varying vec4 var_Tangent;
varying vec4 var_Bitangent;
#else
varying vec3 var_Normal;
varying vec3 var_ViewDir;
#endif
#endif
#if defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
@ -157,13 +148,13 @@ void main()
#if defined(USE_VERTEX_ANIMATION)
vec3 position = mix(attr_Position, attr_Position2, u_VertexLerp);
vec3 normal = mix(attr_Normal, attr_Normal2, u_VertexLerp);
#if defined(USE_VERT_TANGENT_SPACE) && defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
#if defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
vec3 tangent = mix(attr_Tangent.xyz, attr_Tangent2.xyz, u_VertexLerp);
#endif
#else
vec3 position = attr_Position;
vec3 normal = attr_Normal;
#if defined(USE_VERT_TANGENT_SPACE) && defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
#if defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
vec3 tangent = attr_Tangent.xyz;
#endif
#endif
@ -185,12 +176,12 @@ void main()
#if defined(USE_MODELMATRIX)
position = (u_ModelMatrix * vec4(position, 1.0)).xyz;
normal = (u_ModelMatrix * vec4(normal, 0.0)).xyz;
#if defined(USE_VERT_TANGENT_SPACE) && defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
#if defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
tangent = (u_ModelMatrix * vec4(tangent, 0.0)).xyz;
#endif
#endif
#if defined(USE_VERT_TANGENT_SPACE) && defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
#if defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
vec3 bitangent = cross(normal, tangent) * attr_Tangent.w;
#endif
@ -247,14 +238,9 @@ void main()
#if defined(USE_LIGHT) && !defined(USE_FAST_LIGHT)
vec3 viewDir = u_ViewOrigin - position;
#if defined(USE_VERT_TANGENT_SPACE)
// store view direction in tangent space to save on varyings
var_Normal = vec4(normal, viewDir.x);
var_Tangent = vec4(tangent, viewDir.y);
var_Bitangent = vec4(bitangent, viewDir.z);
#else
var_Normal = normal;
var_ViewDir = viewDir;
#endif
#endif
}

View file

@ -809,7 +809,6 @@ static void ParseFace( dsurface_t *ds, drawVert_t *verts, float *hdrVertColors,
surf->data = (surfaceType_t *)cv;
#ifdef USE_VERT_TANGENT_SPACE
// Calculate tangent spaces
{
srfVert_t *dv[3];
@ -823,7 +822,6 @@ static void ParseFace( dsurface_t *ds, drawVert_t *verts, float *hdrVertColors,
R_CalcTangentVectors(dv);
}
}
#endif
}
@ -963,7 +961,6 @@ static void ParseTriSurf( dsurface_t *ds, drawVert_t *verts, float *hdrVertColor
cv->numIndexes -= badTriangles * 3;
}
#ifdef USE_VERT_TANGENT_SPACE
// Calculate tangent spaces
{
srfVert_t *dv[3];
@ -977,7 +974,6 @@ static void ParseTriSurf( dsurface_t *ds, drawVert_t *verts, float *hdrVertColor
R_CalcTangentVectors(dv);
}
}
#endif
}
/*
@ -1773,9 +1769,7 @@ static int BSPSurfaceCompare(const void *a, const void *b)
static void CopyVert(const srfVert_t * in, srfVert_t * out)
{
VectorCopy(in->xyz, out->xyz);
#ifdef USE_VERT_TANGENT_SPACE
VectorCopy4(in->tangent, out->tangent);
#endif
VectorCopy4(in->normal, out->normal);
VectorCopy4(in->lightdir, out->lightdir);

View file

@ -216,7 +216,6 @@ static int neighbors[8][2] = {
}
}
#ifdef USE_VERT_TANGENT_SPACE
static void MakeMeshTangentVectors(int width, int height, srfVert_t ctrl[MAX_GRID_SIZE][MAX_GRID_SIZE], int numIndexes,
glIndex_t indexes[(MAX_GRID_SIZE-1)*(MAX_GRID_SIZE-1)*2*3])
{
@ -255,7 +254,6 @@ static void MakeMeshTangentVectors(int width, int height, srfVert_t ctrl[MAX_GRI
}
}
}
#endif
static int MakeMeshIndexes(int width, int height, glIndex_t indexes[(MAX_GRID_SIZE-1)*(MAX_GRID_SIZE-1)*2*3])
@ -615,9 +613,7 @@ void R_SubdividePatchToGrid( srfBspSurface_t *grid, int width, int height,
// calculate normals
MakeMeshNormals( width, height, ctrl );
#ifdef USE_VERT_TANGENT_SPACE
MakeMeshTangentVectors(width, height, ctrl, numIndexes, indexes);
#endif
R_CreateSurfaceGridMesh(grid, width, height, ctrl, errorTable, numIndexes, indexes);
}
@ -670,9 +666,7 @@ void R_GridInsertColumn( srfBspSurface_t *grid, int column, int row, vec3_t poin
// calculate normals
MakeMeshNormals( width, height, ctrl );
#ifdef USE_VERT_TANGENT_SPACE
MakeMeshTangentVectors(width, height, ctrl, numIndexes, indexes);
#endif
VectorCopy(grid->lodOrigin, lodOrigin);
lodRadius = grid->lodRadius;
@ -732,9 +726,7 @@ void R_GridInsertRow( srfBspSurface_t *grid, int row, int column, vec3_t point,
// calculate normals
MakeMeshNormals( width, height, ctrl );
#ifdef USE_VERT_TANGENT_SPACE
MakeMeshTangentVectors(width, height, ctrl, numIndexes, indexes);
#endif
VectorCopy(grid->lodOrigin, lodOrigin);
lodRadius = grid->lodRadius;

View file

@ -1061,10 +1061,7 @@ void GLSL_InitGPUShaders(void)
{
Q_strcat(extradefines, 1024, "#define USE_NORMALMAP\n");
#ifdef USE_VERT_TANGENT_SPACE
Q_strcat(extradefines, 1024, "#define USE_VERT_TANGENT_SPACE\n");
attribs |= ATTR_TANGENT;
#endif
if ((i & LIGHTDEF_USE_PARALLAXMAP) && !(i & LIGHTDEF_ENTITY) && r_parallaxMapping->integer)
{
@ -1119,12 +1116,10 @@ void GLSL_InitGPUShaders(void)
Q_strcat(extradefines, 1024, "#define USE_VERTEX_ANIMATION\n#define USE_MODELMATRIX\n");
attribs |= ATTR_POSITION2 | ATTR_NORMAL2;
#ifdef USE_VERT_TANGENT_SPACE
if (r_normalMapping->integer)
{
attribs |= ATTR_TANGENT2;
}
#endif
}
if (!GLSL_InitGPUShader(&tr.lightallShader[i], "lightall", attribs, qtrue, extradefines, qtrue, fallbackShader_lightall_vp, fallbackShader_lightall_fp))

View file

@ -55,8 +55,6 @@ typedef unsigned int glIndex_t;
#define MAX_DRAWN_PSHADOWS 16 // do not increase past 32, because bit flags are used on surfaces
#define PSHADOW_MAP_SIZE 512
#define USE_VERT_TANGENT_SPACE
typedef struct cubemap_s {
char name[MAX_QPATH];
vec3_t origin;
@ -894,9 +892,7 @@ typedef struct
vec2_t st;
vec2_t lightmap;
int16_t normal[4];
#ifdef USE_VERT_TANGENT_SPACE
int16_t tangent[4];
#endif
int16_t lightdir[4];
vec4_t vertexColors;
@ -905,11 +901,7 @@ typedef struct
#endif
} srfVert_t;
#ifdef USE_VERT_TANGENT_SPACE
#define srfVert_t_cleared(x) srfVert_t (x) = {{0, 0, 0}, {0, 0}, {0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}
#else
#define srfVert_t_cleared(x) srfVert_t (x) = {{0, 0, 0}, {0, 0}, {0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}
#endif
// srfBspSurface_t covers SF_GRID, SF_TRIANGLES, SF_POLY, and SF_VAO_MESH
typedef struct srfBspSurface_s
@ -1200,9 +1192,7 @@ typedef struct
{
vec3_t xyz;
int16_t normal[4];
#ifdef USE_VERT_TANGENT_SPACE
int16_t tangent[4];
#endif
} mdvVertex_t;
typedef struct
@ -2002,9 +1992,7 @@ typedef struct shaderCommands_s
glIndex_t indexes[SHADER_MAX_INDEXES] QALIGN(16);
vec4_t xyz[SHADER_MAX_VERTEXES] QALIGN(16);
int16_t normal[SHADER_MAX_VERTEXES][4] QALIGN(16);
#ifdef USE_VERT_TANGENT_SPACE
int16_t tangent[SHADER_MAX_VERTEXES][4] QALIGN(16);
#endif
vec2_t texCoords[SHADER_MAX_VERTEXES][2] QALIGN(16);
vec4_t vertexColors[SHADER_MAX_VERTEXES] QALIGN(16);
int16_t lightdir[SHADER_MAX_VERTEXES][4] QALIGN(16);

View file

@ -128,7 +128,6 @@ vec_t R_CalcTangentSpace(vec3_t tangent, vec3_t bitangent, const vec3_t normal,
return handedness;
}
#ifdef USE_VERT_TANGENT_SPACE
qboolean R_CalcTangentVectors(srfVert_t * dv[3])
{
int i;
@ -189,7 +188,6 @@ qboolean R_CalcTangentVectors(srfVert_t * dv[3])
return qtrue;
}
#endif
/*

View file

@ -598,7 +598,6 @@ static qboolean R_LoadMD3(model_t * mod, int lod, void *buffer, int bufferSize,
st->st[1] = LittleFloat(md3st->st[1]);
}
#ifdef USE_VERT_TANGENT_SPACE
// calc tangent spaces
{
vec3_t *sdirs = ri.Malloc(sizeof(*sdirs) * surf->numVerts * mdvModel->numFrames);
@ -659,7 +658,6 @@ static qboolean R_LoadMD3(model_t * mod, int lod, void *buffer, int bufferSize,
ri.Free(sdirs);
ri.Free(tdirs);
}
#endif
// find the next surface
md3Surf = (md3Surface_t *) ((byte *) md3Surf + md3Surf->ofsEnd);
@ -690,9 +688,7 @@ static qboolean R_LoadMD3(model_t * mod, int lod, void *buffer, int bufferSize,
offset_tangent = offset_normal + sizeof(int16_t) * 4;
stride_st = glRefConfig.packedTexcoordDataSize;
stride_xyz = sizeof(vec3_t) + sizeof(int16_t) * 4;
#ifdef USE_VERT_TANGENT_SPACE
stride_xyz += sizeof(int16_t) * 4;
#endif
stride_normal = stride_tangent = stride_xyz;
dataSize = offset_xyz + surf->numVerts * mdvModel->numFrames * stride_xyz;
@ -704,11 +700,7 @@ static qboolean R_LoadMD3(model_t * mod, int lod, void *buffer, int bufferSize,
offset_st = offset_xyz + sizeof(vec3_t);
offset_normal = offset_st + glRefConfig.packedTexcoordDataSize;
offset_tangent = offset_normal + sizeof(int16_t) * 4;
#ifdef USE_VERT_TANGENT_SPACE
stride_xyz = offset_tangent + sizeof(int16_t) * 4;
#else
stride_xyz = offset_normal + sizeof(int16_t) * 4;
#endif
stride_st = stride_normal = stride_tangent = stride_xyz;
dataSize = surf->numVerts * stride_xyz;
@ -736,11 +728,9 @@ static qboolean R_LoadMD3(model_t * mod, int lod, void *buffer, int bufferSize,
memcpy(data + dataOfs, &v->normal, sizeof(int16_t) * 4);
dataOfs += sizeof(int16_t) * 4;
#ifdef USE_VERT_TANGENT_SPACE
// tangent
memcpy(data + dataOfs, &v->tangent, sizeof(int16_t) * 4);
dataOfs += sizeof(int16_t) * 4;
#endif
}
}
else
@ -760,11 +750,9 @@ static qboolean R_LoadMD3(model_t * mod, int lod, void *buffer, int bufferSize,
memcpy(data + dataOfs, &v->normal, sizeof(int16_t) * 4);
dataOfs += sizeof(int16_t) * 4;
#ifdef USE_VERT_TANGENT_SPACE
// tangent
memcpy(data + dataOfs, &v->tangent, sizeof(int16_t) * 4);
dataOfs += sizeof(int16_t) * 4;
#endif
}
}
@ -782,9 +770,7 @@ static qboolean R_LoadMD3(model_t * mod, int lod, void *buffer, int bufferSize,
vaoSurf->vao->attribs[ATTR_INDEX_POSITION].enabled = 1;
vaoSurf->vao->attribs[ATTR_INDEX_TEXCOORD].enabled = 1;
vaoSurf->vao->attribs[ATTR_INDEX_NORMAL ].enabled = 1;
#ifdef USE_VERT_TANGENT_SPACE
vaoSurf->vao->attribs[ATTR_INDEX_TANGENT ].enabled = 1;
#endif
vaoSurf->vao->attribs[ATTR_INDEX_POSITION].count = 3;
vaoSurf->vao->attribs[ATTR_INDEX_TEXCOORD].count = 2;

View file

@ -1025,9 +1025,7 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) {
vec4_t *outXYZ;
int16_t *outNormal;
#ifdef USE_VERT_TANGENT_SPACE
int16_t *outTangent;
#endif
vec2_t (*outTexCoord)[2];
vec4_t *outColor;
@ -1043,9 +1041,7 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) {
outXYZ = &tess.xyz[tess.numVertexes];
outNormal = tess.normal[tess.numVertexes];
#ifdef USE_VERT_TANGENT_SPACE
outTangent = tess.tangent[tess.numVertexes];
#endif
outTexCoord = &tess.texCoords[tess.numVertexes];
outColor = &tess.vertexColors[tess.numVertexes];
@ -1132,7 +1128,6 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) {
R_VaoPackNormal(outNormal, normal);
#ifdef USE_VERT_TANGENT_SPACE
tangent[0] = DotProduct(&nrmMat[0], &data->tangents[4*vtx]);
tangent[1] = DotProduct(&nrmMat[3], &data->tangents[4*vtx]);
tangent[2] = DotProduct(&nrmMat[6], &data->tangents[4*vtx]);
@ -1140,7 +1135,6 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) {
R_VaoPackTangent(outTangent, tangent);
outTangent+=4;
#endif
}
(*outColor)[0] = data->colors[4*vtx+0] / 255.0f;

View file

@ -1024,9 +1024,7 @@ static unsigned int RB_CalcShaderVertexAttribs( shaderCommands_t *input )
if (vertexAttribs & ATTR_NORMAL)
{
vertexAttribs |= ATTR_NORMAL2;
#ifdef USE_VERT_TANGENT_SPACE
vertexAttribs |= ATTR_TANGENT2;
#endif
}
}

View file

@ -2120,12 +2120,10 @@ static void ComputeVertexAttribs(void)
{
shader.vertexAttribs |= ATTR_NORMAL;
#ifdef USE_VERT_TANGENT_SPACE
if ((pStage->glslShaderIndex & LIGHTDEF_LIGHTTYPE_MASK) && !(r_normalMapping->integer == 0 && r_specularMapping->integer == 0))
{
shader.vertexAttribs |= ATTR_TANGENT;
}
#endif
switch (pStage->glslShaderIndex & LIGHTDEF_LIGHTTYPE_MASK)
{

View file

@ -323,9 +323,7 @@ static void RB_SurfaceVertsAndIndexes( int numVerts, srfVert_t *verts, int numIn
float *xyz, *texCoords, *lightCoords;
int16_t *lightdir;
int16_t *normal;
#ifdef USE_VERT_TANGENT_SPACE
int16_t *tangent;
#endif
glIndex_t *outIndex;
float *color;
@ -356,7 +354,6 @@ static void RB_SurfaceVertsAndIndexes( int numVerts, srfVert_t *verts, int numIn
VectorCopy4(dv->normal, normal);
}
#ifdef USE_VERT_TANGENT_SPACE
if ( tess.shader->vertexAttribs & ATTR_TANGENT )
{
dv = verts;
@ -364,7 +361,6 @@ static void RB_SurfaceVertsAndIndexes( int numVerts, srfVert_t *verts, int numIn
for ( i = 0 ; i < numVerts ; i++, dv++, tangent+=4 )
VectorCopy4(dv->tangent, tangent);
}
#endif
if ( tess.shader->vertexAttribs & ATTR_TEXCOORD )
{
@ -1013,9 +1009,7 @@ static void RB_SurfaceGrid( srfBspSurface_t *srf ) {
float *xyz;
float *texCoords, *lightCoords;
int16_t *normal;
#ifdef USE_VERT_TANGENT_SPACE
int16_t *tangent;
#endif
float *color;
int16_t *lightdir;
srfVert_t *dv;
@ -1103,9 +1097,7 @@ static void RB_SurfaceGrid( srfBspSurface_t *srf ) {
xyz = tess.xyz[numVertexes];
normal = tess.normal[numVertexes];
#ifdef USE_VERT_TANGENT_SPACE
tangent = tess.tangent[numVertexes];
#endif
texCoords = tess.texCoords[numVertexes][0];
lightCoords = tess.texCoords[numVertexes][1];
color = tess.vertexColors[numVertexes];
@ -1129,13 +1121,12 @@ static void RB_SurfaceGrid( srfBspSurface_t *srf ) {
normal += 4;
}
#ifdef USE_VERT_TANGENT_SPACE
if ( tess.shader->vertexAttribs & ATTR_TANGENT )
{
VectorCopy4(dv->tangent, tangent);
tangent += 4;
}
#endif
if ( tess.shader->vertexAttribs & ATTR_TEXCOORD )
{
VectorCopy2(dv->st, texCoords);

View file

@ -248,9 +248,7 @@ vao_t *R_CreateVao2(const char *name, int numVertexes, srfVert_t *verts, int num
// since these vertex attributes are never altered, interleave them
vao->attribs[ATTR_INDEX_POSITION ].enabled = 1;
vao->attribs[ATTR_INDEX_NORMAL ].enabled = 1;
#ifdef USE_VERT_TANGENT_SPACE
vao->attribs[ATTR_INDEX_TANGENT ].enabled = 1;
#endif
vao->attribs[ATTR_INDEX_TEXCOORD ].enabled = 1;
vao->attribs[ATTR_INDEX_LIGHTCOORD ].enabled = 1;
vao->attribs[ATTR_INDEX_COLOR ].enabled = 1;
@ -282,9 +280,7 @@ vao_t *R_CreateVao2(const char *name, int numVertexes, srfVert_t *verts, int num
vao->attribs[ATTR_INDEX_POSITION ].offset = 0; dataSize = sizeof(verts[0].xyz);
vao->attribs[ATTR_INDEX_NORMAL ].offset = dataSize; dataSize += sizeof(verts[0].normal);
#ifdef USE_VERT_TANGENT_SPACE
vao->attribs[ATTR_INDEX_TANGENT ].offset = dataSize; dataSize += sizeof(verts[0].tangent);
#endif
vao->attribs[ATTR_INDEX_TEXCOORD ].offset = dataSize; dataSize += glRefConfig.packedTexcoordDataSize;
vao->attribs[ATTR_INDEX_LIGHTCOORD ].offset = dataSize; dataSize += glRefConfig.packedTexcoordDataSize;
vao->attribs[ATTR_INDEX_COLOR ].offset = dataSize; dataSize += glRefConfig.packedColorDataSize;
@ -321,11 +317,9 @@ vao_t *R_CreateVao2(const char *name, int numVertexes, srfVert_t *verts, int num
memcpy(data + dataOfs, &verts[i].normal, sizeof(verts[i].normal));
dataOfs += sizeof(verts[i].normal);
#ifdef USE_VERT_TANGENT_SPACE
// tangent
memcpy(data + dataOfs, &verts[i].tangent, sizeof(verts[i].tangent));
dataOfs += sizeof(verts[i].tangent);
#endif
// texcoords
dataOfs += R_VaoPackTexCoord(data + dataOfs, verts[i].st);
@ -469,9 +463,7 @@ void R_InitVaos(void)
vertexesSize = sizeof(tess.xyz[0]);
vertexesSize += sizeof(tess.normal[0]);
#ifdef USE_VERT_TANGENT_SPACE
vertexesSize += sizeof(tess.tangent[0]);
#endif
vertexesSize += sizeof(tess.vertexColors[0]);
vertexesSize += sizeof(tess.texCoords[0][0]) * 2;
vertexesSize += sizeof(tess.lightdir[0]);
@ -485,9 +477,7 @@ void R_InitVaos(void)
tess.vao->attribs[ATTR_INDEX_POSITION ].enabled = 1;
tess.vao->attribs[ATTR_INDEX_NORMAL ].enabled = 1;
#ifdef USE_VERT_TANGENT_SPACE
tess.vao->attribs[ATTR_INDEX_TANGENT ].enabled = 1;
#endif
tess.vao->attribs[ATTR_INDEX_TEXCOORD ].enabled = 1;
tess.vao->attribs[ATTR_INDEX_LIGHTCOORD ].enabled = 1;
tess.vao->attribs[ATTR_INDEX_COLOR ].enabled = 1;
@ -519,9 +509,7 @@ void R_InitVaos(void)
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;
#ifdef USE_VERT_TANGENT_SPACE
tess.vao->attribs[ATTR_INDEX_TANGENT ].offset = offset; offset += sizeof(tess.tangent[0]) * SHADER_MAX_VERTEXES;
#endif
// 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]);
@ -532,9 +520,7 @@ void R_InitVaos(void)
tess.vao->attribs[ATTR_INDEX_POSITION ].stride = sizeof(tess.xyz[0]);
tess.vao->attribs[ATTR_INDEX_NORMAL ].stride = sizeof(tess.normal[0]);
#ifdef USE_VERT_TANGENT_SPACE
tess.vao->attribs[ATTR_INDEX_TANGENT ].stride = sizeof(tess.tangent[0]);
#endif
tess.vao->attribs[ATTR_INDEX_COLOR ].stride = sizeof(tess.vertexColors[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;
@ -543,9 +529,7 @@ void R_InitVaos(void)
tess.attribPointers[ATTR_INDEX_POSITION] = tess.xyz;
tess.attribPointers[ATTR_INDEX_TEXCOORD] = tess.texCoords;
tess.attribPointers[ATTR_INDEX_NORMAL] = tess.normal;
#ifdef USE_VERT_TANGENT_SPACE
tess.attribPointers[ATTR_INDEX_TANGENT] = tess.tangent;
#endif
tess.attribPointers[ATTR_INDEX_COLOR] = tess.vertexColors;
tess.attribPointers[ATTR_INDEX_LIGHTDIRECTION] = tess.lightdir;