Mercurial > games > semicongine
comparison tests/test_vulkan_wrapper.nim @ 109:8d24727c9795
did: refactor rendering/scene concept
| author | Sam <sam@basx.dev> |
|---|---|
| date | Wed, 29 Mar 2023 23:35:39 +0700 |
| parents | 70f92081d2c1 |
| children | 6fd10b7e2d6a |
comparison
equal
deleted
inserted
replaced
| 108:70f92081d2c1 | 109:8d24727c9795 |
|---|---|
| 1 import std/options | 1 import std/options |
| 2 | 2 |
| 3 import semicongine/vulkan | 3 import semicongine/vulkan |
| 4 import semicongine/platform/window | 4 import semicongine/platform/window |
| 5 import semicongine/math | 5 import semicongine/math |
| 6 import semicongine/entity | |
| 7 import semicongine/scene | |
| 6 | 8 |
| 7 type | 9 type |
| 8 Vertex = object | 10 Vertex = object |
| 9 pos: Vec3 | 11 pos: Vec3 |
| 10 FragmentInput = object | 12 FragmentInput = object |
| 73 renderpass = device.simpleForwardRenderPass(surfaceFormat.format, vertexshader, fragmentshader, 2) | 75 renderpass = device.simpleForwardRenderPass(surfaceFormat.format, vertexshader, fragmentshader, 2) |
| 74 var (swapchain, res) = device.createSwapchain(renderpass, surfaceFormat, device.firstGraphicsQueue().get().family, 2) | 76 var (swapchain, res) = device.createSwapchain(renderpass, surfaceFormat, device.firstGraphicsQueue().get().family, 2) |
| 75 if res != VK_SUCCESS: | 77 if res != VK_SUCCESS: |
| 76 raise newException(Exception, "Unable to create swapchain") | 78 raise newException(Exception, "Unable to create swapchain") |
| 77 | 79 |
| 80 var thescene = Scene(root: newEntity("scene")) | |
| 81 | |
| 78 echo "All successfull" | 82 echo "All successfull" |
| 79 for i in 0 ..< 2: | 83 for i in 0 ..< 2: |
| 80 discard swapchain.drawNextFrame() | 84 discard swapchain.drawNextFrame(thescene) |
| 81 echo "Rendered ", swapchain.framesRendered, " frames" | 85 echo "Rendered ", swapchain.framesRendered, " frames" |
| 82 echo "Start cleanup" | 86 echo "Start cleanup" |
| 83 | 87 |
| 84 | 88 |
| 85 # cleanup | 89 # cleanup |
