Add FPS counter
Added console FPS counter. Thise required me to create some time functions and remove FPS cap from Vulkan Signed-off-by: Piotr Krygier <piotrkrygier@everyonecancode@xyz>
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
#include <cglm/util.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <vulkan/vulkan_core.h>
|
||||
|
||||
#include "descriptor_builder.h"
|
||||
@@ -18,6 +17,7 @@
|
||||
#include "src/vulkan_buffers.h"
|
||||
#include "utilities/commons.h"
|
||||
#include "utilities/errors_common.h"
|
||||
#include "utilities/time_utils.h"
|
||||
#include "vulkan_base.h"
|
||||
#include "vulkan_commons.h"
|
||||
#include "vulkan_image.h"
|
||||
@@ -38,9 +38,6 @@ static void model_view_projection_update(struct graphics_context_t* context)
|
||||
float fovy;
|
||||
float z_near;
|
||||
float z_far;
|
||||
double diff_time = 0.0;
|
||||
struct timespec now = {0};
|
||||
static struct timespec last_time = {0};
|
||||
|
||||
eye[2] = -5.0f;
|
||||
|
||||
@@ -50,17 +47,9 @@ static void model_view_projection_update(struct graphics_context_t* context)
|
||||
z_near = 0.1f;
|
||||
z_far = 20.0f;
|
||||
|
||||
if (last_time.tv_nsec == 0) {
|
||||
timespec_get(&last_time, TIME_UTC);
|
||||
}
|
||||
|
||||
timespec_get(&now, TIME_UTC);
|
||||
|
||||
diff_time = NS_TO_S((double)(now.tv_nsec - last_time.tv_nsec)) + (now.tv_sec - last_time.tv_sec);
|
||||
|
||||
glm_mat4_identity(context->mvp_data.model);
|
||||
|
||||
glm_rotate(context->mvp_data.model, diff_time * glm_rad(90.0f), rotation_vec);
|
||||
glm_rotate(context->mvp_data.model, time_get_sec_from_start() * glm_rad(90.0f), rotation_vec);
|
||||
glm_lookat(eye, center, up, context->mvp_data.view);
|
||||
glm_perspective(
|
||||
fovy,
|
||||
|
||||
Reference in New Issue
Block a user