Added: Information in mesh_frame on if STs/Normals are present, misc changes for PR #65 code review.
This commit is contained in:
@@ -119,6 +119,9 @@ 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; };
|
||||
|
||||
/** Set STs count and allocate memory. */
|
||||
void allocateSTs(const u32 &t_val);
|
||||
|
||||
@@ -131,6 +134,9 @@ 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,
|
||||
@@ -144,6 +150,8 @@ private:
|
||||
_areVerticesAllocated,
|
||||
_areNormalsAllocated,
|
||||
_areMaterialsAllocated,
|
||||
_areSTsPresent,
|
||||
_areNormalsPresent,
|
||||
_isBoundingBoxCalculated;
|
||||
u32 vertexCount, stsCount, normalsCount, materialsCount;
|
||||
MeshMaterial *materials;
|
||||
|
||||
@@ -145,9 +145,7 @@ void ObjLoader::load(MeshFrame *o_result, char *t_filename, float t_scale, u8 t_
|
||||
//if(fscanf
|
||||
|
||||
}*/
|
||||
switch (matches)
|
||||
{
|
||||
case 9:
|
||||
if (matches == 9)
|
||||
{
|
||||
o_result->getMaterial(materialsI).setVertexFace(faceI, vertexIndex[0] - 1);
|
||||
o_result->getMaterial(materialsI).setVertexFace(faceI + 1, vertexIndex[1] - 1);
|
||||
@@ -156,14 +154,15 @@ 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).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);
|
||||
faceI += 3;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
else if (matches == 2)
|
||||
{
|
||||
o_result->getMaterial(materialsI).setVertexFace(faceI, vertexIndex[0] - 1);
|
||||
o_result->getMaterial(materialsI).setVertexFace(faceI + 1, vertexIndex[1] - 1);
|
||||
@@ -172,10 +171,10 @@ 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);
|
||||
faceI += 2;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
else if (matches == 1)
|
||||
{
|
||||
if (newerMatches == 3)
|
||||
{
|
||||
@@ -193,10 +192,9 @@ 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);
|
||||
faceI += 2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@ MeshFrame::MeshFrame()
|
||||
_areVerticesAllocated = false;
|
||||
_areNormalsAllocated = false;
|
||||
_areMaterialsAllocated = false;
|
||||
_areSTsPresent = false;
|
||||
_areNormalsPresent = false;
|
||||
}
|
||||
|
||||
MeshFrame::~MeshFrame()
|
||||
|
||||
Reference in New Issue
Block a user