changeset 815:5341af5b9b2b

add: consider multiple materials when loading gltf
author Sam <sam@basx.dev>
date Wed, 20 Sep 2023 22:52:46 +0700
parents 6a09fe5dc99b
children 670f598d59e7
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