]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - model_shared.h
corrected a few LittleLongs to LittleFloat in md3 loading (EEP those were bad)
[xonotic/darkplaces.git] / model_shared.h
index 0265d89217c1c95efea8892f98c11cda3beb962e..0d22a5010dc5a4455824126b3b0f6c44ed967e76 100644 (file)
@@ -61,6 +61,20 @@ skinframe_t;
 
 #define MAX_SKINS 256
 
+typedef struct overridetagname_s
+{
+       char name[MAX_QPATH];
+}
+overridetagname_t;
+
+// a replacement set of tag names, per skin
+typedef struct overridetagnameset_s
+{
+       int num_overridetagnames;
+       overridetagname_t *data_overridetagnames;
+}
+overridetagnameset_t;
+
 #define SHADOWMESHVERTEXHASH 1024
 typedef struct shadowmeshvertexhash_s
 {
@@ -83,12 +97,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 +112,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;
@@ -122,9 +140,13 @@ typedef struct model_sprite_s
 }
 model_sprite_t;
 
+struct trace_s;
+
 typedef struct model_brush_s
 {
-       char                    *entities;
+       char *entities;
+       void (*FindNonSolidLocation)(struct model_s *model, const vec3_t in, vec3_t out, vec_t radius);
+       void (*TraceBox)(struct model_s *model, struct trace_s *trace, const vec3_t boxstartmins, const vec3_t boxstartmaxs, const vec3_t boxendmins, const vec3_t boxendmaxs);
 }
 model_brush_t;
 
@@ -216,18 +238,18 @@ typedef struct model_brushq1_s
        int                             light_scalebit;
        float                   light_ambient;
 
-       void (*FindNonSolidLocation)(struct model_s *model, const vec3_t in, vec3_t out, vec_t radius);
        mleaf_t *(*PointInLeaf)(struct model_s *model, const float *p);
-       int (*PointContents)(struct model_s *model, const float *p);
        qbyte *(*LeafPVS)(struct model_s *model, mleaf_t *leaf);
        void (*BuildPVSTextureChains)(struct model_s *model);
 }
 model_brushq1_t;
 
+/* MSVC can't compile empty structs, so this is commented out for now
 typedef struct model_brushq2_s
 {
 }
 model_brushq2_t;
+*/
 
 typedef struct q3mtexture_s
 {
@@ -243,8 +265,8 @@ q3mtexture_t;
 typedef struct q3mnode_s
 {
        int isnode; // true
-       struct mplane_s *plane;
        struct q3mnode_s *parent;
+       struct mplane_s *plane;
        struct q3mnode_s *children[2];
 }
 q3mnode_t;
@@ -252,14 +274,15 @@ q3mnode_t;
 typedef struct q3mleaf_s
 {
        int isnode; // false
+       struct q3mnode_s *parent;
        int clusterindex;
        int areaindex;
-       vec3_t mins[3];
-       vec3_t maxs[3];
        int numleaffaces;
-       struct q3mface_s **leaffaces;
+       struct q3mface_s **firstleafface;
        int numleafbrushes;
-       struct q3mbrush_s **leafbrushes;
+       struct q3mbrush_s **firstleafbrush;
+       vec3_t mins;
+       vec3_t maxs;
 }
 q3mleaf_t;
 
@@ -268,16 +291,16 @@ typedef struct q3mmodel_s
        vec3_t mins;
        vec3_t maxs;
        int numfaces;
-       struct q3mface_s *faces;
+       struct q3mface_s *firstface;
        int numbrushes;
-       struct q3mbrush_s *brushes;
+       struct q3mbrush_s *firstbrush;
 }
 q3mmodel_t;
 
 typedef struct q3mbrush_s
 {
-       int numsides;
-       struct q3mbrushside_s *sides;
+       int numbrushsides;
+       struct q3mbrushside_s *firstbrushside;
        struct q3mtexture_s *texture;
 }
 q3mbrush_t;
@@ -301,6 +324,7 @@ typedef struct q3mface_s
 {
        struct q3mtexture_s *texture;
        struct q3meffect_s *effect;
+       rtexture_t *lightmaptexture;
        int type;
        int firstvertex;
        int numvertices;
@@ -315,6 +339,9 @@ typedef struct q3mface_s
        float *data_tvector3f;
        float *data_normal3f;
        float *data_color4f;
+       int numtriangles;
+       int *data_element3i;
+       int *data_neighbor3i;
 }
 q3mface_t;
 
@@ -332,6 +359,12 @@ typedef struct model_brushq3_s
        int num_leafs;
        q3mleaf_t *data_leafs;
 
+       int num_leafbrushes;
+       q3mbrush_t **data_leafbrushes;
+
+       int num_leaffaces;
+       q3mface_t **data_leaffaces;
+
        int num_models;
        q3mmodel_t *data_models;
        // each submodel gets its own model struct so this is different for each.
@@ -347,6 +380,8 @@ typedef struct model_brushq3_s
        float *data_vertex3f;
        float *data_texturetexcoord2f;
        float *data_lightmaptexcoord2f;
+       float *data_svector3f;
+       float *data_tvector3f;
        float *data_normal3f;
        float *data_color4f;
 
@@ -355,18 +390,30 @@ typedef struct model_brushq3_s
        int *data_neighbor3i;
 
        int num_effects;
-       q3meffect_t data_effects;
+       q3meffect_t *data_effects;
 
        int num_faces;
        q3mface_t *data_faces;
 
        // lightmap textures
        int num_lightmaps;
-       rtexture_t *data_lightmaps;
-
-       // transform world coordinates to lightgrid index
+       rtexture_t **data_lightmaps;
+
+       // voxel light data with directional shading
+       int num_lightgrid;
+       q3dlightgrid_t *data_lightgrid;
+       // size of each cell (may vary by map, typically 64 64 128)
+       float num_lightgrid_cellsize[3];
+       // 1.0 / num_lightgrid_cellsize
+       float num_lightgrid_scale[3];
+       // dimensions of the world model in lightgrid cells
+       int num_lightgrid_imins[3];
+       int num_lightgrid_imaxs[3];
+       int num_lightgrid_isize[3];
+       // indexing/clamping
+       int num_lightgrid_dimensions[3];
+       // transform modelspace coordinates to lightgrid index
        matrix4x4_t num_lightgrid_indexfromworld;
-       q3dlightgrid_t *data_lightgrid_cells;
 
        // pvs
        int num_pvsclusters;
@@ -420,8 +467,6 @@ typedef struct model_s
        float                   radius2;
        // skin animation info
        animscene_t             *skinscenes; // [numskins]
-       // skin frame info
-       skinframe_t             *skinframes;
        // skin animation info
        animscene_t             *animscenes; // [numframes]
        // draw the model's sky polygons (only used by brush models)
@@ -439,8 +484,12 @@ typedef struct model_s
        model_sprite_t  sprite;
        model_brush_t   brush;
        model_brushq1_t brushq1;
+       /* MSVC can't handle an empty struct, so this is commented out for now
        model_brushq2_t brushq2;
+       */
        model_brushq3_t brushq3;
+       // skin files can have different tags for each skin
+       overridetagnameset_t    *data_overridetagnamesforskin;
 }
 model_t;
 
@@ -495,5 +544,26 @@ void Mod_ShadowMesh_Free(shadowmesh_t *mesh);
 int Mod_LoadSkinFrame(skinframe_t *skinframe, char *basename, int textureflags, int loadpantsandshirt, int usedetailtexture, int loadglowtexture);
 int Mod_LoadSkinFrame_Internal(skinframe_t *skinframe, char *basename, int textureflags, int loadpantsandshirt, int usedetailtexture, int loadglowtexture, qbyte *skindata, int width, int height);
 
+extern cvar_t r_mipskins;
+
+typedef struct skinfileitem_s
+{
+       struct skinfileitem_s *next;
+       char name[MAX_QPATH];
+       char replacement[MAX_QPATH];
+}
+skinfileitem_t;
+
+typedef struct skinfile_s
+{
+       struct skinfile_s *next;
+       skinfileitem_t *items;
+}
+skinfile_t;
+
+skinfile_t *Mod_LoadSkinFiles(void);
+void Mod_FreeSkinFiles(skinfile_t *skinfile);
+int Mod_CountSkinFiles(skinfile_t *skinfile);
+
 #endif // __MODEL__