diff options
author | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-04-04 19:45:19 +1100 |
---|---|---|
committer | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-04-04 19:45:19 +1100 |
commit | 1d8d7c04786ab3964778e6f21fae145f661bb533 (patch) | |
tree | b44802d6ca41804e7b104cdd05c05a96a039ad7c /examples/gltf_loading/ex_gltf_loading.c | |
parent | 0c770ecad71bb540d36402311e01a2b6b94242fd (diff) |
loading textures
Diffstat (limited to 'examples/gltf_loading/ex_gltf_loading.c')
-rw-r--r-- | examples/gltf_loading/ex_gltf_loading.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/examples/gltf_loading/ex_gltf_loading.c b/examples/gltf_loading/ex_gltf_loading.c index e00a9de..867ddb2 100644 --- a/examples/gltf_loading/ex_gltf_loading.c +++ b/examples/gltf_loading/ex_gltf_loading.c @@ -4,6 +4,7 @@ #include "core.h" #include "loaders.h" #include "maths.h" +#include "maths_types.h" #include "render.h" #include "render_types.h" @@ -16,6 +17,10 @@ const vec3 pointlight_positions[4] = { point_light point_lights[4]; int main() { + double currentFrame = glfwGetTime(); + double lastFrame = currentFrame; + double deltaTime; + core* core = core_bringup(); model_handle cube_handle = @@ -50,13 +55,20 @@ int main() { memcpy(&our_scene.point_lights, &point_lights, sizeof(point_light[4])); while (!glfwWindowShouldClose(core->renderer.window)) { + currentFrame = glfwGetTime(); + deltaTime = currentFrame - lastFrame; + lastFrame = currentFrame; input_update(&core->input); // threadpool_process_results(&core->threadpool, 1); render_frame_begin(&core->renderer); // Draw the model - transform model_tf = transform_create(vec3(0.0, 0.2, 0.0), quat_ident(), + static f32 angle = 0.0; + static f32 rot_speed = 0.5; + quat rot = quat_from_axis_angle(VEC3_Z, fmod(angle, TAU), true); + angle += (rot_speed * deltaTime); + transform model_tf = transform_create(vec3(0.0, 0.1, -0.1), rot, 1.8); // make the backpack a bit bigger draw_model(&core->renderer, &cam, cube, model_tf, &our_scene); |