mesh refactor 3

This commit is contained in:
h4570
2022-08-10 21:58:32 +02:00
parent 10e0f52d44
commit 0a2d19b2d0
26 changed files with 321 additions and 356 deletions
@@ -44,11 +44,32 @@ MeshMaterialFrame::MeshMaterialFrame(const MeshBuilderData& data,
count = frame->count;
vertices = frame->vertices;
normals = frame->normals;
textureCoords = frame->textureCoords;
colors = frame->colors;
_isMother = true;
if (data.normalsEnabled) {
normals = frame->normals;
} else {
if (frame->normals != nullptr) delete[] frame->normals;
normals = nullptr;
}
if (data.textureCoordsEnabled) {
textureCoords = frame->textureCoords;
} else {
if (frame->textureCoords != nullptr) delete[] frame->textureCoords;
textureCoords = nullptr;
}
if (data.lightMapEnabled) {
colors = frame->colors;
} else {
if (frame->colors != nullptr) delete[] frame->colors;
colors = nullptr;
}
isMother = true;
}
MeshMaterialFrame::MeshMaterialFrame(const MeshMaterialFrame& frame) {
@@ -63,11 +84,11 @@ MeshMaterialFrame::MeshMaterialFrame(const MeshMaterialFrame& frame) {
bbox = frame.bbox;
_isMother = false;
isMother = false;
}
MeshMaterialFrame::~MeshMaterialFrame() {
if (_isMother) {
if (isMother) {
delete[] vertices;
if (normals) delete[] normals;
if (textureCoords) delete[] textureCoords;