X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=model_shared.h;h=9e8f211865ebef76ddea380199aa0fa1a2eab98e;hp=5004a972d8c3170a3a30b8a79f3a1e96885ded54;hb=f166f21fa69e9f10fc92217207fa51693dc1b411;hpb=bca6ff3a0962b1bde364755a153e0f5ccb98f18a diff --git a/model_shared.h b/model_shared.h index 5004a972..9e8f2118 100644 --- a/model_shared.h +++ b/model_shared.h @@ -266,6 +266,8 @@ typedef struct model_brush_s { // true if this model is a HalfLife .bsp file qboolean ishlbsp; + // true if this model is a Martial Concert .bsp file + qboolean ismcbsp; // string of entity definitions (.map format) char *entities; @@ -510,6 +512,8 @@ typedef struct model_s void(*Draw)(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, qbyte *outleafpvs, int *outnumleafspointer, int *outsurfacelist, qbyte *outsurfacepvs, int *outnumsurfacespointer); + // compile a shadow volume for the model based on light source + void(*CompileShadowVolume)(struct entity_render_s *ent, vec3_t relativelightorigin, 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, float lightradius, int numsurfaces, const int *surfacelist, const vec3_t lightmins, const vec3_t lightmaxs); // draw the lighting on a model (through stencil) @@ -542,7 +546,8 @@ extern qbyte *mod_base; extern cvar_t r_fullbrights; void Mod_Init (void); -void Mod_CheckLoaded (model_t *mod); +#define Mod_CheckLoaded(mod) (mod ? (mod->loaded ? (mod->used = true) : (Mod_LoadModel(mod, true, true, mod->isworldmodel), true)) : false) +model_t *Mod_LoadModel(model_t *mod, qboolean crash, qboolean checkdisk, qboolean isworldmodel); void Mod_ClearAll (void); model_t *Mod_FindName (const char *name); model_t *Mod_ForName (const char *name, qboolean crash, qboolean checkdisk, qboolean isworldmodel); @@ -558,9 +563,9 @@ extern char loadname[32]; // for hunk tags int Mod_BuildVertexRemapTableFromElements(int numelements, const int *elements, int numvertices, int *remapvertices); void Mod_BuildTriangleNeighbors(int *neighbors, const int *elements, int numtriangles); -void Mod_ValidateElements(const int *elements, int numtriangles, int numverts, const char *filename, int fileline); -void Mod_BuildNormals(int firstvertex, int numvertices, int numtriangles, const float *vertex3f, const int *elements, float *normal3f); -void Mod_BuildTextureVectorsAndNormals(int firstvertex, int numvertices, int numtriangles, const float *vertex, const float *texcoord, const int *elements, float *svectors, float *tvectors, float *normals); +void Mod_ValidateElements(int *elements, int numtriangles, int numverts, const char *filename, int fileline); +void Mod_BuildNormals(int firstvertex, int numvertices, int numtriangles, const float *vertex3f, const int *elements, float *normal3f, qboolean areaweighting); +void Mod_BuildTextureVectorsAndNormals(int firstvertex, int numvertices, int numtriangles, const float *vertex, const float *texcoord, const int *elements, float *svectors, float *tvectors, float *normals, qboolean areaweighting); surfmesh_t *Mod_AllocSurfMesh(mempool_t *mempool, int numvertices, int numtriangles, qboolean detailtexcoords, qboolean lightmapoffsets, qboolean vertexcolors, qboolean neighbors); @@ -577,10 +582,6 @@ 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); -// used for talking to the QuakeC mainly -int Mod_Q1BSP_NativeContentsFromSuperContents(struct model_s *model, int supercontents); -int Mod_Q1BSP_SuperContentsFromNativeContents(struct model_s *model, int nativecontents); - extern cvar_t r_mipskins; typedef struct skinfileitem_s @@ -605,5 +606,43 @@ int Mod_CountSkinFiles(skinfile_t *skinfile); void Mod_SnapVertices(int numcomponents, int numvertices, float *vertices, float snap); int Mod_RemoveDegenerateTriangles(int numtriangles, const int *inelement3i, int *outelement3i, const float *vertex3f); +// bsp models +void Mod_BrushInit(void); +// used for talking to the QuakeC mainly +int Mod_Q1BSP_NativeContentsFromSuperContents(struct model_s *model, int supercontents); +int Mod_Q1BSP_SuperContentsFromNativeContents(struct model_s *model, int nativecontents); + +// a lot of model formats use the Q1BSP code, so here are the prototypes... +struct entity_render_s; +void R_Q1BSP_DrawSky(struct entity_render_s *ent); +void R_Q1BSP_Draw(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, qbyte *outleafpvs, int *outnumleafspointer, int *outsurfacelist, qbyte *outsurfacepvs, int *outnumsurfacespointer); +void R_Q1BSP_CompileShadowVolume(struct entity_render_s *ent, vec3_t relativelightorigin, float lightradius, int numsurfaces, const int *surfacelist); +void R_Q1BSP_DrawShadowVolume(struct entity_render_s *ent, vec3_t relativelightorigin, float lightradius, int numsurfaces, const int *surfacelist, const vec3_t lightmins, const vec3_t lightmaxs); +void R_Q1BSP_DrawLight(struct entity_render_s *ent, float *lightcolor, int numsurfaces, const int *surfacelist); + +// alias models +struct frameblend_s; +void Mod_AliasInit(void); +void Mod_Alias_GetMesh_Vertex3f(const model_t *model, const struct frameblend_s *frameblend, const struct surfmesh_s *mesh, float *out3f); +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); + +// 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); + #endif // MODEL_SHARED_H