From: havoc Date: Wed, 25 May 2005 07:21:29 +0000 (+0000) Subject: zym models now support TraceBox calls X-Git-Tag: xonotic-v0.1.0preview~4847 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8eedaa7b42104f5d9c106a7e58ae8a909e0a0d0a;p=xonotic%2Fdarkplaces.git zym models now support TraceBox calls git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5334 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/model_alias.c b/model_alias.c index c6b8492a..2d25e27b 100644 --- a/model_alias.c +++ b/model_alias.c @@ -180,9 +180,9 @@ static void Mod_Alias_Mesh_CompileFrameZero(surfmesh_t *mesh) static void Mod_MDLMD2MD3_TraceBox(model_t *model, int frame, trace_t *trace, const vec3_t boxstartmins, const vec3_t boxstartmaxs, const vec3_t boxendmins, const vec3_t boxendmaxs, int hitsupercontentsmask) { - int i, framenum, linetrace; - float *vertex3f; + int i, linetrace; float segmentmins[3], segmentmaxs[3]; + frameblend_t frameblend[4]; msurface_t *surface; surfmesh_t *mesh; colbrushf_t *thisbrush_start = NULL, *thisbrush_end = NULL; @@ -206,23 +206,17 @@ static void Mod_MDLMD2MD3_TraceBox(model_t *model, int frame, trace_t *trace, co thisbrush_start = Collision_BrushForBox(&startmatrix, boxstartmins, boxstartmaxs); thisbrush_end = Collision_BrushForBox(&endmatrix, boxendmins, boxendmaxs); } + memset(frameblend, 0, sizeof(frameblend)); + frameblend[0].frame = frame; + frameblend[0].lerp = 1; for (i = 0, surface = model->data_surfaces;i < model->num_surfaces;i++, surface++) { mesh = surface->groupmesh; - framenum = frame; - if (framenum < 0 || framenum > mesh->num_morphframes) - framenum = 0; - if (mesh->data_morphvertex3f) - vertex3f = mesh->data_morphvertex3f + framenum * mesh->num_vertices * 3; - else - { - vertex3f = varray_vertex3f; - continue; // FIXME!!! this needs to handle skeletal! - } + Mod_Alias_GetMesh_Vertex3f(model, frameblend, mesh, varray_vertex3f); if (linetrace) - Collision_TraceLineTriangleMeshFloat(trace, boxstartmins, boxendmins, mesh->num_triangles, mesh->data_element3i, vertex3f, SUPERCONTENTS_SOLID, segmentmins, segmentmaxs); + Collision_TraceLineTriangleMeshFloat(trace, boxstartmins, boxendmins, mesh->num_triangles, mesh->data_element3i, varray_vertex3f, SUPERCONTENTS_SOLID, segmentmins, segmentmaxs); else - Collision_TraceBrushTriangleMeshFloat(trace, thisbrush_start, thisbrush_end, mesh->num_triangles, mesh->data_element3i, vertex3f, SUPERCONTENTS_SOLID, segmentmins, segmentmaxs); + Collision_TraceBrushTriangleMeshFloat(trace, thisbrush_start, thisbrush_end, mesh->num_triangles, mesh->data_element3i, varray_vertex3f, SUPERCONTENTS_SOLID, segmentmins, segmentmaxs); } } @@ -1154,7 +1148,7 @@ void Mod_ZYMOTICMODEL_Load(model_t *mod, void *buffer) loadmodel->Draw = R_Q1BSP_Draw; loadmodel->DrawShadowVolume = R_Q1BSP_DrawShadowVolume; loadmodel->DrawLight = R_Q1BSP_DrawLight; - //loadmodel->TraceBox = Mod_MDLMD2MD3_TraceBox; // FIXME: implement collisions + loadmodel->TraceBox = Mod_MDLMD2MD3_TraceBox; loadmodel->flags = 0; // there are no flags on zym models loadmodel->synctype = ST_RAND;