# HG changeset patch # User sam # Date 1713203221 -25200 # Node ID 8b0a91fa2210d8e9d775b3f124a90e399ae8de3e # Parent 443e8090614c6844456cd663dd41e258deb16ff4 add: better error messages diff -r 443e8090614c -r 8b0a91fa2210 semicongine/engine.nim --- a/semicongine/engine.nim Tue Apr 16 00:36:39 2024 +0700 +++ b/semicongine/engine.nim Tue Apr 16 00:47:01 2024 +0700 @@ -182,7 +182,8 @@ proc renderScene*(engine: var Engine, scene: var Scene) = assert engine.state == Running - assert engine.renderer.isSome + assert engine.renderer.isSome, "Renderer has not yet been initialized, call 'engine.initRenderer' first" + assert engine.renderer.get.hasScene(scene), &"Scene '{scene.name}' has not been loaded yet" let t0 = getMonoTime() engine.renderer.get.startNewFrame() diff -r 443e8090614c -r 8b0a91fa2210 semicongine/renderer.nim --- a/semicongine/renderer.nim Tue Apr 16 00:36:39 2024 +0700 +++ b/semicongine/renderer.nim Tue Apr 16 00:47:01 2024 +0700 @@ -49,6 +49,9 @@ proc currentFrameCommandBuffer(renderer: Renderer): VkCommandBuffer = renderer.commandBufferPool.buffers[renderer.swapchain.currentInFlight] +proc hasScene*(renderer: Renderer, scene: Scene): bool = + scene in renderer.scenedata + proc initRenderer*( device: Device, shaders: openArray[(MaterialType, ShaderConfiguration)],