From 0f5272cb508cf32dcba6c14a6b626fca96b95817 Mon Sep 17 00:00:00 2001 From: Alexander Gessler Date: Wed, 18 Sep 2013 18:35:41 +0200 Subject: [PATCH] Obj: set aiMesh::mPrimitiveTypes --- code/ObjFileImporter.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/code/ObjFileImporter.cpp b/code/ObjFileImporter.cpp index bb12785e1..aed160738 100644 --- a/code/ObjFileImporter.cpp +++ b/code/ObjFileImporter.cpp @@ -276,14 +276,23 @@ void ObjFileImporter::createTopology(const ObjFile::Model* pModel, for (size_t index = 0; index < pObjMesh->m_Faces.size(); index++) { ObjFile::Face* const inp = pObjMesh->m_Faces[ index ]; + if (inp->m_PrimitiveType == aiPrimitiveType_LINE) { pMesh->mNumFaces += inp->m_pVertices->size() - 1; + pMesh->mPrimitiveTypes |= aiPrimitiveType_LINE; } else if (inp->m_PrimitiveType == aiPrimitiveType_POINT) { pMesh->mNumFaces += inp->m_pVertices->size(); + pMesh->mPrimitiveTypes |= aiPrimitiveType_POINT; } else { ++pMesh->mNumFaces; + if (inp->m_pVertices->size() > 3) { + pMesh->mPrimitiveTypes |= aiPrimitiveType_POLYGON; + } + else { + pMesh->mPrimitiveTypes |= aiPrimitiveType_TRIANGLE; + } } }