Mercurial > games > semicongine
comparison examples/E03_hello_cube.nim @ 1139:114f395b9144
did: finish refactoring and updated all tests accordingly
author | sam <sam@basx.dev> |
---|---|
date | Sat, 08 Jun 2024 14:58:25 +0700 |
parents | 71315636ba82 |
children | 5934c5615f13 |
comparison
equal
deleted
inserted
replaced
1138:02e1d2658ff5 | 1139:114f395b9144 |
---|---|
58 outputs = [attr[Vec4f]("color")], | 58 outputs = [attr[Vec4f]("color")], |
59 vertexCode = """outcolor = color; gl_Position = (Uniforms.projection * Uniforms.view * Uniforms.model) * vec4(position, 1);""", | 59 vertexCode = """outcolor = color; gl_Position = (Uniforms.projection * Uniforms.view * Uniforms.model) * vec4(position, 1);""", |
60 fragmentCode = "color = outcolor;", | 60 fragmentCode = "color = outcolor;", |
61 ) | 61 ) |
62 var matDef = MaterialType(name: "default material", vertexAttributes: {"position": Vec3F32, "color": Vec4F32}.toTable) | 62 var matDef = MaterialType(name: "default material", vertexAttributes: {"position": Vec3F32, "color": Vec4F32}.toTable) |
63 var cube = Scene(name: "scene", meshes: @[newMesh(positions = cube_pos, indices = tris, colors = cube_color, material = matDef.initMaterialData(name = "default"))]) | 63 var cube = Scene(name: "scene", meshes: @[newMesh(positions = cube_pos, indices = tris, colors = cube_color, material = matDef.InitMaterialData(name = "default"))]) |
64 cube.addShaderGlobal("projection", Unit4f32) | 64 cube.addShaderGlobal("projection", Unit4f32) |
65 cube.addShaderGlobal("view", Unit4f32) | 65 cube.addShaderGlobal("view", Unit4f32) |
66 cube.addShaderGlobal("model", Unit4f32) | 66 cube.addShaderGlobal("model", Unit4f32) |
67 myengine.initRenderer({matDef: shaderConfiguration}) | 67 myengine.initRenderer({matDef: shaderConfiguration}) |
68 myengine.loadScene(cube) | 68 myengine.loadScene(cube) |