# HG changeset patch # User sam # Date 1713203221 -25200 # Node ID 22af6e46f7f40af66492ac0df2335545485c4f4b # Parent f951a42dbb5b1e972ad6f0d392fb49e7e749a4d2 add: better error messages diff -r f951a42dbb5b -r 22af6e46f7f4 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 f951a42dbb5b -r 22af6e46f7f4 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)],