Mercurial > games > semicongine
diff tests/test_materials.nim @ 373:f4f1474dc70a
fix: make tests working again
author | Sam <sam@basx.dev> |
---|---|
date | Sat, 25 Nov 2023 22:59:06 +0700 |
parents | 61c5d5fe9d93 |
children | fa38cd28f041 |
line wrap: on
line diff
--- a/tests/test_materials.nim Sat Nov 25 22:58:25 2023 +0700 +++ b/tests/test_materials.nim Sat Nov 25 22:59:06 2023 +0700 @@ -14,14 +14,26 @@ RT, RT, RT, RT, RT, RT, RT, ]) swiss = loadImage("flag.png") - material = Material(name: "material", textures: { - "tex1": Texture(image: thai, sampler: sampler), - "tex2": Texture(image: swiss, sampler: sampler), - }.toTable) + doubleTextureMaterial = MaterialType( + name:"Double texture", + meshAttributes: { + "position": Vec3F32, + "uv": Vec2F32, + }.toTable, + attributes: {"tex1": TextureType, "tex2": TextureType}.toTable + ) + material = MaterialData( + theType: doubleTextureMaterial, + name: "swiss-thai", + attributes: { + "tex1": initDataList(@[Texture(image: thai, sampler: sampler)]), + "tex2": initDataList(@[Texture(image: swiss, sampler: sampler)]), + }.toTable + ) proc main() = var flag = rect() - flag.materials = @[material] + flag.material = material var scene = Scene(name: "main", meshes: @[flag]) scene.addShaderGlobalArray("test2", @[0'f32, 0'f32]) @@ -51,9 +63,9 @@ """, ) engine.initRenderer({ - "material": shaderConfiguration1, + doubleTextureMaterial: shaderConfiguration1, }) - engine.addScene(scene) + engine.loadScene(scene) var t = cpuTime() while engine.updateInputs() == Running and not engine.keyIsDown(Escape): var d = float32(cpuTime() - t)