From 09438bdf80e3850374b014ad004113e615e57b4a Mon Sep 17 00:00:00 2001 From: cloudwalk Date: Fri, 29 May 2020 02:35:18 +0000 Subject: [PATCH] Pass num_triangles per surface rather than for the entire surfmesh Committing on behalf of havoc. Fixes potential bugs on multi-texture model formats and makes hitmodel traces faster. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12604 d7cf8633-e32d-0410-b094-e92efae38249 --- model_alias.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/model_alias.c b/model_alias.c index 22863519..9c2e65e4 100644 --- a/model_alias.c +++ b/model_alias.c @@ -786,7 +786,7 @@ static void Mod_MDLMD2MD3_TraceLine(dp_model_t *model, const frameblend_t *frame else vertex3f = model->surfmesh.data_vertex3f; for (i = 0, surface = model->data_surfaces;i < model->num_surfaces;i++, surface++) - Collision_TraceLineTriangleMeshFloat(trace, start, end, model->surfmesh.num_triangles, model->surfmesh.data_element3i, vertex3f, 0, NULL, SUPERCONTENTS_SOLID | (surface->texture->basematerialflags & MATERIALFLAGMASK_TRANSLUCENT ? 0 : SUPERCONTENTS_OPAQUE), 0, surface->texture, segmentmins, segmentmaxs); + Collision_TraceLineTriangleMeshFloat(trace, start, end, surface->num_triangles, model->surfmesh.data_element3i, vertex3f, 0, NULL, SUPERCONTENTS_SOLID | (surface->texture->basematerialflags & MATERIALFLAGMASK_TRANSLUCENT ? 0 : SUPERCONTENTS_OPAQUE), 0, surface->texture, segmentmins, segmentmaxs); if (freevertex3f) Mem_Free(freevertex3f); } @@ -840,7 +840,7 @@ static void Mod_MDLMD2MD3_TraceBox(dp_model_t *model, const frameblend_t *frameb Collision_BrushForBox(&thisbrush_end, boxendmins, boxendmaxs, 0, 0, NULL); model->AnimateVertices(model, frameblend, skeleton, vertex3f, NULL, NULL, NULL); for (i = 0, surface = model->data_surfaces;i < model->num_surfaces;i++, surface++) - Collision_TraceBrushTriangleMeshFloat(trace, &thisbrush_start.brush, &thisbrush_end.brush, model->surfmesh.num_triangles, model->surfmesh.data_element3i, vertex3f, 0, NULL, SUPERCONTENTS_SOLID | (surface->texture->basematerialflags & MATERIALFLAGMASK_TRANSLUCENT ? 0 : SUPERCONTENTS_OPAQUE), 0, surface->texture, segmentmins, segmentmaxs); + Collision_TraceBrushTriangleMeshFloat(trace, &thisbrush_start.brush, &thisbrush_end.brush, surface->num_triangles, model->surfmesh.data_element3i, vertex3f, 0, NULL, SUPERCONTENTS_SOLID | (surface->texture->basematerialflags & MATERIALFLAGMASK_TRANSLUCENT ? 0 : SUPERCONTENTS_OPAQUE), 0, surface->texture, segmentmins, segmentmaxs); if (vertex3f != vertex3fbuf) Mem_Free(vertex3f); } -- 2.39.2