Compare commits

..

No commits in common. "cb5f207761de63ebf1ffd3e943b68295a2c78fbe" and "e281ba593cfea76f64ebaca2dd320f6cfdf0fb42" have entirely different histories.

3 changed files with 6 additions and 9 deletions

View File

@ -414,7 +414,7 @@ void render(void) {
void draw_camera(Vec3 position, float fov, Vec3 up, Vec3 direction) {
if (fabsf(0.0f - fov) < 0.00001f || fov >= M_PIf)
if (fabsf(0.0f - fov) < 0.00001f || fov > (M_PIf / 2))
log_warn("Invalid fov given (%f)", (double)fov);
Camera const camera = {
@ -431,7 +431,7 @@ void draw_camera(Vec3 position, float fov, Vec3 up, Vec3 direction) {
/* TODO: https://stackoverflow.com/questions/62493770/how-to-add-roll-in-camera-class */
DrawCameraFromPrincipalAxesResult draw_camera_from_principal_axes(Vec3 position, float fov, float roll, float pitch, float yaw) {
if (fabsf(0.0f - fov) < 0.00001f || fov >= M_PIf)
if (fabsf(0.0f - fov) < 0.00001f || fov > (M_PIf / 2))
log_warn("Invalid fov given (%f)", (double)fov);
(void)roll;

View File

@ -233,8 +233,7 @@ void input_state_update(InputState *input) {
SDL_GetRelativeMouseState(&x, &y);
input->mouse_relative_position = (Vec2){ (float)x, (float)y };
ctx.game.mouse_position.x = ((float)input->mouse_window_position.x - ctx.viewport_rect.x) / ctx.viewport_scale;
ctx.game.mouse_position.y = ((float)input->mouse_window_position.y - ctx.viewport_rect.y) / ctx.viewport_scale;
ctx.game.mouse_position = input->mouse_window_position;
if (ctx.window_mouse_resident)
ctx.game.mouse_movement = input->mouse_relative_position;

View File

@ -301,20 +301,18 @@ char *expand_asterisk(const char *mask, const char *to) {
void profile_start(char profile[const static 1]) {
uint64_t tick_accum = 0, sample_count = 0, worst_tick = 0;
uint64_t tick_accum = 0, sample_count = 0;
struct ProfileItem const *p = shgetp_null(profiles, profile);
if (p) {
tick_accum = p->value.tick_accum;
sample_count = p->value.sample_count;
worst_tick = p->value.worst_tick;
}
shput(profiles, profile, ((struct Profile) {
.tick_start = SDL_GetPerformanceCounter(),
.tick_accum = tick_accum,
.sample_count = sample_count,
.worst_tick = worst_tick,
}));
}
@ -343,13 +341,13 @@ void profile_list_stats(void) {
}
else if (profiles[i].value.sample_count == 1) {
log_info("Profile '%s' took: %fs",
log_info("Profile '%s' took: %f seconds",
profiles[i].key,
(double)profiles[i].value.tick_accum / (double)(SDL_GetPerformanceFrequency()));
}
else if (profiles[i].value.sample_count > 1) {
log_info("Profile '%s' on average took: %fs, worst case: %fs, sample count: %llu",
log_info("Profile '%s' on average took: %f seconds, worst case: %f, sample count: %llu",
profiles[i].key,
(double)profiles[i].value.tick_accum /
(double)profiles[i].value.sample_count /