]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
handle no-bones case for skeletal animation
authoreihrul <eihrul@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 30 Sep 2011 14:00:19 +0000 (14:00 +0000)
committereihrul <eihrul@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 30 Sep 2011 14:00:19 +0000 (14:00 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11376 d7cf8633-e32d-0410-b094-e92efae38249

mod_skeletal_animatevertices_generic.c
mod_skeletal_animatevertices_sse.c
model_alias.c

index 24cc8a9e8eb2f2f40605971310533d1f3847b3d5..f95277af84079a0fda368d35e1eae445b6ef4d0d 100644 (file)
@@ -19,6 +19,15 @@ void Mod_Skeletal_AnimateVertices_Generic(const dp_model_t * RESTRICT model, con
        if (!model->surfmesh.num_vertices)
                return;
 
+       if (!model->num_bones)
+       {
+               if (vertex3f) memcpy(vertex3f, model->surfmesh.data_vertex3f, model->surfmesh.num_vertices*sizeof(float[3]));
+               if (normal3f) memcpy(normal3f, model->surfmesh.data_normal3f, model->surfmesh.num_vertices*sizeof(float[3]));
+               if (svector3f) memcpy(svector3f, model->surfmesh.data_svector3f, model->surfmesh.num_vertices*sizeof(float[3]));
+               if (tvector3f) memcpy(tvector3f, model->surfmesh.data_tvector3f, model->surfmesh.num_vertices*sizeof(float[3]));
+               return;
+       }
+
        //unsigned long long ts = rdtsc();
        bonepose = (float12_t *) Mod_Skeletal_AnimateVertices_AllocBuffers(sizeof(float12_t) * (model->num_bones*2 + model->surfmesh.num_blends));
        boneposerelative = bonepose + model->num_bones;
index 06d74317147200df89267e118097f6326a10f8d1..8c41b600c45594020a29e6b736e82278a6c7b593 100644 (file)
@@ -23,6 +23,15 @@ void Mod_Skeletal_AnimateVertices_SSE(const dp_model_t * RESTRICT model, const f
        if (!model->surfmesh.num_vertices)
                return;
 
+       if (!model->num_bones)
+       {
+               if (vertex3f) memcpy(vertex3f, model->surfmesh.data_vertex3f, model->surfmesh.num_vertices*sizeof(float[3]));
+               if (normal3f) memcpy(normal3f, model->surfmesh.data_normal3f, model->surfmesh.num_vertices*sizeof(float[3]));
+               if (svector3f) memcpy(svector3f, model->surfmesh.data_svector3f, model->surfmesh.num_vertices*sizeof(float[3]));
+               if (tvector3f) memcpy(tvector3f, model->surfmesh.data_tvector3f, model->surfmesh.num_vertices*sizeof(float[3]));
+               return;
+       }
+
        num_vertices_minus_one = model->surfmesh.num_vertices - 1;
 
        //unsigned long long ts = rdtsc();
index c1b03c904aff01d68de29cb9e540118c50847f90..6982028ec6b8c90be19a44e48d3c9d6a7fa68865 100644 (file)
@@ -40,25 +40,25 @@ cvar_t mod_alias_supporttagscale = {0, "mod_alias_supporttagscale", "1", "suppor
 
 float mod_md3_sin[320];
 
-static size_t Mod_Skeltal_AnimateVertices_maxbonepose = 0;
-static void *Mod_Skeltal_AnimateVertices_bonepose = NULL;
+static size_t Mod_Skeletal_AnimateVertices_maxbonepose = 0;
+static void *Mod_Skeletal_AnimateVertices_bonepose = NULL;
 void Mod_Skeletal_FreeBuffers(void)
 {
-       if(Mod_Skeltal_AnimateVertices_bonepose)
-               Mem_Free(Mod_Skeltal_AnimateVertices_bonepose);
-       Mod_Skeltal_AnimateVertices_maxbonepose = 0;
-       Mod_Skeltal_AnimateVertices_bonepose = NULL;
+       if(Mod_Skeletal_AnimateVertices_bonepose)
+               Mem_Free(Mod_Skeletal_AnimateVertices_bonepose);
+       Mod_Skeletal_AnimateVertices_maxbonepose = 0;
+       Mod_Skeletal_AnimateVertices_bonepose = NULL;
 }
 void *Mod_Skeletal_AnimateVertices_AllocBuffers(size_t nbytes)
 {
-       if(Mod_Skeltal_AnimateVertices_maxbonepose < nbytes)
+       if(Mod_Skeletal_AnimateVertices_maxbonepose < nbytes)
        {
-               if(Mod_Skeltal_AnimateVertices_bonepose)
-                       Mem_Free(Mod_Skeltal_AnimateVertices_bonepose);
-               Mod_Skeltal_AnimateVertices_bonepose = Z_Malloc(nbytes);
-               Mod_Skeltal_AnimateVertices_maxbonepose = nbytes;
+               if(Mod_Skeletal_AnimateVertices_bonepose)
+                       Mem_Free(Mod_Skeletal_AnimateVertices_bonepose);
+               Mod_Skeletal_AnimateVertices_bonepose = Z_Malloc(nbytes);
+               Mod_Skeletal_AnimateVertices_maxbonepose = nbytes;
        }
-       return Mod_Skeltal_AnimateVertices_bonepose;
+       return Mod_Skeletal_AnimateVertices_bonepose;
 }
 
 void Mod_Skeletal_AnimateVertices(const dp_model_t * RESTRICT model, const frameblend_t * RESTRICT frameblend, const skeleton_t *skeleton, float * RESTRICT vertex3f, float * RESTRICT normal3f, float * RESTRICT svector3f, float * RESTRICT tvector3f)