summaryrefslogtreecommitdiff
path: root/assetFactory/assimp.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-04-25 17:53:49 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2023-04-25 17:53:49 +0100
commitac3d38f019b9593d4dda49921c0db6c0b8c9a1a6 (patch)
treeeecd6de4c49d9f775db38c5cbedc0a4db55f248e /assetFactory/assimp.cpp
parentRemove duplicate Tree-01-1 definition (diff)
parentClear world objects explicitly (diff)
downloadilt-ac3d38f019b9593d4dda49921c0db6c0b8c9a1a6.tar.bz2
ilt-ac3d38f019b9593d4dda49921c0db6c0b8c9a1a6.tar.xz
ilt-ac3d38f019b9593d4dda49921c0db6c0b8c9a1a6.zip
Merge remote-tracking branch 'origin/assimp-normals'
Diffstat (limited to 'assetFactory/assimp.cpp')
-rw-r--r--assetFactory/assimp.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/assetFactory/assimp.cpp b/assetFactory/assimp.cpp
index 840c5a9..74b1c54 100644
--- a/assetFactory/assimp.cpp
+++ b/assetFactory/assimp.cpp
@@ -59,9 +59,15 @@ public:
void
addMesh(CreatedFaces & faces, ModelFactoryMesh & mesh, const aiMesh * amesh) const
{
- const auto vhs = AIRANGE(amesh, Vertices) * [&mesh](auto && v) {
- return mesh.add_vertex(*v);
- };
+ mesh.normalsProvidedProperty = amesh->HasNormals();
+ const auto vhs = AIRANGE(amesh, Vertices) *
+ [&mesh, normals = amesh->HasNormals() ? amesh->mNormals : nullptr](auto && v) mutable {
+ const auto vh = mesh.add_vertex(*v);
+ if (normals) {
+ mesh.set_normal(vh, **(normals++));
+ }
+ return vh;
+ };
const auto & m = scene->mMaterials[amesh->mMaterialIndex]->GetName();
GLuint material {};