summaryrefslogtreecommitdiff
path: root/src/renderergl2/tr_animation.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/renderergl2/tr_animation.c')
-rw-r--r--src/renderergl2/tr_animation.c143
1 files changed, 3 insertions, 140 deletions
diff --git a/src/renderergl2/tr_animation.c b/src/renderergl2/tr_animation.c
index 430fd9f8..96beb309 100644
--- a/src/renderergl2/tr_animation.c
+++ b/src/renderergl2/tr_animation.c
@@ -34,143 +34,6 @@ frame.
*/
-/*
-==============
-R_AddAnimSurfaces
-==============
-*/
-void R_AddAnimSurfaces( trRefEntity_t *ent ) {
- md4Header_t *header;
- md4Surface_t *surface;
- md4LOD_t *lod;
- shader_t *shader;
- int cubemapIndex;
- int i;
-
- header = (md4Header_t *) tr.currentModel->modelData;
- lod = (md4LOD_t *)( (byte *)header + header->ofsLODs );
- cubemapIndex = R_CubemapForPoint(ent->e.origin);
-
- surface = (md4Surface_t *)( (byte *)lod + lod->ofsSurfaces );
- for ( i = 0 ; i < lod->numSurfaces ; i++ ) {
- shader = R_GetShaderByHandle( surface->shaderIndex );
- R_AddDrawSurf( (void *)surface, shader, 0 /*fogNum*/, qfalse, qfalse, cubemapIndex );
- surface = (md4Surface_t *)( (byte *)surface + surface->ofsEnd );
- }
-}
-
-/*
-==============
-RB_SurfaceAnim
-==============
-*/
-void RB_SurfaceAnim( md4Surface_t *surface ) {
- int i, j, k;
- float frontlerp, backlerp;
- int *triangles;
- int indexes;
- int baseIndex, baseVertex;
- int numVerts;
- md4Vertex_t *v;
- md4Bone_t bones[MD4_MAX_BONES];
- md4Bone_t *bonePtr, *bone;
- md4Header_t *header;
- md4Frame_t *frame;
- md4Frame_t *oldFrame;
- int frameSize;
-
-
- if ( backEnd.currentEntity->e.oldframe == backEnd.currentEntity->e.frame ) {
- backlerp = 0;
- frontlerp = 1;
- } else {
- backlerp = backEnd.currentEntity->e.backlerp;
- frontlerp = 1.0f - backlerp;
- }
- header = (md4Header_t *)((byte *)surface + surface->ofsHeader);
-
- frameSize = (size_t)( &((md4Frame_t *)0)->bones[ header->numBones ] );
-
- frame = (md4Frame_t *)((byte *)header + header->ofsFrames +
- backEnd.currentEntity->e.frame * frameSize );
- oldFrame = (md4Frame_t *)((byte *)header + header->ofsFrames +
- backEnd.currentEntity->e.oldframe * frameSize );
-
- RB_CheckOverflow( surface->numVerts, surface->numTriangles * 3 );
-
- triangles = (int *) ((byte *)surface + surface->ofsTriangles);
- indexes = surface->numTriangles * 3;
- baseIndex = tess.numIndexes;
- baseVertex = tess.numVertexes;
- for (j = 0 ; j < indexes ; j++) {
- tess.indexes[baseIndex + j] = baseIndex + triangles[j];
- }
- tess.numIndexes += indexes;
-
- //
- // lerp all the needed bones
- //
- if ( !backlerp ) {
- // no lerping needed
- bonePtr = frame->bones;
- } else {
- bonePtr = bones;
- for ( i = 0 ; i < header->numBones*12 ; i++ ) {
- ((float *)bonePtr)[i] = frontlerp * ((float *)frame->bones)[i]
- + backlerp * ((float *)oldFrame->bones)[i];
- }
- }
-
- //
- // deform the vertexes by the lerped bones
- //
- numVerts = surface->numVerts;
- // FIXME
- // This makes TFC's skeletons work. Shouldn't be necessary anymore, but left
- // in for reference.
- //v = (md4Vertex_t *) ((byte *)surface + surface->ofsVerts + 12);
- v = (md4Vertex_t *) ((byte *)surface + surface->ofsVerts);
- for ( j = 0; j < numVerts; j++ ) {
- vec3_t tempVert, tempNormal;
- md4Weight_t *w;
-
- VectorClear( tempVert );
- VectorClear( tempNormal );
- w = v->weights;
- for ( k = 0 ; k < v->numWeights ; k++, w++ ) {
- bone = bonePtr + w->boneIndex;
-
- tempVert[0] += w->boneWeight * ( DotProduct( bone->matrix[0], w->offset ) + bone->matrix[0][3] );
- tempVert[1] += w->boneWeight * ( DotProduct( bone->matrix[1], w->offset ) + bone->matrix[1][3] );
- tempVert[2] += w->boneWeight * ( DotProduct( bone->matrix[2], w->offset ) + bone->matrix[2][3] );
-
- tempNormal[0] += w->boneWeight * DotProduct( bone->matrix[0], v->normal );
- tempNormal[1] += w->boneWeight * DotProduct( bone->matrix[1], v->normal );
- 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.normal[baseVertex + j][0] = (uint8_t)(tempNormal[0] * 127.5f + 128.0f);
- tess.normal[baseVertex + j][1] = (uint8_t)(tempNormal[1] * 127.5f + 128.0f);
- tess.normal[baseVertex + j][2] = (uint8_t)(tempNormal[2] * 127.5f + 128.0f);
-
- tess.texCoords[baseVertex + j][0][0] = v->texCoords[0];
- tess.texCoords[baseVertex + j][0][1] = v->texCoords[1];
-
- // FIXME
- // This makes TFC's skeletons work. Shouldn't be necessary anymore, but left
- // in for reference.
- //v = (md4Vertex_t *)( ( byte * )&v->weights[v->numWeights] + 12 );
- v = (md4Vertex_t *)&v->weights[v->numWeights];
- }
-
- tess.numVertexes += surface->numVerts;
-}
-
-
// copied and adapted from tr_mesh.c
@@ -199,7 +62,7 @@ static int R_MDRCullModel( mdrHeader_t *header, trRefEntity_t *ent ) {
switch ( R_CullLocalPointAndRadius( newFrame->localOrigin, newFrame->radius ) )
{
// Ummm... yeah yeah I know we don't really have an md3 here.. but we pretend
- // we do. After all, the purpose of md4s are not that different, are they?
+ // we do. After all, the purpose of mdrs are not that different, are they?
case CULL_OUT:
tr.pc.c_sphere_cull_md3_out++;
@@ -449,7 +312,7 @@ void R_MDRAddAnimSurfaces( trRefEntity_t *ent ) {
RB_MDRSurfaceAnim
==============
*/
-void RB_MDRSurfaceAnim( md4Surface_t *surface )
+void RB_MDRSurfaceAnim( mdrSurface_t *surface )
{
int i, j, k;
float frontlerp, backlerp;
@@ -461,7 +324,7 @@ void RB_MDRSurfaceAnim( md4Surface_t *surface )
mdrHeader_t *header;
mdrFrame_t *frame;
mdrFrame_t *oldFrame;
- mdrBone_t bones[MD4_MAX_BONES], *bonePtr, *bone;
+ mdrBone_t bones[MDR_MAX_BONES], *bonePtr, *bone;
int frameSize;