Mercurial > games > semicongine
changeset 834:6001037da8c2
fix: make tests working again
author | Sam <sam@basx.dev> |
---|---|
date | Sat, 25 Nov 2023 22:59:06 +0700 |
parents | 34c44f32b621 |
children | 00e314018100 |
files | tests/test_materials.nim tests/test_mesh.nim |
diffstat | 2 files changed, 20 insertions(+), 11 deletions(-) [+] |
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)
--- a/tests/test_mesh.nim Sat Nov 25 22:58:25 2023 +0700 +++ b/tests/test_mesh.nim Sat Nov 25 22:59:06 2023 +0700 @@ -1,11 +1,8 @@ -import std/algorithm -import std/sequtils -import std/tables import semicongine proc main() = var scenes = [ - Scene(name: "Donut", meshes: loadMeshes("tutorialk-donat.glb", COLORED_SINGLE_TEXTURE_MATERIAL)[0].toSeq), + Scene(name: "Donut", meshes: loadMeshes("donut.glb", COLORED_SINGLE_TEXTURE_MATERIAL)[0].toSeq), ] var engine = initEngine("Test meshes")