diff options
author | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-10-18 00:18:50 +1100 |
---|---|---|
committer | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-10-18 00:18:50 +1100 |
commit | df81a840a5276c35df5f35d55610f1bf31487153 (patch) | |
tree | 51b4fe8d90911e83ea3248481dc40b47a3b95083 /examples/cube.c | |
parent | a9b750f003c711eb08cbc4b6b383de0ddab6ddcc (diff) |
port a few more math functions
Diffstat (limited to 'examples/cube.c')
-rw-r--r-- | examples/cube.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/examples/cube.c b/examples/cube.c index 6642e2a..629a570 100644 --- a/examples/cube.c +++ b/examples/cube.c @@ -1,12 +1,25 @@ #include <celeritas.h> - -// vertices +#include "glfw3.h" pipeline_handle draw_pipeline; buf_handle cube_vbuf; tex_handle texture; +// transformation data +typedef struct MVPData { + mat4 model; + mat4 view; + mat4 projection; +} MVPData; + void draw() { + // prepare data + mat4 translation_matrix = mat4_translation(vec3(0, 0, -1)); + + f32 angle_degrees = glfwGetTime() / 2.0 * 45.0; + f32 angle = angle_degrees * PI / 180.0; + mat4 rotation_matrix = mat4_rotation(quat_from_axis_angle(VEC3_Y, angle, true)); + render_pass_desc d = {}; gpu_encoder* enc = ral_render_encoder(d); ral_encode_bind_pipeline(enc, draw_pipeline); @@ -32,7 +45,7 @@ int main() { .fragment = { .source = NULL, .is_spirv = false, - .entry_point = "cubeFragmentShader", + .entry_point = "fragmentShader", .stage = STAGE_FRAGMENT, }, }; @@ -54,4 +67,4 @@ int main() { } return 0; -}
\ No newline at end of file +} |