Added some animation with UBO

main
noah metz 2024-01-08 13:10:54 -07:00
parent 0a01cbc776
commit 52db4fca28
1 changed files with 6 additions and 1 deletions

@ -9,6 +9,7 @@
#define GLM_FORCE_DEPTH_ZERO_TO_ONE
#include <cglm/types.h>
#include <cglm/mat4.h>
#include <cglm/affine.h>
#include <stdio.h>
#include <string.h>
@ -1588,13 +1589,17 @@ VulkanContext* init_vulkan(GLFWwindow* window, uint32_t max_frames_in_flight) {
return context;
}
uint32_t counter = 0;
VkResult update_ubo(void** buffers, uint32_t frame_index) {
struct ShaderUBO ubo = {};
glm_mat4_identity(ubo.proj);
glm_mat4_identity(ubo.view);
glm_mat4_identity(ubo.model);
vec3 axis = {0.0f, 0.0f, 1.0f};
glm_rotate_make(ubo.model, counter/100.0f, axis);
memcpy(buffers[frame_index], (void*)&ubo, sizeof(ubo));
counter += 1;
return VK_SUCCESS;
}