X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=model_shared.h;h=bcb34f1b3b2b61498cc80d443e194eeb163aa688;hb=293060f59a848ee45283a35bff42c8d606673f14;hp=1e0c7794d35920a136cbb90fe525b6cc0354df57;hpb=8d0aa212a91a456c5f7cc13963cc9f501e122ee4;p=xonotic%2Fdarkplaces.git diff --git a/model_shared.h b/model_shared.h index 1e0c7794..bcb34f1b 100644 --- a/model_shared.h +++ b/model_shared.h @@ -94,6 +94,13 @@ typedef struct texvecvertex_s } texvecvertex_t; +typedef struct blendweights_s +{ + unsigned char index[4]; + unsigned char influence[4]; +} +blendweights_t; + // used for mesh lists in q1bsp/q3bsp map models // (the surfaces reference portions of these meshes) typedef struct surfmesh_s @@ -134,8 +141,9 @@ typedef struct surfmesh_s float num_morphmdlframescale[3]; float num_morphmdlframetranslate[3]; // skeletal blending, these are NULL if model is morph or static - int *data_vertexweightindex4i; - float *data_vertexweightinfluence4f; + struct blendweights_s *data_blendweights; + int num_blends; + unsigned short *blends; // set if there is some kind of animation on this model qboolean isanimated; } @@ -577,10 +585,11 @@ typedef struct msurface_s // fog volume info in q3bsp struct q3deffect_s *effect; // q3bsp // mesh information for collisions (only used by q3bsp curves) - int *data_collisionelement3i; // q3bsp - float *data_collisionvertex3f; // q3bsp - float *data_collisionbbox6f; // collision optimization - contains combined bboxes of every data_collisionstride triangles - float *data_bbox6f; // collision optimization - contains combined bboxes of every data_collisionstride triangles + int num_firstcollisiontriangle; + int *deprecatedq3data_collisionelement3i; // q3bsp + float *deprecatedq3data_collisionvertex3f; // q3bsp + float *deprecatedq3data_collisionbbox6f; // collision optimization - contains combined bboxes of every data_collisionstride triangles + float *deprecatedq3data_bbox6f; // collision optimization - contains combined bboxes of every data_collisionstride triangles // surfaces own ranges of vertices and triangles in the model->surfmesh int num_triangles; // number of triangles @@ -594,14 +603,15 @@ typedef struct msurface_s // mesh information for collisions (only used by q3bsp curves) int num_collisiontriangles; // q3bsp int num_collisionvertices; // q3bsp - int num_collisionbboxstride; - int num_bboxstride; + int deprecatedq3num_collisionbboxstride; + int deprecatedq3num_bboxstride; // FIXME: collisionmarkframe should be kept in a separate array - int collisionmarkframe; // q3bsp // don't collide twice in one trace + int deprecatedq3collisionmarkframe; // q3bsp // don't collide twice in one trace } msurface_t; #include "matrixlib.h" +#include "bih.h" #include "model_brush.h" #include "model_sprite.h" @@ -681,6 +691,12 @@ typedef struct model_brush_s //pvschain = model->brush.data_pvsclusters + mycluster * model->brush.num_pvsclusterbytes; //if (pvschain[thatcluster >> 3] & (1 << (thatcluster & 7))) + // collision geometry for q3 curves + int num_collisionvertices; + int num_collisiontriangles; + float *data_collisionvertex3f; + int *data_collisionelement3i; + // a mesh containing all shadow casting geometry for the whole model (including submodels), portions of this are referenced by each surface's num_firstshadowmeshtriangle shadowmesh_t *shadowmesh; @@ -866,6 +882,8 @@ typedef struct model_s // range of collision brush numbers in this (sub)model int firstmodelbrush; int nummodelbrushes; + // BIH (Bounding Interval Hierarchy) for this (sub)model + bih_t collision_bih; // for md3 models int num_tags; int num_tagframes; @@ -882,6 +900,8 @@ typedef struct model_s int num_textures; int num_texturesperskin; texture_t *data_textures; + qboolean wantnormals; + qboolean wanttangents; // surfaces of this model int num_surfaces; msurface_t *data_surfaces; @@ -892,7 +912,7 @@ typedef struct model_s // 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, const struct skeleton_s *skeleton, float *vertex3f, float *normal3f, float *svector3f, float *tvector3f); + void(*AnimateVertices)(const struct model_s * RESTRICT model, const struct frameblend_s * RESTRICT frameblend, const struct skeleton_s *skeleton, float * RESTRICT vertex3f, float * RESTRICT normal3f, float * RESTRICT svector3f, float * RESTRICT 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) @@ -1067,6 +1087,14 @@ void R_Q1BSP_CompileShadowVolume(struct entity_render_s *ent, vec3_t relativelig 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); +// Collision optimization using Bounding Interval Hierarchy +void Mod_CollisionBIH_TracePoint(dp_model_t *model, const struct frameblend_s *frameblend, const skeleton_t *skeleton, struct trace_s *trace, const vec3_t start, int hitsupercontentsmask); +void Mod_CollisionBIH_TraceLine(dp_model_t *model, const struct frameblend_s *frameblend, const skeleton_t *skeleton, struct trace_s *trace, const vec3_t start, const vec3_t end, int hitsupercontentsmask); +void Mod_CollisionBIH_TraceBox(dp_model_t *model, const struct frameblend_s *frameblend, const skeleton_t *skeleton, struct trace_s *trace, const vec3_t start, const vec3_t boxmins, const vec3_t boxmaxs, const vec3_t end, int hitsupercontentsmask); +void Mod_CollisionBIH_TracePoint_Mesh(dp_model_t *model, const struct frameblend_s *frameblend, const skeleton_t *skeleton, struct trace_s *trace, const vec3_t start, int hitsupercontentsmask); +int Mod_CollisionBIH_PointSuperContents_Mesh(struct model_s *model, int frame, const vec3_t point); +void Mod_MakeCollisionBIH(dp_model_t *model, qboolean userendersurfaces); + // alias models struct frameblend_s; struct skeleton_s; @@ -1075,6 +1103,8 @@ int Mod_Alias_GetTagMatrix(const dp_model_t *model, const struct frameblend_s *f int Mod_Alias_GetTagIndexForName(const dp_model_t *model, unsigned int skin, const char *tagname); int Mod_Alias_GetExtendedTagInfoForIndex(const dp_model_t *model, unsigned int skin, const struct frameblend_s *frameblend, const struct skeleton_s *skeleton, int tagindex, int *parentindex, const char **tagname, matrix4x4_t *tag_localmatrix); +void Mod_Skeletal_FreeBuffers(void); + // sprite models void Mod_SpriteInit(void);