Use Mem_MallocA() in Model_md5.cpp

one step to making HD models (like
https://www.moddb.com/mods/birdman-doom3/downloads/birdman-doom3-v11 )
work, but there's still other places in the code where the HD version
of that model makes dhewm3 crash
This commit is contained in:
Daniel Gibson 2023-01-21 16:01:30 +01:00
parent 5c9d9ff53c
commit 8bddc84e62

View file

@ -235,13 +235,16 @@ void idMD5Mesh::ParseMesh( idLexer &parser, int numJoints, const idJointMat *joi
// build the information that will be common to all animations of this mesh:
// silhouette edge connectivity and normal / tangent generation information
//
idDrawVert *verts = (idDrawVert *) _alloca16( texCoords.Num() * sizeof( idDrawVert ) );
bool onStack;
idDrawVert *verts = (idDrawVert*)Mem_MallocA( texCoords.Num()*sizeof(idDrawVert), onStack );
for ( i = 0; i < texCoords.Num(); i++ ) {
verts[i].Clear();
verts[i].st = texCoords[i];
}
TransformVerts( verts, joints );
deformInfo = R_BuildDeformInfo( texCoords.Num(), verts, tris.Num(), tris.Ptr(), shader->UseUnsmoothedTangents() );
Mem_FreeA( verts, onStack );
}
/*
@ -352,12 +355,15 @@ idMD5Mesh::CalcBounds
*/
idBounds idMD5Mesh::CalcBounds( const idJointMat *entJoints ) {
idBounds bounds;
idDrawVert *verts = (idDrawVert *) _alloca16( texCoords.Num() * sizeof( idDrawVert ) );
bool onStack;
idDrawVert *verts = (idDrawVert*)Mem_MallocA( texCoords.Num()*sizeof(idDrawVert), onStack );
TransformVerts( verts, entJoints );
SIMDProcessor->MinMax( bounds[0], bounds[1], verts, texCoords.Num() );
Mem_FreeA( verts, onStack );
return bounds;
}