]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Remove Mod_CreateCollisionMesh and reduce the exposed API of Mod_ShadowMesh, it reall...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 2 May 2018 07:23:56 +0000 (07:23 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 2 May 2018 07:23:56 +0000 (07:23 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12416 d7cf8633-e32d-0410-b094-e92efae38249

model_shared.c
model_shared.h

index 0ebf4baaeb9839a8ecee0431cc70ec2759498d35..ab44ba1edb65f389af6051b4fb03b873f08145cb 100644 (file)
@@ -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)
 {
index 2544036f92f08d06772512674a68d6707decd729..1253607599778567a9282b69a7dc4d44a3a70e15 100644 (file)
@@ -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);