obj loader refactor
This commit is contained in:
@@ -18,9 +18,9 @@ namespace Tyra {
|
||||
DynamicMesh::DynamicMesh(const MeshBuilderData& data) : Mesh(data) {
|
||||
framesCount = data.framesCount;
|
||||
|
||||
TYRA_ERROR(framesCount > 1,
|
||||
"Frames count should be greater than 1 for DynamicMesh! Maybe you "
|
||||
"should use StaticMesh?");
|
||||
TYRA_WARN(
|
||||
"Frames count should be greater than 1 for DynamicMesh! Maybe you "
|
||||
"should use StaticMesh?");
|
||||
|
||||
frames = new MeshFrame*[framesCount];
|
||||
for (u32 i = 0; i < framesCount; i++) {
|
||||
@@ -33,9 +33,9 @@ DynamicMesh::DynamicMesh(const MeshBuilderData& data) : Mesh(data) {
|
||||
DynamicMesh::DynamicMesh(const MeshBuilder2Data& data) : Mesh(data) {
|
||||
framesCount = data.materials[0]->frames.size();
|
||||
|
||||
TYRA_ERROR(framesCount > 1,
|
||||
"Frames count should be greater than 1 for DynamicMesh! Maybe you "
|
||||
"should use StaticMesh?");
|
||||
TYRA_WARN(
|
||||
"Frames count should be greater than 1 for DynamicMesh! Maybe you "
|
||||
"should use StaticMesh?");
|
||||
|
||||
frames = new MeshFrame*[framesCount];
|
||||
for (u32 i = 0; i < framesCount; i++) {
|
||||
|
||||
@@ -37,7 +37,7 @@ MeshMaterial::MeshMaterial(const MeshBuilder2Data& data,
|
||||
singleColorFlag = true;
|
||||
}
|
||||
|
||||
color.set(128.0F, 128.0F, 128.0F, 128.0F);
|
||||
color.set(material->ambient);
|
||||
|
||||
_name = material->name;
|
||||
TYRA_ASSERT(_name.length() > 0, "MeshMaterial name cannot be empty");
|
||||
|
||||
@@ -56,10 +56,12 @@ MeshMaterialFrame::MeshMaterialFrame(const MeshBuilder2Data& data,
|
||||
|
||||
TYRA_ASSERT(frame->count > 0, "Vertex count must be greater than 0");
|
||||
TYRA_ASSERT(frame->vertices != nullptr, "Vertex array can't be null");
|
||||
TYRA_ASSERT(frame->normals != nullptr, "Normal array can't be null");
|
||||
TYRA_ASSERT(frame->textureCoords != nullptr,
|
||||
TYRA_ASSERT(!data.normalsEnabled || frame->normals != nullptr,
|
||||
"Normal array can't be null");
|
||||
TYRA_ASSERT(!data.textureCoordsEnabled || frame->textureCoords != nullptr,
|
||||
"Texture coordinate array can't be null");
|
||||
TYRA_ASSERT(frame->colors != nullptr, "Color array can't be null");
|
||||
TYRA_ASSERT(!data.lightMapEnabled || frame->colors != nullptr,
|
||||
"Color array can't be null");
|
||||
|
||||
bbox = new BBox(frame->vertices, frame->count);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user