Skip to content

Commit

Permalink
Use Mem_MallocA() in Model_md5.cpp
Browse files Browse the repository at this point in the history
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
  • Loading branch information
DanielGibson committed Oct 31, 2024
1 parent fee046a commit 5fc1570
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions neo/renderer/Model_md5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

/*
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 5fc1570

Please sign in to comment.