Mercurial > games > semicongine
changeset 587:713ac2886355
did: small name change
author | Sam <sam@basx.dev> |
---|---|
date | Tue, 11 Apr 2023 01:06:37 +0700 |
parents | a136e3f43c2c |
children | 008592db0442 |
files | src/semicongine/mesh.nim tests/test_vulkan_wrapper.nim |
diffstat | 2 files changed, 8 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- 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]())
--- 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)