From 5a2506c15b552f73998d5cb90326d6c7185e3ef7 Mon Sep 17 00:00:00 2001 From: havoc Date: Mon, 2 Dec 2002 01:28:30 +0000 Subject: [PATCH] optimized single frame lerp case removed FetchSkinFrame mesh rendering loop now... advances the mesh git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2665 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_models.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/gl_models.c b/gl_models.c index 1ca1f841..128214a1 100644 --- a/gl_models.c +++ b/gl_models.c @@ -173,24 +173,17 @@ void R_Model_Alias_GetMeshVerts(const entity_render_t *ent, aliasmesh_t *mesh, f VectorM(lerp1, verts1->normal, normals); } } - else + else if (lerp1 != 1) + { for (i = 0;i < vertcount;i++, vertices += 4, verts1++) VectorM(lerp1, verts1->origin, vertices); + } + else + for (i = 0;i < vertcount;i++, vertices += 4, verts1++) + VectorCopy(verts1->origin, vertices); } } -skinframe_t *R_FetchSkinFrame(const entity_render_t *ent) -{ - model_t *model = ent->model; - int s = ent->skinnum; - if ((unsigned int)s >= (unsigned int)model->numskins) - s = 0; - if (model->skinscenes[s].framecount > 1) - return &model->skinframes[model->skinscenes[s].firstframe + (int) (cl.time * 10) % model->skinscenes[s].framecount]; - else - return &model->skinframes[model->skinscenes[s].firstframe]; -} - aliasskin_t *R_FetchAliasSkin(const entity_render_t *ent, const aliasmesh_t *mesh) { model_t *model = ent->model; @@ -201,8 +194,8 @@ aliasskin_t *R_FetchAliasSkin(const entity_render_t *ent, const aliasmesh_t *mes s = model->skinscenes[s].firstframe + (int) (cl.time * model->skinscenes[s].framerate) % model->skinscenes[s].framecount; else s = model->skinscenes[s].firstframe; - if (s > mesh->num_skins) - return mesh->data_skins; + if (s >= mesh->num_skins) + s = 0; return mesh->data_skins + s; } @@ -411,7 +404,7 @@ void R_Model_Alias_DrawShadowVolume(entity_render_t *ent, vec3_t relativelightor if (projectdistance > 0.1) { R_Mesh_Matrix(&ent->matrix); - for (meshnum = 0, mesh = ent->model->aliasdata_meshes;meshnum < ent->model->aliasnum_meshes;meshnum++) + for (meshnum = 0, mesh = ent->model->aliasdata_meshes;meshnum < ent->model->aliasnum_meshes;meshnum++, mesh++) { skin = R_FetchAliasSkin(ent, mesh); if (skin->flags & ALIASSKIN_TRANSPARENT) -- 2.39.2