# HG changeset patch # User Sam # Date 1695566057 -25200 # Node ID 6794c07934f92503591a1bf09e6020b62618719e # Parent 5dcd551130be76079e8c412c7ad1dc73d4bc7d91 fix string formatting + move function in correct module diff -r 5dcd551130be -r 6794c07934f9 src/semicongine/renderer.nim --- 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 diff -r 5dcd551130be -r 6794c07934f9 src/semicongine/scene.nim --- 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))