From 07fbfb3c8c6aa03dc70c1d2f250ed4e8ed613efe Mon Sep 17 00:00:00 2001 From: Martin Felis Date: Wed, 28 Mar 2018 20:05:51 +0200 Subject: [PATCH] intermediate commit --- src/modules/RenderUtils.cc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/modules/RenderUtils.cc b/src/modules/RenderUtils.cc index 58ceba5..0f07ab2 100644 --- a/src/modules/RenderUtils.cc +++ b/src/modules/RenderUtils.cc @@ -761,6 +761,12 @@ void AssetFile::LoadBuffers() { } } +enum PrimitiveType { + PrimitivePosition = 1, + PrimitiveNormal, + PrimitiveTexCoord0 +}; + void AssetFile::DrawMesh(const tinygltf::Mesh &mesh, const Matrix44f& matrix) { for (int i = 0, n = mesh.primitives.size(); i < n; ++i) { const tinygltf::Primitive& primitive = mesh.primitives[i]; @@ -786,7 +792,17 @@ void AssetFile::DrawMesh(const tinygltf::Mesh &mesh, const Matrix44f& matrix) { default: assert(0); break; } - + PrimitiveType primitive_type; + if (it->first.compare("POSITION") == 0) { + primitive_type = PrimitivePosition; + } else if (it->first.compare("NORMAL") == 0) { + primitive_type = PrimitiveNormal; + } else if (it->first.compare("TEXCOORD_0") == 0) { + primitive_type = PrimitiveTexCoord0; + } else { + gLog("Invalid primitive type: %s", it->first.c_str()); + assert(false); + } if ((it->first.compare("POSITION") == 0) || (it->first.compare("NORMAL") == 0)