From 1d8d7c04786ab3964778e6f21fae145f661bb533 Mon Sep 17 00:00:00 2001 From: omniscient <17525998+omnisci3nce@users.noreply.github.com> Date: Thu, 4 Apr 2024 19:45:19 +1100 Subject: loading textures --- examples/gltf_loading/ex_gltf_loading.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'examples') 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); -- cgit v1.2.3-70-g09d2