diff options
Diffstat (limited to 'src/main.odin')
-rw-r--r-- | src/main.odin | 261 |
1 files changed, 218 insertions, 43 deletions
diff --git a/src/main.odin b/src/main.odin index f09ccb4..bb4803e 100644 --- a/src/main.odin +++ b/src/main.odin @@ -139,47 +139,222 @@ main :: proc() { } vertices: []f32 = { - -0.5, -0.5, -0.5, 0.0, 0.0, -1.0, - 0.5, -0.5, -0.5, 0.0, 0.0, -1.0, - 0.5, 0.5, -0.5, 0.0, 0.0, -1.0, - 0.5, 0.5, -0.5, 0.0, 0.0, -1.0, - -0.5, 0.5, -0.5, 0.0, 0.0, -1.0, - -0.5, -0.5, -0.5, 0.0, 0.0, -1.0, - - -0.5, -0.5, 0.5, 0.0, 0.0, 1.0, - 0.5, -0.5, 0.5, 0.0, 0.0, 1.0, - 0.5, 0.5, 0.5, 0.0, 0.0, 1.0, - 0.5, 0.5, 0.5, 0.0, 0.0, 1.0, - -0.5, 0.5, 0.5, 0.0, 0.0, 1.0, - -0.5, -0.5, 0.5, 0.0, 0.0, 1.0, - - -0.5, 0.5, 0.5, -1.0, 0.0, 0.0, - -0.5, 0.5, -0.5, -1.0, 0.0, 0.0, - -0.5, -0.5, -0.5, -1.0, 0.0, 0.0, - -0.5, -0.5, -0.5, -1.0, 0.0, 0.0, - -0.5, -0.5, 0.5, -1.0, 0.0, 0.0, - -0.5, 0.5, 0.5, -1.0, 0.0, 0.0, - - 0.5, 0.5, 0.5, 1.0, 0.0, 0.0, - 0.5, 0.5, -0.5, 1.0, 0.0, 0.0, - 0.5, -0.5, -0.5, 1.0, 0.0, 0.0, - 0.5, -0.5, -0.5, 1.0, 0.0, 0.0, - 0.5, -0.5, 0.5, 1.0, 0.0, 0.0, - 0.5, 0.5, 0.5, 1.0, 0.0, 0.0, - - -0.5, -0.5, -0.5, 0.0, -1.0, 0.0, - 0.5, -0.5, -0.5, 0.0, -1.0, 0.0, - 0.5, -0.5, 0.5, 0.0, -1.0, 0.0, - 0.5, -0.5, 0.5, 0.0, -1.0, 0.0, - -0.5, -0.5, 0.5, 0.0, -1.0, 0.0, - -0.5, -0.5, -0.5, 0.0, -1.0, 0.0, - - -0.5, 0.5, -0.5, 0.0, 1.0, 0.0, - 0.5, 0.5, -0.5, 0.0, 1.0, 0.0, - 0.5, 0.5, 0.5, 0.0, 1.0, 0.0, - 0.5, 0.5, 0.5, 0.0, 1.0, 0.0, - -0.5, 0.5, 0.5, 0.0, 1.0, 0.0, - -0.5, 0.5, -0.5, 0.0, 1.0, 0.0 + -0.5, + -0.5, + -0.5, + 0.0, + 0.0, + -1.0, + 0.5, + -0.5, + -0.5, + 0.0, + 0.0, + -1.0, + 0.5, + 0.5, + -0.5, + 0.0, + 0.0, + -1.0, + 0.5, + 0.5, + -0.5, + 0.0, + 0.0, + -1.0, + -0.5, + 0.5, + -0.5, + 0.0, + 0.0, + -1.0, + -0.5, + -0.5, + -0.5, + 0.0, + 0.0, + -1.0, + -0.5, + -0.5, + 0.5, + 0.0, + 0.0, + 1.0, + 0.5, + -0.5, + 0.5, + 0.0, + 0.0, + 1.0, + 0.5, + 0.5, + 0.5, + 0.0, + 0.0, + 1.0, + 0.5, + 0.5, + 0.5, + 0.0, + 0.0, + 1.0, + -0.5, + 0.5, + 0.5, + 0.0, + 0.0, + 1.0, + -0.5, + -0.5, + 0.5, + 0.0, + 0.0, + 1.0, + -0.5, + 0.5, + 0.5, + -1.0, + 0.0, + 0.0, + -0.5, + 0.5, + -0.5, + -1.0, + 0.0, + 0.0, + -0.5, + -0.5, + -0.5, + -1.0, + 0.0, + 0.0, + -0.5, + -0.5, + -0.5, + -1.0, + 0.0, + 0.0, + -0.5, + -0.5, + 0.5, + -1.0, + 0.0, + 0.0, + -0.5, + 0.5, + 0.5, + -1.0, + 0.0, + 0.0, + 0.5, + 0.5, + 0.5, + 1.0, + 0.0, + 0.0, + 0.5, + 0.5, + -0.5, + 1.0, + 0.0, + 0.0, + 0.5, + -0.5, + -0.5, + 1.0, + 0.0, + 0.0, + 0.5, + -0.5, + -0.5, + 1.0, + 0.0, + 0.0, + 0.5, + -0.5, + 0.5, + 1.0, + 0.0, + 0.0, + 0.5, + 0.5, + 0.5, + 1.0, + 0.0, + 0.0, + -0.5, + -0.5, + -0.5, + 0.0, + -1.0, + 0.0, + 0.5, + -0.5, + -0.5, + 0.0, + -1.0, + 0.0, + 0.5, + -0.5, + 0.5, + 0.0, + -1.0, + 0.0, + 0.5, + -0.5, + 0.5, + 0.0, + -1.0, + 0.0, + -0.5, + -0.5, + 0.5, + 0.0, + -1.0, + 0.0, + -0.5, + -0.5, + -0.5, + 0.0, + -1.0, + 0.0, + -0.5, + 0.5, + -0.5, + 0.0, + 1.0, + 0.0, + 0.5, + 0.5, + -0.5, + 0.0, + 1.0, + 0.0, + 0.5, + 0.5, + 0.5, + 0.0, + 1.0, + 0.0, + 0.5, + 0.5, + 0.5, + 0.0, + 1.0, + 0.0, + -0.5, + 0.5, + 0.5, + 0.0, + 1.0, + 0.0, + -0.5, + 0.5, + -0.5, + 0.0, + 1.0, + 0.0, } @@ -194,7 +369,7 @@ main :: proc() { gl.STATIC_DRAW, ) - gl.GenVertexArrays(1, &cube_vao) + gl.GenVertexArrays(1, &cube_vao) gl.BindVertexArray(cube_vao) gl.VertexAttribPointer(0, 3, gl.FLOAT, gl.FALSE, 6 * size_of(f32), 0) gl.EnableVertexAttribArray(0) @@ -227,7 +402,7 @@ main :: proc() { light_color := Vec3{1.0, 1.0, 1.0} shader.set_vec3(lighting_shader, cstring("object_color"), &object_color) shader.set_vec3(lighting_shader, cstring("light_color"), &light_color) - shader.set_vec3(lighting_shader, cstring("light_position"), &light_pos) + shader.set_vec3(lighting_shader, cstring("light_position"), &light_pos) aspect: f32 = 800.0 / 600.0 projection := linalg.matrix4_perspective_f32( |