changeset 354:b87dd3eaa9bd

add: consider multiple materials when loading gltf
author Sam <sam@basx.dev>
date Wed, 20 Sep 2023 22:52:46 +0700
parents 61c5d5fe9d93
children 26b29ca448fc
files src/semicongine/resources/mesh.nim
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/semicongine/resources/mesh.nim	Wed Sep 20 22:35:04 2023 +0700
+++ b/src/semicongine/resources/mesh.nim	Wed Sep 20 22:52:46 2023 +0700
@@ -227,9 +227,9 @@
     # but or current mesh/rendering implementation is only designed for a single material
     # currently this is usually handled by adding the values as shader globals
     # TODO: this is bad
-    mesh[].materials = @[material]
+    mesh[].materials.add material
   else:
-    mesh[].materials = @[DEFAULT_MATERIAL]
+    mesh[].materials.add DEFAULT_MATERIAL
 
   if primitiveNode.hasKey("indices"):
     assert mesh[].indexType != None