Fix memory leak on vertices allocations
This commit is contained in:
parent
5d20018fae
commit
2031e1a4c4
@ -120,7 +120,7 @@ void Graphic3DRenderer::Draw(sf::RenderTexture& context) {
|
|||||||
{
|
{
|
||||||
size_t vCount = obj->GetObjectVerticesCount();
|
size_t vCount = obj->GetObjectVerticesCount();
|
||||||
auto& oMesh = obj->GetObjectMesh();
|
auto& oMesh = obj->GetObjectMesh();
|
||||||
M3D_F4* projVertices = new M3D_F4[vCount];
|
auto* projVertices = new M3D_F4[vCount];
|
||||||
|
|
||||||
// Vertices homogeneous clip space transformation
|
// Vertices homogeneous clip space transformation
|
||||||
M3D_V3Transform(
|
M3D_V3Transform(
|
||||||
@ -131,7 +131,7 @@ void Graphic3DRenderer::Draw(sf::RenderTexture& context) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Draw the object indice triangles if visible or partially clipped
|
// Draw the object indice triangles if visible or partially clipped
|
||||||
sf::Vertex v_tri[4];
|
auto* v_tri = new sf::Vertex[4];
|
||||||
for (auto& objPt : oMesh.parts) {
|
for (auto& objPt : oMesh.parts) {
|
||||||
auto indicePtr = static_cast<const uint32_t*>(objPt.indices.data());
|
auto indicePtr = static_cast<const uint32_t*>(objPt.indices.data());
|
||||||
|
|
||||||
@ -189,7 +189,8 @@ void Graphic3DRenderer::Draw(sf::RenderTexture& context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::destroy_at(projVertices);
|
delete[] v_tri;
|
||||||
|
delete[] projVertices;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user