# HG changeset patch # User Sam # Date 1695566057 -25200 # Node ID 6d258ab35f702c86b01b53692ffb2306d3908cc3 # Parent 85470ae0f72890c674ccf05b907a88ee62bddb7e fix string formatting + move function in correct module diff -r 85470ae0f728 -r 6d258ab35f70 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 85470ae0f728 -r 6d258ab35f70 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))