diff tests/test_vulkan_wrapper.nim @ 581:87e500bd528a

add: better mesh support, indexed mesh
author Sam <sam@basx.dev>
date Thu, 06 Apr 2023 00:30:48 +0700
parents 13febe7978e5
children dfaddaf96f09
line wrap: on
line diff
--- a/tests/test_vulkan_wrapper.nim	Wed Apr 05 00:45:16 2023 +0700
+++ b/tests/test_vulkan_wrapper.nim	Thu Apr 06 00:30:48 2023 +0700
@@ -49,7 +49,7 @@
   var device = instance.createDevice(
     selectedPhysicalDevice,
     @[],
-    @[],
+    @["VK_EXT_index_type_uint8"],
     selectedPhysicalDevice.filterForGraphicsPresentationQueues()
   )
 
@@ -90,13 +90,39 @@
         positions=[newVec3f(0.0, -0.5), newVec3f(0.5, 0.5), newVec3f(-0.5, 0.5)],
         colors=[newVec3f(1.0, 0.0, 0.0), newVec3f(0.0, 1.0, 0.0), newVec3f(0.0, 0.0, 1.0)],
       )),
+      newEntity("triangle1b", newMesh(
+        positions=[newVec3f(0.0, -0.4), newVec3f(0.4, 0.4), newVec3f(-0.4, 0.5)],
+        colors=[newVec3f(1.0, 0.0, 0.0), newVec3f(0.0, 1.0, 0.0), newVec3f(0.0, 0.0, 1.0)],
+      )),
+      newEntity("triangle2a", newMesh(
+        positions=[newVec3f(0.0, 0.5), newVec3f(0.5, -0.5), newVec3f(-0.5, -0.5)],
+        colors=[newVec3f(1.0, 0.0, 0.0), newVec3f(0.0, 1.0, 0.0), newVec3f(0.0, 0.0, 1.0)],
+        indices=[[0'u16, 2'u16, 1'u16]]
+      )),
+      newEntity("triangle2b", newMesh(
+        positions=[newVec3f(0.0, 0.4), newVec3f(0.4, -0.4), newVec3f(-0.4, -0.4)],
+        colors=[newVec3f(1.0, 0.0, 0.0), newVec3f(0.0, 1.0, 0.0), newVec3f(0.0, 0.0, 1.0)],
+        indices=[[0'u16, 2'u16, 1'u16]]
+      )),
+      newEntity("triangle3a", newMesh(
+        positions=[newVec3f(0.4, 0.5), newVec3f(0.9, -0.3), newVec3f(0.0, -0.3)],
+        colors=[newVec3f(1.0, 1.0, 0.0), newVec3f(1.0, 1.0, 0.0), newVec3f(1.0, 1.0, 0.0)],
+        indices=[[0'u32, 2'u32, 1'u32]],
+        autoResize=false
+      )),
+      newEntity("triangle3b", newMesh(
+        positions=[newVec3f(0.4, 0.5), newVec3f(0.9, -0.3), newVec3f(0.0, -0.3)],
+        colors=[newVec3f(1.0, 1.0, 0.0), newVec3f(1.0, 1.0, 0.0), newVec3f(1.0, 1.0, 0.0)],
+        indices=[[0'u32, 2'u32, 1'u32]],
+        autoResize=false
+      )),
     )
   )
   thescene.setupDrawables(renderPass)
 
   # MAINLOOP
   echo "Setup successfull, start rendering"
-  for i in 0 ..< 1000:
+  for i in 0 ..< 10000:
     discard swapchain.drawScene(thescene)
   echo "Rendered ", swapchain.framesRendered, " frames"
   checkVkResult device.vk.vkDeviceWaitIdle()