# HG changeset patch # User Sam # Date 1681149997 -25200 # Node ID 713ac2886355340f823554a671aefc5533aee60f # Parent a136e3f43c2c314e686fcc70bf4754f0def696a3 did: small name change diff -r a136e3f43c2c -r 713ac2886355 src/semicongine/mesh.nim --- a/src/semicongine/mesh.nim Tue Apr 11 00:58:16 2023 +0700 +++ b/src/semicongine/mesh.nim Tue Apr 11 01:06:37 2023 +0700 @@ -112,7 +112,7 @@ func getRawData*(mesh: Mesh, attribute: string): (pointer, uint32) = mesh.data[attribute].getRawData() -proc setMeshData*[T: GPUType|int|uint|float](mesh: var Mesh, attribute: string, data: seq[T]) = +proc setInstanceData*[T: GPUType|int|uint|float](mesh: var Mesh, attribute: string, data: seq[T]) = assert uint32(data.len) == mesh.instanceCount assert not (attribute in mesh.data) mesh.data[attribute] = DataList(thetype: getDataType[T]()) diff -r a136e3f43c2c -r 713ac2886355 tests/test_vulkan_wrapper.nim --- a/tests/test_vulkan_wrapper.nim Tue Apr 11 00:58:16 2023 +0700 +++ b/tests/test_vulkan_wrapper.nim Tue Apr 11 01:06:37 2023 +0700 @@ -91,10 +91,10 @@ indices=[[0'u16, 1'u16, 2'u16]], instanceCount=2 ) - setMeshData[Vec3f](mymesh1, "translate", @[newVec3f(0.3, 0.0)]) - setMeshData[Vec3f](mymesh2, "translate", @[newVec3f(0.0, 0.3)]) - setMeshData[Vec3f](mymesh3, "translate", @[newVec3f(-0.3, 0.0)]) - setMeshData[Vec3f](mymesh4, "translate", @[newVec3f(0.0, -0.3), newVec3f(0.0, 0.5)]) + mymesh1.setInstanceData("translate", @[newVec3f(0.3, 0.0)]) + mymesh2.setInstanceData("translate", @[newVec3f(0.0, 0.3)]) + mymesh3.setInstanceData("translate", @[newVec3f(-0.3, 0.0)]) + mymesh4.setInstanceData("translate", @[newVec3f(0.0, -0.3), newVec3f(0.0, 0.5)]) result = Scene( name: "main", root: newEntity("root", newEntity("triangle", mymesh4, mymesh3, mymesh2, mymesh1)) @@ -104,9 +104,9 @@ var r = rect(color="ff0000") var t = tri(color="0000ff") var c = circle(color="00ff00") - setMeshData[Vec3f](r, "translate", @[newVec3f(0.5, -0.3)]) - setMeshData[Vec3f](t, "translate", @[newVec3f(0.3, 0.3)]) - setMeshData[Vec3f](c, "translate", @[newVec3f(-0.3, 0.1)]) + setInstanceData[Vec3f](r, "translate", @[newVec3f(0.5, -0.3)]) + setInstanceData[Vec3f](t, "translate", @[newVec3f(0.3, 0.3)]) + setInstanceData[Vec3f](c, "translate", @[newVec3f(-0.3, 0.1)]) result = Scene( name: "main", root: newEntity("root", t, r, c)