Compare commits
	
		
			3 Commits
		
	
	
		
			e281ba593c
			...
			cb5f207761
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					cb5f207761 | ||
| 
						 | 
					6e421543c4 | ||
| 
						 | 
					c97d9b2568 | 
@@ -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 / 2))
 | 
			
		||||
    if (fabsf(0.0f - fov) < 0.00001f || fov >= M_PIf)
 | 
			
		||||
        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 / 2))
 | 
			
		||||
    if (fabsf(0.0f - fov) < 0.00001f || fov >= M_PIf)
 | 
			
		||||
        log_warn("Invalid fov given (%f)", (double)fov);
 | 
			
		||||
 | 
			
		||||
    (void)roll;
 | 
			
		||||
 
 | 
			
		||||
@@ -233,7 +233,8 @@ void input_state_update(InputState *input) {
 | 
			
		||||
    SDL_GetRelativeMouseState(&x, &y);
 | 
			
		||||
    input->mouse_relative_position = (Vec2){ (float)x, (float)y };
 | 
			
		||||
 | 
			
		||||
    ctx.game.mouse_position = input->mouse_window_position;
 | 
			
		||||
    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;
 | 
			
		||||
 | 
			
		||||
    if (ctx.window_mouse_resident)
 | 
			
		||||
        ctx.game.mouse_movement = input->mouse_relative_position;
 | 
			
		||||
 
 | 
			
		||||
@@ -301,18 +301,20 @@ 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;
 | 
			
		||||
    uint64_t tick_accum = 0, sample_count = 0, worst_tick = 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,
 | 
			
		||||
    }));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -341,13 +343,13 @@ void profile_list_stats(void) {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        else if (profiles[i].value.sample_count == 1) {
 | 
			
		||||
            log_info("Profile '%s' took: %f seconds",
 | 
			
		||||
            log_info("Profile '%s' took: %fs",
 | 
			
		||||
                     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: %f seconds, worst case: %f, sample count: %llu",
 | 
			
		||||
            log_info("Profile '%s' on average took: %fs, worst case: %fs, sample count: %llu",
 | 
			
		||||
                     profiles[i].key,
 | 
			
		||||
                     (double)profiles[i].value.tick_accum /
 | 
			
		||||
                        (double)profiles[i].value.sample_count /
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user