*/
-typedef enum modtype_e {mod_invalid, mod_brushq1, mod_sprite, mod_alias, mod_brushq2, mod_brushq3} modtype_t;
+typedef enum modtype_e {mod_invalid, mod_brushq1, mod_sprite, mod_alias, mod_brushq2, mod_brushq3, mod_null} modtype_t;
typedef struct animscene_s
{
int loadsequence;
// on 32bit systems this makes the struct 128 bytes long
int padding;
+ // average texture color, if applicable
+ float avgcolor[4];
}
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;
-
struct md3vertex_s;
struct trivertx_s;
typedef struct texvecvertex_s
// triangle data in system memory
int num_triangles; // number of triangles in the mesh
int *data_element3i; // int[tris*3] triangles of the mesh, 3 indices into vertex arrays for each
+ unsigned short *data_element3s; // unsigned short[tris*3] triangles of the mesh in unsigned short format (NULL if num_vertices > 65536)
int *data_neighbor3i; // int[tris*3] neighboring triangle on each edge (-1 if none)
// element buffer object (stores triangles in video memory)
- int ebo;
+ int ebo3i; // unsigned int format (only allocated if num_vertices > 65536)
+ int ebo3s; // unsigned short format (only allocated if num_vertices <= 65536)
// vertex data in system memory
int num_vertices; // number of vertices in the mesh
float *data_vertex3f; // float[verts*3] vertex locations
float *texcoord2f;
// used always
int *element3i;
+ unsigned short *element3s;
// used for shadow mesh (NULL on light mesh)
int *neighbor3i;
// these are NULL after Mod_ShadowMesh_Finish is performed, only used
shadowmeshvertexhash_t **vertexhashtable, *vertexhashentries;
// element buffer object (stores triangles in video memory)
// (created by Mod_ShadowMesh_Finish if possible)
- int ebo;
+ int ebo3i;
+ int ebo3s;
// vertex buffer object (stores vertices in video memory)
// (created by Mod_ShadowMesh_Finish if possible)
int vbo;
Q3TCMOD_STRETCH,
Q3TCMOD_TRANSFORM,
Q3TCMOD_TURBULENT,
+ Q3TCMOD_PAGE,
Q3TCMOD_COUNT
}
q3tcmod_t;
int clampmap;
float framerate;
int numframes;
+ int texflags;
char** texturename;
int blendfunc[2];
q3shaderinfo_layer_rgbgen_t rgbgen;
char skyboxname[Q3PATHLENGTH];
q3shaderinfo_deform_t deforms[Q3MAXDEFORMS];
+ // dp-specific additions:
+
+ // shadow control
+ qboolean dpshadow;
+ qboolean dpnoshadow;
+
// reflection
float reflectmin; // when refraction is used, minimum amount of reflection (when looking straight down)
float reflectmax; // when refraction is used, maximum amount of reflection (when looking parallel to water)
int num_firstshadowmeshtriangle; // index into model->brush.shadowmesh
// lightmaptexture rebuild information not used in q3bsp
- int cached_dlight; // q1bsp // forces rebuild of lightmaptexture
msurface_lightmapinfo_t *lightmapinfo; // q1bsp
// mesh information for collisions (only used by q3bsp curves)
// lightmap update chains for light styles
int num_lightstyles;
model_brush_lightstyleinfo_t *data_lightstyleinfo;
+
+ // this contains bytes that are 1 if a surface needs its lightmap rebuilt
+ unsigned char *lightmapupdateflags;
}
model_brushq1_t;
// true if the detected deluxemaps are the modelspace kind, rather than
// the faster tangentspace kind
qboolean deluxemapping_modelspace;
+ // size of lightmaps (128 by default, but may be another poweroftwo if
+ // external lightmaps are used (q3map2 -lightmapsize)
+ int lightmapsize;
}
model_brushq3_t;
+struct frameblend_s;
+
typedef struct model_s
{
// name and path of model, for example "progs/player.mdl"
surfmesh_t surfmesh;
// data type of model
const char *modeldatatypestring;
+ // generates vertex data for a given frameblend
+ void(*AnimateVertices)(const struct model_s *model, const struct frameblend_s *frameblend, float *vertex3f, float *normal3f, float *svector3f, float *tvector3f);
// draw the model's sky polygons (only used by brush models)
void(*DrawSky)(struct entity_render_s *ent);
// draw refraction/reflection textures for the model's water polygons (only used by brush models)
// draw any enabled debugging effects on this model (such as showing triangles, normals, collision brushes...)
void(*DrawDebug)(struct entity_render_s *ent);
// gathers info on which clusters and surfaces are lit by light, as well as calculating a bounding box
- void(*GetLightInfo)(struct entity_render_s *ent, vec3_t relativelightorigin, float lightradius, vec3_t outmins, vec3_t outmaxs, int *outleaflist, unsigned char *outleafpvs, int *outnumleafspointer, int *outsurfacelist, unsigned char *outsurfacepvs, int *outnumsurfacespointer, unsigned char *outshadowtrispvs, unsigned char *outlighttrispvs);
+ void(*GetLightInfo)(struct entity_render_s *ent, vec3_t relativelightorigin, float lightradius, vec3_t outmins, vec3_t outmaxs, int *outleaflist, unsigned char *outleafpvs, int *outnumleafspointer, int *outsurfacelist, unsigned char *outsurfacepvs, int *outnumsurfacespointer, unsigned char *outshadowtrispvs, unsigned char *outlighttrispvs, unsigned char *visitingleafpvs);
// compile a shadow volume for the model based on light source
void(*CompileShadowVolume)(struct entity_render_s *ent, vec3_t relativelightorigin, vec3_t relativelightdirection, float lightradius, int numsurfaces, const int *surfacelist);
// draw a shadow volume for the model based on light source
- void(*DrawShadowVolume)(struct entity_render_s *ent, vec3_t relativelightorigin, vec3_t relativelightdirection, float lightradius, int numsurfaces, const int *surfacelist, const vec3_t lightmins, const vec3_t lightmaxs);
+ void(*DrawShadowVolume)(struct entity_render_s *ent, const vec3_t relativelightorigin, const vec3_t relativelightdirection, float lightradius, int numsurfaces, const int *surfacelist, const vec3_t lightmins, const vec3_t lightmaxs);
// draw the lighting on a model (through stencil)
void(*DrawLight)(struct entity_render_s *ent, int numsurfaces, const int *surfacelist, const unsigned char *trispvs);
// trace a box against this model
model_brushq2_t brushq2;
*/
model_brushq3_t brushq3;
- // skin files can have different tags for each skin
- overridetagnameset_t *data_overridetagnamesforskin;
// flags this model for offseting sounds to the model center (used by brush models)
int soundfromcenter;
}
-model_t;
+dp_model_t;
//============================================================================
// model loading
-extern model_t *loadmodel;
+extern dp_model_t *loadmodel;
extern unsigned char *mod_base;
// sky/water subdivision
//extern cvar_t gl_subdivide_size;
void Mod_Init (void);
void Mod_Reload (void);
-model_t *Mod_LoadModel(model_t *mod, qboolean crash, qboolean checkdisk, qboolean isworldmodel);
-model_t *Mod_FindName (const char *name);
-model_t *Mod_ForName (const char *name, qboolean crash, qboolean checkdisk, qboolean isworldmodel);
-void Mod_UnloadModel (model_t *mod);
+dp_model_t *Mod_LoadModel(dp_model_t *mod, qboolean crash, qboolean checkdisk, qboolean isworldmodel);
+dp_model_t *Mod_FindName (const char *name);
+dp_model_t *Mod_ForName (const char *name, qboolean crash, qboolean checkdisk, qboolean isworldmodel);
+void Mod_UnloadModel (dp_model_t *mod);
void Mod_ClearUsed(void);
void Mod_PurgeUnused(void);
-void Mod_RemoveStaleWorldModels(model_t *skip); // only used during loading!
+void Mod_RemoveStaleWorldModels(dp_model_t *skip); // only used during loading!
-extern model_t *loadmodel;
+extern dp_model_t *loadmodel;
extern char loadname[32]; // for hunk tags
int Mod_BuildVertexRemapTableFromElements(int numelements, const int *elements, int numvertices, int *remapvertices);
void Mod_LoadQ3Shaders(void);
q3shaderinfo_t *Mod_LookupQ3Shader(const char *name);
-qboolean Mod_LoadTextureFromQ3Shader(texture_t *texture, const char *name, qboolean q1bsp, qboolean q3bsp, qboolean md3);
+qboolean Mod_LoadTextureFromQ3Shader(texture_t *texture, const char *name, qboolean warnmissing, qboolean fallback, int defaulttexflags);
extern cvar_t r_mipskins;
void R_Q1BSP_Draw(struct entity_render_s *ent);
void R_Q1BSP_DrawDepth(struct entity_render_s *ent);
void R_Q1BSP_DrawDebug(struct entity_render_s *ent);
-void R_Q1BSP_GetLightInfo(struct entity_render_s *ent, vec3_t relativelightorigin, float lightradius, vec3_t outmins, vec3_t outmaxs, int *outleaflist, unsigned char *outleafpvs, int *outnumleafspointer, int *outsurfacelist, unsigned char *outsurfacepvs, int *outnumsurfacespointer, unsigned char *outshadowtrispvs, unsigned char *outlighttrispvs);
+void R_Q1BSP_GetLightInfo(struct entity_render_s *ent, vec3_t relativelightorigin, float lightradius, vec3_t outmins, vec3_t outmaxs, int *outleaflist, unsigned char *outleafpvs, int *outnumleafspointer, int *outsurfacelist, unsigned char *outsurfacepvs, int *outnumsurfacespointer, unsigned char *outshadowtrispvs, unsigned char *outlighttrispvs, unsigned char *visitingleafpvs);
void R_Q1BSP_CompileShadowVolume(struct entity_render_s *ent, vec3_t relativelightorigin, vec3_t relativelightdirection, float lightradius, int numsurfaces, const int *surfacelist);
-void R_Q1BSP_DrawShadowVolume(struct entity_render_s *ent, vec3_t relativelightorigin, vec3_t relativelightdirection, float lightradius, int numsurfaces, const int *surfacelist, const vec3_t lightmins, const vec3_t lightmaxs);
+void R_Q1BSP_DrawShadowVolume(struct entity_render_s *ent, const vec3_t relativelightorigin, const vec3_t relativelightdirection, float lightradius, int numsurfaces, const int *surfacelist, const vec3_t lightmins, const vec3_t lightmaxs);
void R_Q1BSP_DrawLight(struct entity_render_s *ent, int numsurfaces, const int *surfacelist, const unsigned char *trispvs);
// alias models
struct frameblend_s;
void Mod_AliasInit(void);
-void Mod_Alias_GetMesh_Vertices(const model_t *model, const struct frameblend_s *frameblend, float *vertex3f, float *normal3f, float *svector3f, float *tvector3f);
-int Mod_Alias_GetTagMatrix(const model_t *model, int poseframe, int tagindex, matrix4x4_t *outmatrix);
-int Mod_Alias_GetTagIndexForName(const model_t *model, unsigned int skin, const char *tagname);
+int Mod_Alias_GetTagMatrix(const dp_model_t *model, int poseframe, int tagindex, matrix4x4_t *outmatrix);
+int Mod_Alias_GetTagIndexForName(const dp_model_t *model, unsigned int skin, const char *tagname);
// sprite models
void Mod_SpriteInit(void);
// loaders
-void Mod_Q1BSP_Load(model_t *mod, void *buffer, void *bufferend);
-void Mod_IBSP_Load(model_t *mod, void *buffer, void *bufferend);
-void Mod_MAP_Load(model_t *mod, void *buffer, void *bufferend);
-void Mod_IDP0_Load(model_t *mod, void *buffer, void *bufferend);
-void Mod_IDP2_Load(model_t *mod, void *buffer, void *bufferend);
-void Mod_IDP3_Load(model_t *mod, void *buffer, void *bufferend);
-void Mod_ZYMOTICMODEL_Load(model_t *mod, void *buffer, void *bufferend);
-void Mod_DARKPLACESMODEL_Load(model_t *mod, void *buffer, void *bufferend);
-void Mod_PSKMODEL_Load(model_t *mod, void *buffer, void *bufferend);
-void Mod_IDSP_Load(model_t *mod, void *buffer, void *bufferend);
-void Mod_IDS2_Load(model_t *mod, void *buffer, void *bufferend);
+void Mod_Q1BSP_Load(dp_model_t *mod, void *buffer, void *bufferend);
+void Mod_IBSP_Load(dp_model_t *mod, void *buffer, void *bufferend);
+void Mod_MAP_Load(dp_model_t *mod, void *buffer, void *bufferend);
+void Mod_IDP0_Load(dp_model_t *mod, void *buffer, void *bufferend);
+void Mod_IDP2_Load(dp_model_t *mod, void *buffer, void *bufferend);
+void Mod_IDP3_Load(dp_model_t *mod, void *buffer, void *bufferend);
+void Mod_ZYMOTICMODEL_Load(dp_model_t *mod, void *buffer, void *bufferend);
+void Mod_DARKPLACESMODEL_Load(dp_model_t *mod, void *buffer, void *bufferend);
+void Mod_PSKMODEL_Load(dp_model_t *mod, void *buffer, void *bufferend);
+void Mod_IDSP_Load(dp_model_t *mod, void *buffer, void *bufferend);
+void Mod_IDS2_Load(dp_model_t *mod, void *buffer, void *bufferend);
// utility
-qboolean Mod_CanSeeBox_Trace(int numsamples, float t, model_t *model, vec3_t eye, vec3_t minsX, vec3_t maxsX);
+qboolean Mod_CanSeeBox_Trace(int numsamples, float t, dp_model_t *model, vec3_t eye, vec3_t minsX, vec3_t maxsX);
#endif // MODEL_SHARED_H