comparison examples/alotof_triangles.nim @ 38:c3c963e7c1a6

did: tons of stuff, input, refactoring, fix some errors, some template improvment, sorry for super-commit
author Sam <sam@basx.dev>
date Wed, 18 Jan 2023 09:52:03 +0700
parents 9edca5dc4e93
children 2771db8d4276
comparison
equal deleted inserted replaced
37:6859bcfabc62 38:c3c963e7c1a6
40 40
41 var scene = new Thing 41 var scene = new Thing
42 42
43 for i in 1 .. 300: 43 for i in 1 .. 300:
44 var randommesh = new Mesh[VertexDataA] 44 var randommesh = new Mesh[VertexDataA]
45 # TODO: create randomized position11 from baseTriangle with random transformation matrix
46 let randomcolor1 = Vec3([float32(rand(1)), float32(rand(1)), float32(rand(1))]) 45 let randomcolor1 = Vec3([float32(rand(1)), float32(rand(1)), float32(rand(1))])
47 let transform1 = randomtransform() 46 let transform1 = randomtransform()
48 randommesh.vertexData = VertexDataA( 47 randommesh.vertexData = VertexDataA(
49 position11: PositionAttribute[Vec2[float32]]( 48 position11: PositionAttribute[Vec2[float32]](
50 data: @[ 49 data: @[
79 childthing.parts.add randomindexedmesh 78 childthing.parts.add randomindexedmesh
80 scene.children.add childthing 79 scene.children.add childthing
81 80
82 const vertexShader = generateVertexShaderCode[VertexDataA, Uniforms]() 81 const vertexShader = generateVertexShaderCode[VertexDataA, Uniforms]()
83 const fragmentShader = generateFragmentShaderCode[VertexDataA]() 82 const fragmentShader = generateFragmentShaderCode[VertexDataA]()
84 static:
85 echo "--------------"
86 for (i, line) in enumerate(vertexShader.splitLines()):
87 echo $(i + 1) & " " & line
88 echo "--------------"
89 echo fragmentShader
90 echo "--------------"
91 var pipeline = setupPipeline[VertexDataA, float32, uint16]( 83 var pipeline = setupPipeline[VertexDataA, float32, uint16](
92 myengine, 84 myengine,
93 scene, 85 scene,
94 vertexShader, 86 vertexShader,
95 fragmentShader 87 fragmentShader