From: havoc Date: Wed, 2 May 2018 07:23:56 +0000 (+0000) Subject: Remove Mod_CreateCollisionMesh and reduce the exposed API of Mod_ShadowMesh, it reall... X-Git-Url: http://de.git.xonotic.org/?a=commitdiff_plain;h=8f47ee7b6e3c66303e5199b42d79dc6d534987cb;p=xonotic%2Fdarkplaces.git Remove Mod_CreateCollisionMesh and reduce the exposed API of Mod_ShadowMesh, it really doesn't need to support most of the things it supports as only compiled shadowmaps use it now. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12416 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/model_shared.c b/model_shared.c index 0ebf4baa..ab44ba1e 100644 --- a/model_shared.c +++ b/model_shared.c @@ -1029,7 +1029,7 @@ shadowmesh_t *Mod_ShadowMesh_ReAlloc(mempool_t *mempool, shadowmesh_t *oldmesh, return newmesh; } -int Mod_ShadowMesh_AddVertex(shadowmesh_t *mesh, float *vertex14f) +static int Mod_ShadowMesh_AddVertex(shadowmesh_t *mesh, float *vertex14f) { int hashindex, vnum; shadowmeshvertexhash_t *hash; @@ -1057,7 +1057,7 @@ int Mod_ShadowMesh_AddVertex(shadowmesh_t *mesh, float *vertex14f) return vnum; } -void Mod_ShadowMesh_AddTriangle(mempool_t *mempool, shadowmesh_t *mesh, rtexture_t *map_diffuse, rtexture_t *map_specular, rtexture_t *map_normal, float *vertex14f) +static void Mod_ShadowMesh_AddTriangle(mempool_t *mempool, shadowmesh_t *mesh, rtexture_t *map_diffuse, rtexture_t *map_specular, rtexture_t *map_normal, float *vertex14f) { if (mesh->numtriangles == 0) { @@ -1291,47 +1291,6 @@ void Mod_ShadowMesh_Free(shadowmesh_t *mesh) } } -void Mod_CreateCollisionMesh(dp_model_t *mod) -{ - int k, numcollisionmeshtriangles; - qboolean usesinglecollisionmesh = false; - const msurface_t *surface = NULL; - - mempool_t *mempool = mod->mempool; - if (!mempool && mod->brush.parentmodel) - mempool = mod->brush.parentmodel->mempool; - // make a single combined collision mesh for physics engine use - // TODO rewrite this to use the collision brushes as source, to fix issues with e.g. common/caulk which creates no drawsurface - numcollisionmeshtriangles = 0; - for (k = 0;k < mod->nummodelsurfaces;k++) - { - surface = mod->data_surfaces + mod->firstmodelsurface + k; - if (!strcmp(surface->texture->name, "collision") || !strcmp(surface->texture->name, "collisionconvex")) // found collision mesh - { - usesinglecollisionmesh = true; - numcollisionmeshtriangles = surface->num_triangles; - break; - } - if (!(surface->texture->supercontents & SUPERCONTENTS_SOLID)) - continue; - numcollisionmeshtriangles += surface->num_triangles; - } - mod->brush.collisionmesh = Mod_ShadowMesh_Begin(mempool, numcollisionmeshtriangles * 3, numcollisionmeshtriangles, NULL, NULL, NULL, false, true); - if (usesinglecollisionmesh) - Mod_ShadowMesh_AddMesh(mempool, mod->brush.collisionmesh, NULL, NULL, NULL, mod->surfmesh.data_vertex3f, NULL, NULL, NULL, NULL, surface->num_triangles, (mod->surfmesh.data_element3i + 3 * surface->num_firsttriangle)); - else - { - for (k = 0;k < mod->nummodelsurfaces;k++) - { - surface = mod->data_surfaces + mod->firstmodelsurface + k; - if (!(surface->texture->supercontents & SUPERCONTENTS_SOLID)) - continue; - Mod_ShadowMesh_AddMesh(mempool, mod->brush.collisionmesh, NULL, NULL, NULL, mod->surfmesh.data_vertex3f, NULL, NULL, NULL, NULL, surface->num_triangles, (mod->surfmesh.data_element3i + 3 * surface->num_firsttriangle)); - } - } - mod->brush.collisionmesh = Mod_ShadowMesh_Finish(mempool, mod->brush.collisionmesh, false, false); -} - #if 0 static void Mod_GetTerrainVertex3fTexCoord2fFromBGRA(const unsigned char *imagepixels, int imagewidth, int imageheight, int ix, int iy, float *vertex3f, float *texcoord2f, matrix4x4_t *pixelstepmatrix, matrix4x4_t *pixeltexturestepmatrix) { diff --git a/model_shared.h b/model_shared.h index 2544036f..12536075 100644 --- a/model_shared.h +++ b/model_shared.h @@ -1158,16 +1158,12 @@ void Mod_BuildVBOs(void); shadowmesh_t *Mod_ShadowMesh_Alloc(mempool_t *mempool, int maxverts, int maxtriangles, rtexture_t *map_diffuse, rtexture_t *map_specular, rtexture_t *map_normal, int light, int expandable); shadowmesh_t *Mod_ShadowMesh_ReAlloc(mempool_t *mempool, shadowmesh_t *oldmesh, int light); -int Mod_ShadowMesh_AddVertex(shadowmesh_t *mesh, float *vertex14f); -void Mod_ShadowMesh_AddTriangle(mempool_t *mempool, shadowmesh_t *mesh, rtexture_t *map_diffuse, rtexture_t *map_specular, rtexture_t *map_normal, float *vertex14f); void Mod_ShadowMesh_AddMesh(mempool_t *mempool, shadowmesh_t *mesh, rtexture_t *map_diffuse, rtexture_t *map_specular, rtexture_t *map_normal, const float *vertex3f, const float *svector3f, const float *tvector3f, const float *normal3f, const float *texcoord2f, int numtris, const int *element3i); shadowmesh_t *Mod_ShadowMesh_Begin(mempool_t *mempool, int maxverts, int maxtriangles, rtexture_t *map_diffuse, rtexture_t *map_specular, rtexture_t *map_normal, int light, int expandable); shadowmesh_t *Mod_ShadowMesh_Finish(mempool_t *mempool, shadowmesh_t *firstmesh, qboolean light, qboolean createvbo); void Mod_ShadowMesh_CalcBBox(shadowmesh_t *firstmesh, vec3_t mins, vec3_t maxs, vec3_t center, float *radius); void Mod_ShadowMesh_Free(shadowmesh_t *mesh); -void Mod_CreateCollisionMesh(dp_model_t *mod); - void Mod_FreeQ3Shaders(void); void Mod_LoadQ3Shaders(void); q3shaderinfo_t *Mod_LookupQ3Shader(const char *name);