Mercurial > games > semicongine
diff tests/test_mesh.nim @ 353:61c5d5fe9d93
add: multi-material for meshes
author | Sam <sam@basx.dev> |
---|---|
date | Wed, 20 Sep 2023 22:35:04 +0700 |
parents | b83b3a1ccb05 |
children | f054b8bacab8 |
line wrap: on
line diff
--- a/tests/test_mesh.nim Wed Sep 20 22:02:20 2023 +0700 +++ b/tests/test_mesh.nim Wed Sep 20 22:35:04 2023 +0700 @@ -58,12 +58,11 @@ scene.addShaderGlobal("view", Unit4F32) var materials: Table[uint16, Material] for mesh in scene.meshes: - if not materials.contains(mesh.material.index): - materials[mesh.material.index] = mesh.material + for material in mesh.materials: + if not materials.contains(material.index): + materials[material.index] = material let baseColors = sortedByIt(values(materials).toSeq, it.index).mapIt(getValue[Vec4f](it.constants["baseColorFactor"], 0)) let baseTextures = sortedByIt(values(materials).toSeq, it.index).mapIt(it.textures["baseColorTexture"]) - for t in baseTextures: - echo "- ", t scene.addShaderGlobalArray("baseColorFactor", baseColors) scene.addShaderGlobalArray("baseColorTexture", baseTextures) engine.addScene(scene)