[iortcw] 235/497: All: Rend2: Interleave vertex data for static MD3s

Simon McVittie smcv at debian.org
Fri Sep 8 10:36:58 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to annotated tag 1.42d
in repository iortcw.

commit e4e517b10c1d21f564ea09d8a6528c90da074360
Author: M4N4T4RMS at gmail.com <M4N4T4RMS at gmail.com@e65d2741-a53d-b2dc-ae96-bb75fa5e4c4a>
Date:   Wed Oct 15 21:37:35 2014 +0000

    All: Rend2: Interleave vertex data for static MD3s
---
 MP/code/rend2/tr_glsl.c     |  12 +-
 MP/code/rend2/tr_local.h    |   6 +-
 MP/code/rend2/tr_model.c    | 349 ++++++++++++++++++++++++++++----------------
 MP/code/renderer/tr_local.h |   2 -
 SP/code/rend2/tr_glsl.c     |  12 +-
 SP/code/rend2/tr_local.h    |   6 +-
 SP/code/rend2/tr_model.c    | 349 ++++++++++++++++++++++++++++----------------
 SP/code/renderer/tr_local.h |   2 -
 8 files changed, 462 insertions(+), 276 deletions(-)

diff --git a/MP/code/rend2/tr_glsl.c b/MP/code/rend2/tr_glsl.c
index 26f5c58..5a8cccd 100644
--- a/MP/code/rend2/tr_glsl.c
+++ b/MP/code/rend2/tr_glsl.c
@@ -1524,12 +1524,12 @@ void GLSL_VertexAttribPointers(uint32_t attribBits)
 	newFrame = glState.vertexAttribsNewFrame;
 	if (glState.vertexAnimation)
 	{
-		extraOffsets[ATTR_INDEX_POSITION]  = newFrame * vao->size_xyz;
-		extraOffsets[ATTR_INDEX_POSITION2] = oldFrame * vao->size_xyz;
-		extraOffsets[ATTR_INDEX_NORMAL]    = newFrame * vao->size_normal;
-		extraOffsets[ATTR_INDEX_NORMAL2]   = oldFrame * vao->size_normal;
-		extraOffsets[ATTR_INDEX_TANGENT]   = newFrame * vao->size_normal;
-		extraOffsets[ATTR_INDEX_TANGENT2]  = oldFrame * vao->size_normal;
+		extraOffsets[ATTR_INDEX_POSITION]  = newFrame * vao->frameSize;
+		extraOffsets[ATTR_INDEX_POSITION2] = oldFrame * vao->frameSize;
+		extraOffsets[ATTR_INDEX_NORMAL]    = newFrame * vao->frameSize;
+		extraOffsets[ATTR_INDEX_NORMAL2]   = oldFrame * vao->frameSize;
+		extraOffsets[ATTR_INDEX_TANGENT]   = newFrame * vao->frameSize;
+		extraOffsets[ATTR_INDEX_TANGENT2]  = oldFrame * vao->frameSize;
 	}
 
 	// this may not be bound if we're using VAOs
diff --git a/MP/code/rend2/tr_local.h b/MP/code/rend2/tr_local.h
index fbdfc7d..f2902b8 100644
--- a/MP/code/rend2/tr_local.h
+++ b/MP/code/rend2/tr_local.h
@@ -163,8 +163,7 @@ typedef struct vao_s
 	int             vertexesSize;	// amount of memory data allocated for all vertices in bytes
 	vaoAttrib_t     attribs[VAO_MAX_ATTRIBS];
 
-	uint32_t        size_xyz;
-	uint32_t        size_normal;
+	uint32_t        frameSize;      // bytes to skip per frame when doing vertex animation
 
 	uint32_t        indexesIBO;
 	int             indexesSize;	// amount of memory data allocated for all triangles in bytes
@@ -1777,9 +1776,6 @@ typedef struct {
 	int						numVaos;
 	vao_t					*vaos[MAX_VAOS];
 
-	// Ridah
-	//int numCacheImages;
-
 	// shader indexes from other modules will be looked up in tr.shaders[]
 	// shader indexes from drawsurfs will be looked up in sortedShaders[]
 	// lower indexed sortedShaders must be rendered first (opaque surfaces before translucent)
diff --git a/MP/code/rend2/tr_model.c b/MP/code/rend2/tr_model.c
index a4c04d2..0c925d5 100644
--- a/MP/code/rend2/tr_model.c
+++ b/MP/code/rend2/tr_model.c
@@ -932,68 +932,122 @@ static qboolean R_LoadMDC( model_t *mod, int lod, void *buffer, const char *modN
 		surf = mdvModel->surfaces;
 		for (i = 0; i < mdvModel->numSurfaces; i++, vaoSurf++, surf++)
 		{
-			vec3_t *verts;
-			vec2_t *texcoords;
-			uint32_t *normals;
+			uint32_t offset_xyz, offset_st, offset_normal, offset_tangent;
+			uint32_t stride_xyz, stride_st, stride_normal, stride_tangent;
+			uint32_t dataSize, dataOfs;
+			uint8_t *data;
+
+			if (mdvModel->numFrames > 1)
+			{
+				// vertex animation, store texcoords first, then position/normal/tangents
+				offset_st      = 0;
+				offset_xyz     = surf->numVerts * sizeof(vec2_t);
+				offset_normal  = offset_xyz + sizeof(vec3_t);
+				offset_tangent = offset_normal + sizeof(uint32_t);
+				stride_st  = sizeof(vec2_t);
+				stride_xyz = sizeof(vec3_t) + sizeof(uint32_t);
 #ifdef USE_VERT_TANGENT_SPACE
-			uint32_t *tangents;
+				stride_xyz += sizeof(uint32_t);
 #endif
+				stride_normal = stride_tangent = stride_xyz;
 
-			byte *data;
-			int dataSize;
-
-			int ofs_xyz, ofs_normal, ofs_st;
+				dataSize = offset_xyz + surf->numVerts * mdvModel->numFrames * stride_xyz;
+			}
+			else
+			{
+				// no animation, interleave everything
+				offset_xyz     = 0;
+				offset_st      = offset_xyz + sizeof(vec3_t);
+				offset_normal  = offset_st + sizeof(vec2_t);
+				offset_tangent = offset_normal + sizeof(uint32_t);
 #ifdef USE_VERT_TANGENT_SPACE
-			int ofs_tangent;
+				stride_xyz = offset_tangent + sizeof(uint32_t);
+#else
+				stride_xyz = offset_normal + sizeof(uint32_t);
 #endif
+				stride_st = stride_normal = stride_tangent = stride_xyz;
 
-			dataSize = 0;
+				dataSize = surf->numVerts * stride_xyz;
+			}
 
-			ofs_xyz = dataSize;
-			dataSize += surf->numVerts * mdvModel->numFrames * sizeof(*verts);
 
-			ofs_normal = dataSize;
-			dataSize += surf->numVerts * mdvModel->numFrames * sizeof(*normals);
+			data = ri.Z_Malloc(dataSize);
+			dataOfs = 0;
 
+			if (mdvModel->numFrames > 1)
+			{
+				st = surf->st;
+				for ( j = 0 ; j < surf->numVerts ; j++, st++ ) {
+					memcpy(data + dataOfs, &st->st, sizeof(st->st));
+					dataOfs += sizeof(st->st);
+				}
+
+				v = surf->verts;
+				for ( j = 0; j < surf->numVerts * mdvModel->numFrames ; j++, v++ )
+				{
 #ifdef USE_VERT_TANGENT_SPACE
-			ofs_tangent = dataSize;
-			dataSize += surf->numVerts * mdvModel->numFrames * sizeof(*tangents);
+					vec3_t nxt;
+					vec4_t tangent;
 #endif
+					uint32_t *p;
 
-			ofs_st = dataSize;
-			dataSize += surf->numVerts * sizeof(*texcoords);
+					// xyz
+					memcpy(data + dataOfs, &v->xyz, sizeof(v->xyz));
+					dataOfs += sizeof(v->xyz);
 
-			data = ri.Z_Malloc(dataSize);
+					// normal
+					p = (uint32_t *)(data + dataOfs);
+					*p = R_VaoPackNormal(v->normal);
+					dataOfs += sizeof(uint32_t);
 
-			verts =      (void *)(data + ofs_xyz);
-			normals =    (void *)(data + ofs_normal);
 #ifdef USE_VERT_TANGENT_SPACE
-			tangents =   (void *)(data + ofs_tangent);
+					CrossProduct(v->normal, v->tangent, nxt);
+					VectorCopy(v->tangent, tangent);
+					tangent[3] = (DotProduct(nxt, v->bitangent) < 0.0f) ? -1.0f : 1.0f;
+
+					// tangent
+					p = (uint32_t *)(data + dataOfs);
+					*p = R_VaoPackTangent(tangent);
+					dataOfs += sizeof(uint32_t);
 #endif
-			texcoords =  (void *)(data + ofs_st);
-		
-			v = surf->verts;
-			for ( j = 0; j < surf->numVerts * mdvModel->numFrames ; j++, v++ )
+				}
+			}
+			else
 			{
-				vec3_t nxt;
-				vec4_t tangent;
+				v = surf->verts;
+				st = surf->st;
+				for ( j = 0; j < surf->numVerts; j++, v++, st++ )
+				{
+#ifdef USE_VERT_TANGENT_SPACE
+					vec3_t nxt;
+					vec4_t tangent;
+#endif
+					uint32_t *p;
 
-				VectorCopy(v->xyz,       verts[j]);
+					// xyz
+					memcpy(data + dataOfs, &v->xyz, sizeof(v->xyz));
+					dataOfs += sizeof(v->xyz);
 
-				normals[j] = R_VaoPackNormal(v->normal);
-#ifdef USE_VERT_TANGENT_SPACE
-				CrossProduct(v->normal, v->tangent, nxt);
-				VectorCopy(v->tangent, tangent);
-				tangent[3] = (DotProduct(nxt, v->bitangent) < 0.0f) ? -1.0f : 1.0f;
+					// st
+					memcpy(data + dataOfs, &st->st, sizeof(st->st));
+					dataOfs += sizeof(st->st);
 
-				tangents[j] = R_VaoPackTangent(tangent);
-#endif
-			}
+					// normal
+					p = (uint32_t *)(data + dataOfs);
+					*p = R_VaoPackNormal(v->normal);
+					dataOfs += sizeof(uint32_t);
 
-			st = surf->st;
-			for ( j = 0 ; j < surf->numVerts ; j++, st++ ) {
-				texcoords[j][0] = st->st[0];
-				texcoords[j][1] = st->st[1];
+#ifdef USE_VERT_TANGENT_SPACE
+					CrossProduct(v->normal, v->tangent, nxt);
+					VectorCopy(v->tangent, tangent);
+					tangent[3] = (DotProduct(nxt, v->bitangent) < 0.0f) ? -1.0f : 1.0f;
+
+					// tangent
+					p = (uint32_t *)(data + dataOfs);
+					*p = R_VaoPackTangent(tangent);
+					dataOfs += sizeof(uint32_t);
+#endif
+				}
 			}
 
 			vaoSurf->surfaceType = SF_VAO_MDVMESH;
@@ -1001,7 +1055,7 @@ static qboolean R_LoadMDC( model_t *mod, int lod, void *buffer, const char *modN
 			vaoSurf->mdvSurface = surf;
 			vaoSurf->numIndexes = surf->numIndexes;
 			vaoSurf->numVerts = surf->numVerts;
-
+			
 			vaoSurf->minIndex = 0;
 			vaoSurf->maxIndex = surf->numVerts;
 
@@ -1041,27 +1095,23 @@ static qboolean R_LoadMDC( model_t *mod, int lod, void *buffer, const char *modN
 			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT2  ].normalized = GL_TRUE;
 			vaoSurf->vao->attribs[ATTR_INDEX_TEXCOORD  ].normalized = GL_FALSE;
 
-			vaoSurf->vao->attribs[ATTR_INDEX_POSITION  ].offset = ofs_xyz;
-			vaoSurf->vao->attribs[ATTR_INDEX_POSITION  ].stride = sizeof(*verts);
-			vaoSurf->vao->attribs[ATTR_INDEX_POSITION2 ].offset = ofs_xyz;
-			vaoSurf->vao->attribs[ATTR_INDEX_POSITION2 ].stride = sizeof(*verts);
-
-			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL    ].offset = ofs_normal;
-			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL    ].stride = sizeof(*normals);
-			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL2   ].offset = ofs_normal;
-			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL2   ].stride = sizeof(*normals);
+			vaoSurf->vao->attribs[ATTR_INDEX_POSITION  ].offset = offset_xyz;
+			vaoSurf->vao->attribs[ATTR_INDEX_POSITION2 ].offset = offset_xyz;
+			vaoSurf->vao->attribs[ATTR_INDEX_TEXCOORD  ].offset = offset_st;
+			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL    ].offset = offset_normal;
+			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL2   ].offset = offset_normal;
+			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT   ].offset = offset_tangent;
+			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT2  ].offset = offset_tangent;
 
-#ifdef USE_VERT_TANGENT_SPACE
-			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT   ].offset = ofs_tangent;
-			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT   ].stride = sizeof(*tangents);
-			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT2  ].offset = ofs_tangent;
-			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT2  ].stride = sizeof(*tangents);
-#endif
-			vaoSurf->vao->attribs[ATTR_INDEX_TEXCOORD  ].offset = ofs_st;
-			vaoSurf->vao->attribs[ATTR_INDEX_TEXCOORD  ].stride = sizeof(*st);
+			vaoSurf->vao->attribs[ATTR_INDEX_POSITION  ].stride = stride_xyz;
+			vaoSurf->vao->attribs[ATTR_INDEX_POSITION2 ].stride = stride_xyz;
+			vaoSurf->vao->attribs[ATTR_INDEX_TEXCOORD  ].stride = stride_st;
+			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL    ].stride = stride_normal;
+			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL2   ].stride = stride_normal;
+			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT   ].stride = stride_tangent;
+			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT2  ].stride = stride_tangent;
 
-			vaoSurf->vao->size_xyz    = sizeof(*verts)   * surf->numVerts;
-			vaoSurf->vao->size_normal = sizeof(*normals) * surf->numVerts;
+			vaoSurf->vao->frameSize = stride_xyz    * surf->numVerts;
 
 			Vao_SetVertexPointers(vaoSurf->vao);
 
@@ -1392,7 +1442,6 @@ static qboolean R_LoadMD3(model_t * mod, int lod, void *buffer, const char *modN
 		surf++;
 	}
 
-
 	{
 		srfVaoMdvMesh_t *vaoSurf;
 
@@ -1403,68 +1452,122 @@ static qboolean R_LoadMD3(model_t * mod, int lod, void *buffer, const char *modN
 		surf = mdvModel->surfaces;
 		for (i = 0; i < mdvModel->numSurfaces; i++, vaoSurf++, surf++)
 		{
-			vec3_t *verts;
-			vec2_t *texcoords;
-			uint32_t *normals;
+			uint32_t offset_xyz, offset_st, offset_normal, offset_tangent;
+			uint32_t stride_xyz, stride_st, stride_normal, stride_tangent;
+			uint32_t dataSize, dataOfs;
+			uint8_t *data;
+
+			if (mdvModel->numFrames > 1)
+			{
+				// vertex animation, store texcoords first, then position/normal/tangents
+				offset_st      = 0;
+				offset_xyz     = surf->numVerts * sizeof(vec2_t);
+				offset_normal  = offset_xyz + sizeof(vec3_t);
+				offset_tangent = offset_normal + sizeof(uint32_t);
+				stride_st  = sizeof(vec2_t);
+				stride_xyz = sizeof(vec3_t) + sizeof(uint32_t);
 #ifdef USE_VERT_TANGENT_SPACE
-			uint32_t *tangents;
+				stride_xyz += sizeof(uint32_t);
 #endif
+				stride_normal = stride_tangent = stride_xyz;
 
-			byte *data;
-			int dataSize;
-
-			int ofs_xyz, ofs_normal, ofs_st;
+				dataSize = offset_xyz + surf->numVerts * mdvModel->numFrames * stride_xyz;
+			}
+			else
+			{
+				// no animation, interleave everything
+				offset_xyz     = 0;
+				offset_st      = offset_xyz + sizeof(vec3_t);
+				offset_normal  = offset_st + sizeof(vec2_t);
+				offset_tangent = offset_normal + sizeof(uint32_t);
 #ifdef USE_VERT_TANGENT_SPACE
-			int ofs_tangent;
+				stride_xyz = offset_tangent + sizeof(uint32_t);
+#else
+				stride_xyz = offset_normal + sizeof(uint32_t);
 #endif
+				stride_st = stride_normal = stride_tangent = stride_xyz;
+
+				dataSize = surf->numVerts * stride_xyz;
+			}
 
-			dataSize = 0;
 
-			ofs_xyz = dataSize;
-			dataSize += surf->numVerts * mdvModel->numFrames * sizeof(*verts);
+			data = ri.Z_Malloc(dataSize);
+			dataOfs = 0;
 
-			ofs_normal = dataSize;
-			dataSize += surf->numVerts * mdvModel->numFrames * sizeof(*normals);
+			if (mdvModel->numFrames > 1)
+			{
+				st = surf->st;
+				for ( j = 0 ; j < surf->numVerts ; j++, st++ ) {
+					memcpy(data + dataOfs, &st->st, sizeof(st->st));
+					dataOfs += sizeof(st->st);
+				}
 
+				v = surf->verts;
+				for ( j = 0; j < surf->numVerts * mdvModel->numFrames ; j++, v++ )
+				{
 #ifdef USE_VERT_TANGENT_SPACE
-			ofs_tangent = dataSize;
-			dataSize += surf->numVerts * mdvModel->numFrames * sizeof(*tangents);
+					vec3_t nxt;
+					vec4_t tangent;
 #endif
+					uint32_t *p;
 
-			ofs_st = dataSize;
-			dataSize += surf->numVerts * sizeof(*texcoords);
+					// xyz
+					memcpy(data + dataOfs, &v->xyz, sizeof(v->xyz));
+					dataOfs += sizeof(v->xyz);
 
-			data = ri.Z_Malloc(dataSize);
+					// normal
+					p = (uint32_t *)(data + dataOfs);
+					*p = R_VaoPackNormal(v->normal);
+					dataOfs += sizeof(uint32_t);
 
-			verts =      (void *)(data + ofs_xyz);
-			normals =    (void *)(data + ofs_normal);
 #ifdef USE_VERT_TANGENT_SPACE
-			tangents =   (void *)(data + ofs_tangent);
+					CrossProduct(v->normal, v->tangent, nxt);
+					VectorCopy(v->tangent, tangent);
+					tangent[3] = (DotProduct(nxt, v->bitangent) < 0.0f) ? -1.0f : 1.0f;
+
+					// tangent
+					p = (uint32_t *)(data + dataOfs);
+					*p = R_VaoPackTangent(tangent);
+					dataOfs += sizeof(uint32_t);
 #endif
-			texcoords =  (void *)(data + ofs_st);
-		
-			v = surf->verts;
-			for ( j = 0; j < surf->numVerts * mdvModel->numFrames ; j++, v++ )
+				}
+			}
+			else
 			{
-				vec3_t nxt;
-				vec4_t tangent;
+				v = surf->verts;
+				st = surf->st;
+				for ( j = 0; j < surf->numVerts; j++, v++, st++ )
+				{
+#ifdef USE_VERT_TANGENT_SPACE
+					vec3_t nxt;
+					vec4_t tangent;
+#endif
+					uint32_t *p;
 
-				VectorCopy(v->xyz,       verts[j]);
+					// xyz
+					memcpy(data + dataOfs, &v->xyz, sizeof(v->xyz));
+					dataOfs += sizeof(v->xyz);
 
-				normals[j] = R_VaoPackNormal(v->normal);
-#ifdef USE_VERT_TANGENT_SPACE
-				CrossProduct(v->normal, v->tangent, nxt);
-				VectorCopy(v->tangent, tangent);
-				tangent[3] = (DotProduct(nxt, v->bitangent) < 0.0f) ? -1.0f : 1.0f;
+					// st
+					memcpy(data + dataOfs, &st->st, sizeof(st->st));
+					dataOfs += sizeof(st->st);
 
-				tangents[j] = R_VaoPackTangent(tangent);
-#endif
-			}
+					// normal
+					p = (uint32_t *)(data + dataOfs);
+					*p = R_VaoPackNormal(v->normal);
+					dataOfs += sizeof(uint32_t);
 
-			st = surf->st;
-			for ( j = 0 ; j < surf->numVerts ; j++, st++ ) {
-				texcoords[j][0] = st->st[0];
-				texcoords[j][1] = st->st[1];
+#ifdef USE_VERT_TANGENT_SPACE
+					CrossProduct(v->normal, v->tangent, nxt);
+					VectorCopy(v->tangent, tangent);
+					tangent[3] = (DotProduct(nxt, v->bitangent) < 0.0f) ? -1.0f : 1.0f;
+
+					// tangent
+					p = (uint32_t *)(data + dataOfs);
+					*p = R_VaoPackTangent(tangent);
+					dataOfs += sizeof(uint32_t);
+#endif
+				}
 			}
 
 			vaoSurf->surfaceType = SF_VAO_MDVMESH;
@@ -1472,7 +1575,7 @@ static qboolean R_LoadMD3(model_t * mod, int lod, void *buffer, const char *modN
 			vaoSurf->mdvSurface = surf;
 			vaoSurf->numIndexes = surf->numIndexes;
 			vaoSurf->numVerts = surf->numVerts;
-
+			
 			vaoSurf->minIndex = 0;
 			vaoSurf->maxIndex = surf->numVerts;
 
@@ -1512,27 +1615,23 @@ static qboolean R_LoadMD3(model_t * mod, int lod, void *buffer, const char *modN
 			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT2  ].normalized = GL_TRUE;
 			vaoSurf->vao->attribs[ATTR_INDEX_TEXCOORD  ].normalized = GL_FALSE;
 
-			vaoSurf->vao->attribs[ATTR_INDEX_POSITION  ].offset = ofs_xyz;
-			vaoSurf->vao->attribs[ATTR_INDEX_POSITION  ].stride = sizeof(*verts);
-			vaoSurf->vao->attribs[ATTR_INDEX_POSITION2 ].offset = ofs_xyz;
-			vaoSurf->vao->attribs[ATTR_INDEX_POSITION2 ].stride = sizeof(*verts);
-
-			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL    ].offset = ofs_normal;
-			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL    ].stride = sizeof(*normals);
-			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL2   ].offset = ofs_normal;
-			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL2   ].stride = sizeof(*normals);
-
-#ifdef USE_VERT_TANGENT_SPACE
-			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT   ].offset = ofs_tangent;
-			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT   ].stride = sizeof(*tangents);
-			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT2  ].offset = ofs_tangent;
-			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT2  ].stride = sizeof(*tangents);
-#endif
-			vaoSurf->vao->attribs[ATTR_INDEX_TEXCOORD  ].offset = ofs_st;
-			vaoSurf->vao->attribs[ATTR_INDEX_TEXCOORD  ].stride = sizeof(*st);
-
-			vaoSurf->vao->size_xyz    = sizeof(*verts)   * surf->numVerts;
-			vaoSurf->vao->size_normal = sizeof(*normals) * surf->numVerts;
+			vaoSurf->vao->attribs[ATTR_INDEX_POSITION  ].offset = offset_xyz;
+			vaoSurf->vao->attribs[ATTR_INDEX_POSITION2 ].offset = offset_xyz;
+			vaoSurf->vao->attribs[ATTR_INDEX_TEXCOORD  ].offset = offset_st;
+			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL    ].offset = offset_normal;
+			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL2   ].offset = offset_normal;
+			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT   ].offset = offset_tangent;
+			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT2  ].offset = offset_tangent;
+
+			vaoSurf->vao->attribs[ATTR_INDEX_POSITION  ].stride = stride_xyz;
+			vaoSurf->vao->attribs[ATTR_INDEX_POSITION2 ].stride = stride_xyz;
+			vaoSurf->vao->attribs[ATTR_INDEX_TEXCOORD  ].stride = stride_st;
+			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL    ].stride = stride_normal;
+			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL2   ].stride = stride_normal;
+			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT   ].stride = stride_tangent;
+			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT2  ].stride = stride_tangent;
+
+			vaoSurf->vao->frameSize = stride_xyz    * surf->numVerts;
 
 			Vao_SetVertexPointers(vaoSurf->vao);
 
diff --git a/MP/code/renderer/tr_local.h b/MP/code/renderer/tr_local.h
index 475b244..ded82f3 100644
--- a/MP/code/renderer/tr_local.h
+++ b/MP/code/renderer/tr_local.h
@@ -1071,8 +1071,6 @@ typedef struct {
 
 	int numImages;
 	image_t                 *images[MAX_DRAWIMAGES];
-	// Ridah
-	int numCacheImages;
 
 	// shader indexes from other modules will be looked up in tr.shaders[]
 	// shader indexes from drawsurfs will be looked up in sortedShaders[]
diff --git a/SP/code/rend2/tr_glsl.c b/SP/code/rend2/tr_glsl.c
index 26f5c58..5a8cccd 100644
--- a/SP/code/rend2/tr_glsl.c
+++ b/SP/code/rend2/tr_glsl.c
@@ -1524,12 +1524,12 @@ void GLSL_VertexAttribPointers(uint32_t attribBits)
 	newFrame = glState.vertexAttribsNewFrame;
 	if (glState.vertexAnimation)
 	{
-		extraOffsets[ATTR_INDEX_POSITION]  = newFrame * vao->size_xyz;
-		extraOffsets[ATTR_INDEX_POSITION2] = oldFrame * vao->size_xyz;
-		extraOffsets[ATTR_INDEX_NORMAL]    = newFrame * vao->size_normal;
-		extraOffsets[ATTR_INDEX_NORMAL2]   = oldFrame * vao->size_normal;
-		extraOffsets[ATTR_INDEX_TANGENT]   = newFrame * vao->size_normal;
-		extraOffsets[ATTR_INDEX_TANGENT2]  = oldFrame * vao->size_normal;
+		extraOffsets[ATTR_INDEX_POSITION]  = newFrame * vao->frameSize;
+		extraOffsets[ATTR_INDEX_POSITION2] = oldFrame * vao->frameSize;
+		extraOffsets[ATTR_INDEX_NORMAL]    = newFrame * vao->frameSize;
+		extraOffsets[ATTR_INDEX_NORMAL2]   = oldFrame * vao->frameSize;
+		extraOffsets[ATTR_INDEX_TANGENT]   = newFrame * vao->frameSize;
+		extraOffsets[ATTR_INDEX_TANGENT2]  = oldFrame * vao->frameSize;
 	}
 
 	// this may not be bound if we're using VAOs
diff --git a/SP/code/rend2/tr_local.h b/SP/code/rend2/tr_local.h
index ccdd62c..77fc028 100644
--- a/SP/code/rend2/tr_local.h
+++ b/SP/code/rend2/tr_local.h
@@ -165,8 +165,7 @@ typedef struct vao_s
 	int             vertexesSize;	// amount of memory data allocated for all vertices in bytes
 	vaoAttrib_t     attribs[VAO_MAX_ATTRIBS];
 
-	uint32_t        size_xyz;
-	uint32_t        size_normal;
+	uint32_t        frameSize;      // bytes to skip per frame when doing vertex animation
 
 	uint32_t        indexesIBO;
 	int             indexesSize;	// amount of memory data allocated for all triangles in bytes
@@ -1791,9 +1790,6 @@ typedef struct {
 	int						numVaos;
 	vao_t					*vaos[MAX_VAOS];
 
-	// Ridah
-	//int numCacheImages;
-
 	// shader indexes from other modules will be looked up in tr.shaders[]
 	// shader indexes from drawsurfs will be looked up in sortedShaders[]
 	// lower indexed sortedShaders must be rendered first (opaque surfaces before translucent)
diff --git a/SP/code/rend2/tr_model.c b/SP/code/rend2/tr_model.c
index 4031643..ea8bebb 100644
--- a/SP/code/rend2/tr_model.c
+++ b/SP/code/rend2/tr_model.c
@@ -934,68 +934,122 @@ static qboolean R_LoadMDC( model_t *mod, int lod, void *buffer, const char *modN
 		surf = mdvModel->surfaces;
 		for (i = 0; i < mdvModel->numSurfaces; i++, vaoSurf++, surf++)
 		{
-			vec3_t *verts;
-			vec2_t *texcoords;
-			uint32_t *normals;
+			uint32_t offset_xyz, offset_st, offset_normal, offset_tangent;
+			uint32_t stride_xyz, stride_st, stride_normal, stride_tangent;
+			uint32_t dataSize, dataOfs;
+			uint8_t *data;
+
+			if (mdvModel->numFrames > 1)
+			{
+				// vertex animation, store texcoords first, then position/normal/tangents
+				offset_st      = 0;
+				offset_xyz     = surf->numVerts * sizeof(vec2_t);
+				offset_normal  = offset_xyz + sizeof(vec3_t);
+				offset_tangent = offset_normal + sizeof(uint32_t);
+				stride_st  = sizeof(vec2_t);
+				stride_xyz = sizeof(vec3_t) + sizeof(uint32_t);
 #ifdef USE_VERT_TANGENT_SPACE
-			uint32_t *tangents;
+				stride_xyz += sizeof(uint32_t);
 #endif
+				stride_normal = stride_tangent = stride_xyz;
 
-			byte *data;
-			int dataSize;
-
-			int ofs_xyz, ofs_normal, ofs_st;
+				dataSize = offset_xyz + surf->numVerts * mdvModel->numFrames * stride_xyz;
+			}
+			else
+			{
+				// no animation, interleave everything
+				offset_xyz     = 0;
+				offset_st      = offset_xyz + sizeof(vec3_t);
+				offset_normal  = offset_st + sizeof(vec2_t);
+				offset_tangent = offset_normal + sizeof(uint32_t);
 #ifdef USE_VERT_TANGENT_SPACE
-			int ofs_tangent;
+				stride_xyz = offset_tangent + sizeof(uint32_t);
+#else
+				stride_xyz = offset_normal + sizeof(uint32_t);
 #endif
+				stride_st = stride_normal = stride_tangent = stride_xyz;
 
-			dataSize = 0;
+				dataSize = surf->numVerts * stride_xyz;
+			}
 
-			ofs_xyz = dataSize;
-			dataSize += surf->numVerts * mdvModel->numFrames * sizeof(*verts);
 
-			ofs_normal = dataSize;
-			dataSize += surf->numVerts * mdvModel->numFrames * sizeof(*normals);
+			data = ri.Z_Malloc(dataSize);
+			dataOfs = 0;
 
+			if (mdvModel->numFrames > 1)
+			{
+				st = surf->st;
+				for ( j = 0 ; j < surf->numVerts ; j++, st++ ) {
+					memcpy(data + dataOfs, &st->st, sizeof(st->st));
+					dataOfs += sizeof(st->st);
+				}
+
+				v = surf->verts;
+				for ( j = 0; j < surf->numVerts * mdvModel->numFrames ; j++, v++ )
+				{
 #ifdef USE_VERT_TANGENT_SPACE
-			ofs_tangent = dataSize;
-			dataSize += surf->numVerts * mdvModel->numFrames * sizeof(*tangents);
+					vec3_t nxt;
+					vec4_t tangent;
 #endif
+					uint32_t *p;
 
-			ofs_st = dataSize;
-			dataSize += surf->numVerts * sizeof(*texcoords);
+					// xyz
+					memcpy(data + dataOfs, &v->xyz, sizeof(v->xyz));
+					dataOfs += sizeof(v->xyz);
 
-			data = ri.Z_Malloc(dataSize);
+					// normal
+					p = (uint32_t *)(data + dataOfs);
+					*p = R_VaoPackNormal(v->normal);
+					dataOfs += sizeof(uint32_t);
 
-			verts =      (void *)(data + ofs_xyz);
-			normals =    (void *)(data + ofs_normal);
 #ifdef USE_VERT_TANGENT_SPACE
-			tangents =   (void *)(data + ofs_tangent);
+					CrossProduct(v->normal, v->tangent, nxt);
+					VectorCopy(v->tangent, tangent);
+					tangent[3] = (DotProduct(nxt, v->bitangent) < 0.0f) ? -1.0f : 1.0f;
+
+					// tangent
+					p = (uint32_t *)(data + dataOfs);
+					*p = R_VaoPackTangent(tangent);
+					dataOfs += sizeof(uint32_t);
 #endif
-			texcoords =  (void *)(data + ofs_st);
-		
-			v = surf->verts;
-			for ( j = 0; j < surf->numVerts * mdvModel->numFrames ; j++, v++ )
+				}
+			}
+			else
 			{
-				vec3_t nxt;
-				vec4_t tangent;
+				v = surf->verts;
+				st = surf->st;
+				for ( j = 0; j < surf->numVerts; j++, v++, st++ )
+				{
+#ifdef USE_VERT_TANGENT_SPACE
+					vec3_t nxt;
+					vec4_t tangent;
+#endif
+					uint32_t *p;
 
-				VectorCopy(v->xyz,       verts[j]);
+					// xyz
+					memcpy(data + dataOfs, &v->xyz, sizeof(v->xyz));
+					dataOfs += sizeof(v->xyz);
 
-				normals[j] = R_VaoPackNormal(v->normal);
-#ifdef USE_VERT_TANGENT_SPACE
-				CrossProduct(v->normal, v->tangent, nxt);
-				VectorCopy(v->tangent, tangent);
-				tangent[3] = (DotProduct(nxt, v->bitangent) < 0.0f) ? -1.0f : 1.0f;
+					// st
+					memcpy(data + dataOfs, &st->st, sizeof(st->st));
+					dataOfs += sizeof(st->st);
 
-				tangents[j] = R_VaoPackTangent(tangent);
-#endif
-			}
+					// normal
+					p = (uint32_t *)(data + dataOfs);
+					*p = R_VaoPackNormal(v->normal);
+					dataOfs += sizeof(uint32_t);
 
-			st = surf->st;
-			for ( j = 0 ; j < surf->numVerts ; j++, st++ ) {
-				texcoords[j][0] = st->st[0];
-				texcoords[j][1] = st->st[1];
+#ifdef USE_VERT_TANGENT_SPACE
+					CrossProduct(v->normal, v->tangent, nxt);
+					VectorCopy(v->tangent, tangent);
+					tangent[3] = (DotProduct(nxt, v->bitangent) < 0.0f) ? -1.0f : 1.0f;
+
+					// tangent
+					p = (uint32_t *)(data + dataOfs);
+					*p = R_VaoPackTangent(tangent);
+					dataOfs += sizeof(uint32_t);
+#endif
+				}
 			}
 
 			vaoSurf->surfaceType = SF_VAO_MDVMESH;
@@ -1003,7 +1057,7 @@ static qboolean R_LoadMDC( model_t *mod, int lod, void *buffer, const char *modN
 			vaoSurf->mdvSurface = surf;
 			vaoSurf->numIndexes = surf->numIndexes;
 			vaoSurf->numVerts = surf->numVerts;
-
+			
 			vaoSurf->minIndex = 0;
 			vaoSurf->maxIndex = surf->numVerts;
 
@@ -1043,27 +1097,23 @@ static qboolean R_LoadMDC( model_t *mod, int lod, void *buffer, const char *modN
 			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT2  ].normalized = GL_TRUE;
 			vaoSurf->vao->attribs[ATTR_INDEX_TEXCOORD  ].normalized = GL_FALSE;
 
-			vaoSurf->vao->attribs[ATTR_INDEX_POSITION  ].offset = ofs_xyz;
-			vaoSurf->vao->attribs[ATTR_INDEX_POSITION  ].stride = sizeof(*verts);
-			vaoSurf->vao->attribs[ATTR_INDEX_POSITION2 ].offset = ofs_xyz;
-			vaoSurf->vao->attribs[ATTR_INDEX_POSITION2 ].stride = sizeof(*verts);
-
-			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL    ].offset = ofs_normal;
-			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL    ].stride = sizeof(*normals);
-			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL2   ].offset = ofs_normal;
-			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL2   ].stride = sizeof(*normals);
+			vaoSurf->vao->attribs[ATTR_INDEX_POSITION  ].offset = offset_xyz;
+			vaoSurf->vao->attribs[ATTR_INDEX_POSITION2 ].offset = offset_xyz;
+			vaoSurf->vao->attribs[ATTR_INDEX_TEXCOORD  ].offset = offset_st;
+			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL    ].offset = offset_normal;
+			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL2   ].offset = offset_normal;
+			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT   ].offset = offset_tangent;
+			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT2  ].offset = offset_tangent;
 
-#ifdef USE_VERT_TANGENT_SPACE
-			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT   ].offset = ofs_tangent;
-			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT   ].stride = sizeof(*tangents);
-			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT2  ].offset = ofs_tangent;
-			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT2  ].stride = sizeof(*tangents);
-#endif
-			vaoSurf->vao->attribs[ATTR_INDEX_TEXCOORD  ].offset = ofs_st;
-			vaoSurf->vao->attribs[ATTR_INDEX_TEXCOORD  ].stride = sizeof(*st);
+			vaoSurf->vao->attribs[ATTR_INDEX_POSITION  ].stride = stride_xyz;
+			vaoSurf->vao->attribs[ATTR_INDEX_POSITION2 ].stride = stride_xyz;
+			vaoSurf->vao->attribs[ATTR_INDEX_TEXCOORD  ].stride = stride_st;
+			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL    ].stride = stride_normal;
+			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL2   ].stride = stride_normal;
+			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT   ].stride = stride_tangent;
+			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT2  ].stride = stride_tangent;
 
-			vaoSurf->vao->size_xyz    = sizeof(*verts)   * surf->numVerts;
-			vaoSurf->vao->size_normal = sizeof(*normals) * surf->numVerts;
+			vaoSurf->vao->frameSize = stride_xyz    * surf->numVerts;
 
 			Vao_SetVertexPointers(vaoSurf->vao);
 
@@ -1394,7 +1444,6 @@ static qboolean R_LoadMD3(model_t * mod, int lod, void *buffer, const char *modN
 		surf++;
 	}
 
-
 	{
 		srfVaoMdvMesh_t *vaoSurf;
 
@@ -1405,68 +1454,122 @@ static qboolean R_LoadMD3(model_t * mod, int lod, void *buffer, const char *modN
 		surf = mdvModel->surfaces;
 		for (i = 0; i < mdvModel->numSurfaces; i++, vaoSurf++, surf++)
 		{
-			vec3_t *verts;
-			vec2_t *texcoords;
-			uint32_t *normals;
+			uint32_t offset_xyz, offset_st, offset_normal, offset_tangent;
+			uint32_t stride_xyz, stride_st, stride_normal, stride_tangent;
+			uint32_t dataSize, dataOfs;
+			uint8_t *data;
+
+			if (mdvModel->numFrames > 1)
+			{
+				// vertex animation, store texcoords first, then position/normal/tangents
+				offset_st      = 0;
+				offset_xyz     = surf->numVerts * sizeof(vec2_t);
+				offset_normal  = offset_xyz + sizeof(vec3_t);
+				offset_tangent = offset_normal + sizeof(uint32_t);
+				stride_st  = sizeof(vec2_t);
+				stride_xyz = sizeof(vec3_t) + sizeof(uint32_t);
 #ifdef USE_VERT_TANGENT_SPACE
-			uint32_t *tangents;
+				stride_xyz += sizeof(uint32_t);
 #endif
+				stride_normal = stride_tangent = stride_xyz;
 
-			byte *data;
-			int dataSize;
-
-			int ofs_xyz, ofs_normal, ofs_st;
+				dataSize = offset_xyz + surf->numVerts * mdvModel->numFrames * stride_xyz;
+			}
+			else
+			{
+				// no animation, interleave everything
+				offset_xyz     = 0;
+				offset_st      = offset_xyz + sizeof(vec3_t);
+				offset_normal  = offset_st + sizeof(vec2_t);
+				offset_tangent = offset_normal + sizeof(uint32_t);
 #ifdef USE_VERT_TANGENT_SPACE
-			int ofs_tangent;
+				stride_xyz = offset_tangent + sizeof(uint32_t);
+#else
+				stride_xyz = offset_normal + sizeof(uint32_t);
 #endif
+				stride_st = stride_normal = stride_tangent = stride_xyz;
+
+				dataSize = surf->numVerts * stride_xyz;
+			}
 
-			dataSize = 0;
 
-			ofs_xyz = dataSize;
-			dataSize += surf->numVerts * mdvModel->numFrames * sizeof(*verts);
+			data = ri.Z_Malloc(dataSize);
+			dataOfs = 0;
 
-			ofs_normal = dataSize;
-			dataSize += surf->numVerts * mdvModel->numFrames * sizeof(*normals);
+			if (mdvModel->numFrames > 1)
+			{
+				st = surf->st;
+				for ( j = 0 ; j < surf->numVerts ; j++, st++ ) {
+					memcpy(data + dataOfs, &st->st, sizeof(st->st));
+					dataOfs += sizeof(st->st);
+				}
 
+				v = surf->verts;
+				for ( j = 0; j < surf->numVerts * mdvModel->numFrames ; j++, v++ )
+				{
 #ifdef USE_VERT_TANGENT_SPACE
-			ofs_tangent = dataSize;
-			dataSize += surf->numVerts * mdvModel->numFrames * sizeof(*tangents);
+					vec3_t nxt;
+					vec4_t tangent;
 #endif
+					uint32_t *p;
 
-			ofs_st = dataSize;
-			dataSize += surf->numVerts * sizeof(*texcoords);
+					// xyz
+					memcpy(data + dataOfs, &v->xyz, sizeof(v->xyz));
+					dataOfs += sizeof(v->xyz);
 
-			data = ri.Z_Malloc(dataSize);
+					// normal
+					p = (uint32_t *)(data + dataOfs);
+					*p = R_VaoPackNormal(v->normal);
+					dataOfs += sizeof(uint32_t);
 
-			verts =      (void *)(data + ofs_xyz);
-			normals =    (void *)(data + ofs_normal);
 #ifdef USE_VERT_TANGENT_SPACE
-			tangents =   (void *)(data + ofs_tangent);
+					CrossProduct(v->normal, v->tangent, nxt);
+					VectorCopy(v->tangent, tangent);
+					tangent[3] = (DotProduct(nxt, v->bitangent) < 0.0f) ? -1.0f : 1.0f;
+
+					// tangent
+					p = (uint32_t *)(data + dataOfs);
+					*p = R_VaoPackTangent(tangent);
+					dataOfs += sizeof(uint32_t);
 #endif
-			texcoords =  (void *)(data + ofs_st);
-		
-			v = surf->verts;
-			for ( j = 0; j < surf->numVerts * mdvModel->numFrames ; j++, v++ )
+				}
+			}
+			else
 			{
-				vec3_t nxt;
-				vec4_t tangent;
+				v = surf->verts;
+				st = surf->st;
+				for ( j = 0; j < surf->numVerts; j++, v++, st++ )
+				{
+#ifdef USE_VERT_TANGENT_SPACE
+					vec3_t nxt;
+					vec4_t tangent;
+#endif
+					uint32_t *p;
 
-				VectorCopy(v->xyz,       verts[j]);
+					// xyz
+					memcpy(data + dataOfs, &v->xyz, sizeof(v->xyz));
+					dataOfs += sizeof(v->xyz);
 
-				normals[j] = R_VaoPackNormal(v->normal);
-#ifdef USE_VERT_TANGENT_SPACE
-				CrossProduct(v->normal, v->tangent, nxt);
-				VectorCopy(v->tangent, tangent);
-				tangent[3] = (DotProduct(nxt, v->bitangent) < 0.0f) ? -1.0f : 1.0f;
+					// st
+					memcpy(data + dataOfs, &st->st, sizeof(st->st));
+					dataOfs += sizeof(st->st);
 
-				tangents[j] = R_VaoPackTangent(tangent);
-#endif
-			}
+					// normal
+					p = (uint32_t *)(data + dataOfs);
+					*p = R_VaoPackNormal(v->normal);
+					dataOfs += sizeof(uint32_t);
 
-			st = surf->st;
-			for ( j = 0 ; j < surf->numVerts ; j++, st++ ) {
-				texcoords[j][0] = st->st[0];
-				texcoords[j][1] = st->st[1];
+#ifdef USE_VERT_TANGENT_SPACE
+					CrossProduct(v->normal, v->tangent, nxt);
+					VectorCopy(v->tangent, tangent);
+					tangent[3] = (DotProduct(nxt, v->bitangent) < 0.0f) ? -1.0f : 1.0f;
+
+					// tangent
+					p = (uint32_t *)(data + dataOfs);
+					*p = R_VaoPackTangent(tangent);
+					dataOfs += sizeof(uint32_t);
+#endif
+				}
 			}
 
 			vaoSurf->surfaceType = SF_VAO_MDVMESH;
@@ -1474,7 +1577,7 @@ static qboolean R_LoadMD3(model_t * mod, int lod, void *buffer, const char *modN
 			vaoSurf->mdvSurface = surf;
 			vaoSurf->numIndexes = surf->numIndexes;
 			vaoSurf->numVerts = surf->numVerts;
-
+			
 			vaoSurf->minIndex = 0;
 			vaoSurf->maxIndex = surf->numVerts;
 
@@ -1514,27 +1617,23 @@ static qboolean R_LoadMD3(model_t * mod, int lod, void *buffer, const char *modN
 			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT2  ].normalized = GL_TRUE;
 			vaoSurf->vao->attribs[ATTR_INDEX_TEXCOORD  ].normalized = GL_FALSE;
 
-			vaoSurf->vao->attribs[ATTR_INDEX_POSITION  ].offset = ofs_xyz;
-			vaoSurf->vao->attribs[ATTR_INDEX_POSITION  ].stride = sizeof(*verts);
-			vaoSurf->vao->attribs[ATTR_INDEX_POSITION2 ].offset = ofs_xyz;
-			vaoSurf->vao->attribs[ATTR_INDEX_POSITION2 ].stride = sizeof(*verts);
-
-			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL    ].offset = ofs_normal;
-			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL    ].stride = sizeof(*normals);
-			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL2   ].offset = ofs_normal;
-			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL2   ].stride = sizeof(*normals);
-
-#ifdef USE_VERT_TANGENT_SPACE
-			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT   ].offset = ofs_tangent;
-			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT   ].stride = sizeof(*tangents);
-			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT2  ].offset = ofs_tangent;
-			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT2  ].stride = sizeof(*tangents);
-#endif
-			vaoSurf->vao->attribs[ATTR_INDEX_TEXCOORD  ].offset = ofs_st;
-			vaoSurf->vao->attribs[ATTR_INDEX_TEXCOORD  ].stride = sizeof(*st);
-
-			vaoSurf->vao->size_xyz    = sizeof(*verts)   * surf->numVerts;
-			vaoSurf->vao->size_normal = sizeof(*normals) * surf->numVerts;
+			vaoSurf->vao->attribs[ATTR_INDEX_POSITION  ].offset = offset_xyz;
+			vaoSurf->vao->attribs[ATTR_INDEX_POSITION2 ].offset = offset_xyz;
+			vaoSurf->vao->attribs[ATTR_INDEX_TEXCOORD  ].offset = offset_st;
+			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL    ].offset = offset_normal;
+			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL2   ].offset = offset_normal;
+			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT   ].offset = offset_tangent;
+			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT2  ].offset = offset_tangent;
+
+			vaoSurf->vao->attribs[ATTR_INDEX_POSITION  ].stride = stride_xyz;
+			vaoSurf->vao->attribs[ATTR_INDEX_POSITION2 ].stride = stride_xyz;
+			vaoSurf->vao->attribs[ATTR_INDEX_TEXCOORD  ].stride = stride_st;
+			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL    ].stride = stride_normal;
+			vaoSurf->vao->attribs[ATTR_INDEX_NORMAL2   ].stride = stride_normal;
+			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT   ].stride = stride_tangent;
+			vaoSurf->vao->attribs[ATTR_INDEX_TANGENT2  ].stride = stride_tangent;
+
+			vaoSurf->vao->frameSize = stride_xyz    * surf->numVerts;
 
 			Vao_SetVertexPointers(vaoSurf->vao);
 
diff --git a/SP/code/renderer/tr_local.h b/SP/code/renderer/tr_local.h
index 4c9ef07..4f9cafb 100644
--- a/SP/code/renderer/tr_local.h
+++ b/SP/code/renderer/tr_local.h
@@ -1084,8 +1084,6 @@ typedef struct {
 
 	int numImages;
 	image_t                 *images[MAX_DRAWIMAGES];
-	// Ridah
-	int numCacheImages;
 
 	// shader indexes from other modules will be looked up in tr.shaders[]
 	// shader indexes from drawsurfs will be looked up in sortedShaders[]

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git



More information about the Pkg-games-commits mailing list