changeset 360:6794c07934f9

fix string formatting + move function in correct module
author Sam <sam@basx.dev>
date Sun, 24 Sep 2023 21:34:17 +0700
parents 5dcd551130be
children 97e913c0e7fe
files src/semicongine/renderer.nim src/semicongine/scene.nim
diffstat 2 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/semicongine/renderer.nim	Sun Sep 24 00:21:42 2023 +0700
+++ b/src/semicongine/renderer.nim	Sun Sep 24 21:34:17 2023 +0700
@@ -43,9 +43,6 @@
     scenedata: Table[Scene, SceneData]
     emptyTexture: VulkanTexture
 
-func usesMaterial(scene: Scene, materialName: string): bool =
-  return scene.meshes.anyIt(it.materials.anyIt(it.name == materialName))
-
 proc initRenderer*(device: Device, shaders: Table[string, ShaderConfiguration], clearColor=Vec4f([0.8'f32, 0.8'f32, 0.8'f32, 1'f32])): Renderer =
   assert device.vk.valid
   
--- a/src/semicongine/scene.nim	Sun Sep 24 00:21:42 2023 +0700
+++ b/src/semicongine/scene.nim	Sun Sep 24 21:34:17 2023 +0700
@@ -1,4 +1,5 @@
 import std/tables
+import std/sequtils
 import std/hashes
 
 import ./core
@@ -24,7 +25,7 @@
 proc add*[T](scene: var Scene, obj: T) =
   for name, value in obj.fieldPairs:
     when typeof(value) is Mesh:
-      assert not value.isNil, &"Cannot add a mesh that is 'nil': " & name
+      assert not value.isNil, "Cannot add a mesh that is 'nil': " & name
       scene.meshes.add value
     when typeof(value) is seq[Mesh]:
       assert not value.isNil, &"Cannot add a mesh that is 'nil': " & name
@@ -71,3 +72,6 @@
 
 func `==`*(a, b: Scene): bool =
   a.name == b.name
+
+func usesMaterial*(scene: Scene, materialName: string): bool =
+  return scene.meshes.anyIt(it.materials.anyIt(it.name == materialName))