comparison tests/test_vulkan_wrapper.nim @ 353:61c5d5fe9d93

add: multi-material for meshes
author Sam <sam@basx.dev>
date Wed, 20 Sep 2023 22:35:04 +0700
parents b83b3a1ccb05
children 51ee41c1d8ed
comparison
equal deleted inserted replaced
352:00231e014642 353:61c5d5fe9d93
122 122
123 proc scene_primitives(): seq[Mesh] = 123 proc scene_primitives(): seq[Mesh] =
124 var r = rect(color="ff0000") 124 var r = rect(color="ff0000")
125 var t = tri(color="0000ff") 125 var t = tri(color="0000ff")
126 var c = circle(color="00ff00") 126 var c = circle(color="00ff00")
127 r.material = mat 127 r.materials = @[mat]
128 t.material = mat 128 t.materials = @[mat]
129 c.material = mat 129 c.materials = @[mat]
130 r.transform = translate(newVec3f(0.5, -0.3)) 130 r.transform = translate(newVec3f(0.5, -0.3))
131 t.transform = translate(newVec3f(0.3, 0.3)) 131 t.transform = translate(newVec3f(0.3, 0.3))
132 c.transform = translate(newVec3f(-0.3, 0.1)) 132 c.transform = translate(newVec3f(-0.3, 0.1))
133 result = @[r, c, t] 133 result = @[r, c, t]
134 134
145 145
146 proc scene_multi_material(): seq[Mesh] = 146 proc scene_multi_material(): seq[Mesh] =
147 var 147 var
148 r1 = rect(color="ffffff") 148 r1 = rect(color="ffffff")
149 r2 = rect(color="000000") 149 r2 = rect(color="000000")
150 r1.material = mat 150 r1.materials = @[mat]
151 r2.material = mat3 151 r2.materials = @[mat3]
152 r1.transform = translate(newVec3f(-0.5)) 152 r1.transform = translate(newVec3f(-0.5))
153 r2.transform = translate(newVec3f(+0.5)) 153 r2.transform = translate(newVec3f(+0.5))
154 result = @[r1, r2] 154 result = @[r1, r2]
155 155
156 proc main() = 156 proc main() =