A 3D game engine from scratch.
at main 27 lines 851 B view raw
1// (c) 2020 Vlad-Stefan Harbuz <vlad@vladh.net> 2 3#pragma once 4 5#include <chrono> 6namespace chrono = std::chrono; 7#include <assimp/cimport.h> 8#include "types.hpp" 9 10class util { 11public: 12 static f64 random(f64 min, f64 max); 13 static v3 aiVector3D_to_glm(aiVector3D *vec); 14 static quat aiQuaternion_to_glm(aiQuaternion *rotation); 15 static m4 aimatrix4x4_to_glm(aiMatrix4x4 *from); 16 static f32 round_to_nearest_multiple(f32 n, f32 multiple_of); 17 static f64 get_us_from_duration(chrono::duration<f64> duration); 18 static v3 get_orthogonal_vector(v3 *v); 19 static u32 kb_to_b(u32 value); 20 static u32 mb_to_b(u32 value); 21 static u32 gb_to_b(u32 value); 22 static u32 tb_to_b(u32 value); 23 static f32 b_to_kb(u32 value); 24 static f32 b_to_mb(u32 value); 25 static f32 b_to_gb(u32 value); 26 static f32 b_to_tb(u32 value); 27};