mirror of
https://github.com/leozide/leocad.git
synced 2026-10-27 06:20:55 +00:00
Release mesh texture references on destruction
This commit is contained in:
1 parent
197a3d18e6
commit
3e376ddb84
3 files changed
+10
-12
No files matched your search
@@ -21,7 +21,16 @@ lcMesh::~lcMesh()
|
||||
free(mVertexData);
|
||||
free(mIndexData);
|
||||
for (int LodIdx = 0; LodIdx < LC_NUM_MESH_LODS; LodIdx++)
|
||||
{
|
||||
for (int SectionIdx = 0; SectionIdx < mLods[LodIdx].NumSections; SectionIdx++)
|
||||
{
|
||||
lcTexture* Texture = mLods[LodIdx].Sections[SectionIdx].Texture;
|
||||
if (Texture)
|
||||
Texture->Release();
|
||||
}
|
||||
|
||||
delete[] mLods[LodIdx].Sections;
|
||||
}
|
||||
}
|
||||
|
||||
void lcMesh::Create(quint16(&NumSections)[LC_NUM_MESH_LODS], int VertexCount, int TexturedVertexCount, int ConditionalVertexCount, int IndexCount)
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ struct lcMeshSection
|
||||
int DrawOffset; // Index-buffer byte offset, or first conditional vertex.
|
||||
int DrawCount; // Index count, or conditional vertex count.
|
||||
lcMeshPrimitiveType PrimitiveType;
|
||||
lcTexture* Texture;
|
||||
lcTexture* Texture = nullptr;
|
||||
lcBoundingBox BoundingBox;
|
||||
float Radius;
|
||||
};
|
||||
|
||||
@@ -167,17 +167,6 @@ void PieceInfo::ReleaseMesh()
|
||||
{
|
||||
if (mMesh)
|
||||
{
|
||||
for (int LodIdx = 0; LodIdx < LC_NUM_MESH_LODS; LodIdx++)
|
||||
{
|
||||
for (int SectionIdx = 0; SectionIdx < mMesh->mLods[LodIdx].NumSections; SectionIdx++)
|
||||
{
|
||||
lcMeshSection& Section = mMesh->mLods[LodIdx].Sections[SectionIdx];
|
||||
|
||||
if (Section.Texture)
|
||||
Section.Texture->Release();
|
||||
}
|
||||
}
|
||||
|
||||
delete mMesh;
|
||||
mMesh = nullptr;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user