diff examples/E04_input.nim @ 71:53ccd6090116

did: cleanup + auto-generate mvp-transformartion in shader code
author Sam <sam@basx.dev>
date Sun, 05 Feb 2023 11:39:11 +0700
parents d830a1c0f86e
children 779607656b12
line wrap: on
line diff
--- a/examples/E04_input.nim	Sun Feb 05 00:48:03 2023 +0700
+++ b/examples/E04_input.nim	Sun Feb 05 11:39:11 2023 +0700
@@ -1,4 +1,3 @@
-import std/tables
 import std/enumerate
 import std/strutils
 import std/typetraits
@@ -14,7 +13,7 @@
     color: ColorAttribute[Vec4]
     transform: ModelTransformAttribute
   Uniforms = object
-    projection: Descriptor[Mat44]
+    projection: ViewProjectionTransform
 
 const
   arrow = @[
@@ -213,9 +212,7 @@
   scene.add newThing("cursor", cursormesh)
 
   # upload data, prepare shaders, etc
-  const vertexShader = generateVertexShaderCode[VertexDataA, Uniforms]("""
-    out_position = uniforms.projection * transform * vec4(position, 1);
-  """)
+  const vertexShader = generateVertexShaderCode[VertexDataA, Uniforms]()
   const fragmentShader = generateFragmentShaderCode[VertexDataA]()
   pipeline = setupPipeline[VertexDataA, Uniforms, uint16](
     myengine,