moved sts/normals present

This commit is contained in:
h4570
2020-12-28 16:05:48 +01:00
parent 1b6e1e94ee
commit ad43a4bfd3
5 changed files with 30 additions and 16 deletions
-8
View File
@@ -143,9 +143,6 @@ public:
const u8 &areMaterialsAllocated() const { return _areMaterialsAllocated; };
const u8 &isBoundingBoxCalculated() const { return _isBoundingBoxCalculated; };
const u8 &areSTsPresent() const { return _areSTsPresent; };
const u8 &areNormalsPresent() const { return _areNormalsPresent; };
/** Create reference copy (non-mother) */
void copyFrom(MeshFrame *t_refCopy);
@@ -161,9 +158,6 @@ public:
/** Set materials count and allocate memory. */
void allocateMaterials(const u32 &t_val);
void setSTsPresent(const u8 &b) { _areSTsPresent = b; };
void setNormalsPresent(const u8 &b) { _areNormalsPresent = b; };
/**
* Calculates bounding box (AABB) for frame and for materiaals.
* Should be called by data loader,
@@ -178,8 +172,6 @@ private:
_areVerticesAllocated,
_areNormalsAllocated,
_areMaterialsAllocated,
_areSTsPresent,
_areNormalsPresent,
_isBoundingBoxCalculated;
u32 vertexCount, stsCount, normalsCount, materialsCount, id;
MeshMaterial *materials;
+22 -1
View File
@@ -107,10 +107,26 @@ public:
/** Set material name. */
void setName(char *t_val);
/**
* Do not call this method unless you know what you do.
* Should be called by data loader.
*/
void setSTsPresent(const u8 &b) { _areSTsPresent = b; };
/**
* Do not call this method unless you know what you do.
* Should be called by data loader.
*/
void setNormalsPresent(const u8 &b) { _areNormalsPresent = b; };
// ----
// Other
// ----
const u8 &areSTsPresent() const { return _areSTsPresent; };
const u8 &areNormalsPresent() const { return _areNormalsPresent; };
/** Create reference copy (non-mother) */
void copyFrom(MeshMaterial *t_refCopy);
@@ -148,7 +164,12 @@ private:
BoundingBox *boundingBoxObj;
u32 facesCount, id;
u32 *vertexFaces, *stFaces, *normalFaces;
u8 _isMother, _isNameSet, _areFacesAllocated, _isBoundingBoxCalculated;
u8 _isMother,
_isNameSet,
_areFacesAllocated,
_isBoundingBoxCalculated,
_areSTsPresent,
_areNormalsPresent;
char *name;
};
+4 -3
View File
@@ -145,7 +145,7 @@ void ObjLoader::load(MeshFrame *o_result, char *t_filename, float t_scale, u8 t_
o_result->getMaterial(materialsI).setSTFace(faceI, coordIndex[0] - 1);
o_result->getMaterial(materialsI).setSTFace(faceI + 1, coordIndex[1] - 1);
o_result->getMaterial(materialsI).setSTFace(faceI + 2, coordIndex[2] - 1);
o_result->setSTsPresent(true);
o_result->getMaterial(materialsI).setSTsPresent(true);
}
if (matches == 9)
@@ -153,7 +153,7 @@ void ObjLoader::load(MeshFrame *o_result, char *t_filename, float t_scale, u8 t_
o_result->getMaterial(materialsI).setNormalFace(faceI, normalIndex[0] - 1);
o_result->getMaterial(materialsI).setNormalFace(faceI + 1, normalIndex[1] - 1);
o_result->getMaterial(materialsI).setNormalFace(faceI + 2, normalIndex[2] - 1);
o_result->setNormalsPresent(true);
o_result->getMaterial(materialsI).setNormalsPresent(true);
faceI += 3;
}
else if (matches == 2)
@@ -171,7 +171,7 @@ void ObjLoader::load(MeshFrame *o_result, char *t_filename, float t_scale, u8 t_
o_result->getMaterial(materialsI).setNormalFace(faceI, normalIndex[0] - 1);
o_result->getMaterial(materialsI).setNormalFace(faceI + 1, normalIndex[1] - 1);
o_result->getMaterial(materialsI).setNormalFace(faceI + 2, normalIndex[2] - 1);
o_result->setNormalsPresent(true);
o_result->getMaterial(materialsI).setNormalsPresent(true);
faceI += 2;
}
}
@@ -180,6 +180,7 @@ void ObjLoader::load(MeshFrame *o_result, char *t_filename, float t_scale, u8 t_
else
break;
}
o_result->calculateBoundingBoxes();
fclose(file);
delete[] path;
-4
View File
@@ -27,8 +27,6 @@ MeshFrame::MeshFrame()
_areVerticesAllocated = false;
_areNormalsAllocated = false;
_areMaterialsAllocated = false;
_areSTsPresent = false;
_areNormalsPresent = false;
_isMother = true;
}
@@ -160,8 +158,6 @@ void MeshFrame::copyFrom(MeshFrame *t_refCopy)
_areVerticesAllocated = true;
_areNormalsAllocated = true;
_areMaterialsAllocated = true;
_areSTsPresent = t_refCopy->_areSTsPresent;
_areNormalsPresent = t_refCopy->_areNormalsPresent;
vertices = t_refCopy->vertices;
sts = t_refCopy->sts;
normals = t_refCopy->normals;
+4
View File
@@ -25,6 +25,8 @@ MeshMaterial::MeshMaterial()
_isNameSet = false;
_areFacesAllocated = false;
_isBoundingBoxCalculated = false;
_areSTsPresent = false;
_areNormalsPresent = false;
_isMother = true;
setDefaultColor();
}
@@ -158,6 +160,8 @@ void MeshMaterial::copyFrom(MeshMaterial *t_refCopy)
stFaces = t_refCopy->stFaces;
normalFaces = t_refCopy->normalFaces;
facesCount = t_refCopy->facesCount;
_areSTsPresent = t_refCopy->_areSTsPresent;
_areNormalsPresent = t_refCopy->_areNormalsPresent;
_areFacesAllocated = true;
_isMother = false;