]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
now loads md3 tags
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 22 Jul 2003 20:02:16 +0000 (20:02 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 22 Jul 2003 20:02:16 +0000 (20:02 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3315 d7cf8633-e32d-0410-b094-e92efae38249

model_alias.c
model_alias.h
model_shared.h

index 61ee65072d71875cfc97c9965ee6ce228b763ca7..4488936f3dafeb8d636640aaa2dbfbe87650fa80 100644 (file)
@@ -723,10 +723,11 @@ void Mod_IDP2_Load(model_t *mod, void *buffer)
 
 void Mod_IDP3_Load(model_t *mod, void *buffer)
 {
-       int i, j, version;
+       int i, j, k, version;
        md3modelheader_t *pinmodel;
        md3frameinfo_t *pinframe;
        md3mesh_t *pinmesh;
+       md3tag_t *pintag;
        aliasmesh_t *mesh;
        skinframe_t tempskinframe;
 
@@ -770,7 +771,21 @@ void Mod_IDP3_Load(model_t *mod, void *buffer)
                loadmodel->animscenes[i].loop = true;
        }
 
-       // tags are not loaded yet
+       // load tags
+       loadmodel->alias.aliasnum_tagframes = loadmodel->numframes;
+       loadmodel->alias.aliasnum_tags = LittleLong(pinmodel->num_tags);
+       loadmodel->alias.aliasdata_tags = Mem_Alloc(loadmodel->mempool, loadmodel->alias.aliasnum_tagframes * loadmodel->alias.aliasnum_tags * sizeof(aliastag_t));
+       for (i = 0, pintag = (md3tag_t *)((qbyte *)pinmodel + LittleLong(pinmodel->lump_tags));i < loadmodel->alias.aliasnum_tagframes * loadmodel->alias.aliasnum_tags;i++, pinframe++)
+       {
+               strcpy(loadmodel->alias.aliasdata_tags[i].name, pintag->name);
+               Matrix4x4_CreateIdentity(&loadmodel->alias.aliasdata_tags[i].matrix);
+               for (j = 0;j < 3;j++)
+               {
+                       for (k = 0;k < 3;k++)
+                               loadmodel->alias.aliasdata_tags[i].matrix.m[k][j] = LittleLong(pintag->rotationmatrix[j * 3 + k]);
+                       loadmodel->alias.aliasdata_tags[i].matrix.m[j][3] = LittleLong(pintag->origin[j]);
+               }
+       }
 
        // load meshes
        loadmodel->alias.aliasdata_meshes = Mem_Alloc(loadmodel->mempool, loadmodel->alias.aliasnum_meshes * sizeof(aliasmesh_t));
index aa15feaf0de99244ef1b0848cbc6cb56c4b99c0e..ba62714a838a740efb994b98851f8cdbca69b65e 100644 (file)
@@ -270,5 +270,13 @@ typedef struct aliasmesh_s
 }
 aliasmesh_t;
 
+typedef struct aliastag_s
+{
+       char name[MD3NAME];
+       matrix4x4_t matrix;
+}
+aliastag_t;
+
+
 #endif
 
index 2de9ec8ff6dca8be2879d9ab6b01e25cfb4316f8..2fc1937d34a464d191dcb6c35f7244ff683b41d9 100644 (file)
@@ -83,12 +83,12 @@ typedef struct shadowmesh_s
 shadowmesh_t;
 
 
+#include "matrixlib.h"
+
 #include "model_brush.h"
 #include "model_sprite.h"
 #include "model_alias.h"
 
-#include "matrixlib.h"
-
 typedef struct model_alias_s
 {
        // LordHavoc: Q2/ZYM model support
@@ -98,6 +98,10 @@ typedef struct model_alias_s
        int                             aliasnum_meshes;
        aliasmesh_t             *aliasdata_meshes;
 
+       int                             aliasnum_tags;
+       int                             aliasnum_tagframes;
+       aliastag_t              *aliasdata_tags;
+
        // for Zymotic models
        int                             zymnum_verts;
        int                             zymnum_tris;