# HG changeset patch # User Sam # Date 1675531698 -25200 # Node ID bdef52f3bc0d30aaa2e4d31b341cb2d1e997cbb4 # Parent 31ccaeee09c9789620b849df80e0e621eaf3be56 fix: API changes diff -r 31ccaeee09c9 -r bdef52f3bc0d examples/E01_hello_triangle.nim --- a/examples/E01_hello_triangle.nim Sun Feb 05 00:20:07 2023 +0700 +++ b/examples/E01_hello_triangle.nim Sun Feb 05 00:28:18 2023 +0700 @@ -32,7 +32,7 @@ var myengine = igniteEngine("Hello triangle") # build a mesh - var trianglemesh = new Mesh[VertexDataA] + var trianglemesh = new Mesh[VertexDataA, uint16] trianglemesh.vertexData = VertexDataA( position: PositionAttribute[Vec2](data: triangle_pos), color: ColorAttribute[Vec3](data: triangle_color), @@ -43,7 +43,7 @@ # upload data, prepare shaders, etc const vertexShader = generateVertexShaderCode[VertexDataA, void]() const fragmentShader = generateFragmentShaderCode[VertexDataA]() - pipeline = setupPipeline[VertexDataA, void, void]( + pipeline = setupPipeline[VertexDataA, void, uint16]( myengine, triangle, vertexShader, diff -r 31ccaeee09c9 -r bdef52f3bc0d examples/E02_squares.nim --- a/examples/E02_squares.nim Sun Feb 05 00:20:07 2023 +0700 +++ b/examples/E02_squares.nim Sun Feb 05 00:28:18 2023 +0700 @@ -61,7 +61,7 @@ 3), uint16(vertIndex + 0)] - type PIndexedMesh = IndexedMesh[VertexDataA, + type PIndexedMesh = Mesh[VertexDataA, uint16] # required so we can use ctor with ref/on heap var squaremesh = PIndexedMesh( vertexData: VertexDataA( @@ -69,6 +69,7 @@ color22: ColorAttribute[Vec3](data: @colors), index: GenericAttribute[uint32](data: @iValues), ), + indexed: true, indices: @indices ) var scene = newThing("scene", newThing("squares", squaremesh)) @@ -79,10 +80,12 @@ float t = sin(uniforms.t * 0.5) * 0.5 + 0.5; float v = min(1, max(0, pow(pos_weight - t, 2))); v = pow(1 - v, 3000); - out_color = vec3(in_color.r, in_color.g, v * 0.5); + out_color = vec4(in_color.r, in_color.g, v * 0.5, 1.0); """ ) const fragmentShader = generateFragmentShaderCode[VertexDataA]() + static: + echo vertexShader pipeline = setupPipeline[VertexDataA, Uniforms, uint16]( myengine, scene, diff -r 31ccaeee09c9 -r bdef52f3bc0d examples/E03_hello_cube.nim --- a/examples/E03_hello_cube.nim Sun Feb 05 00:20:07 2023 +0700 +++ b/examples/E03_hello_cube.nim Sun Feb 05 00:28:18 2023 +0700 @@ -85,7 +85,8 @@ var myengine = igniteEngine("Hello cube") # build a mesh - var trianglemesh = new IndexedMesh[VertexDataA, uint16] + var trianglemesh = new Mesh[VertexDataA, uint16] + trianglemesh.indexed = true trianglemesh.vertexData = VertexDataA( position: PositionAttribute[Vec3](data: cube_pos), color: ColorAttribute[Vec3](data: cube_color),