diff options
| author | ladevieq <ladevie.quentin@gmail.com> | 2021-01-09 20:42:24 +0100 |
|---|---|---|
| committer | ladevieq <ladevie.quentin@gmail.com> | 2021-01-09 20:43:09 +0100 |
| commit | 2db0d27e7f1744443958717c19b732eed57455f2 (patch) | |
| tree | 839b8ea513c8c239f015071ab083bd50f03854a5 /include/utils.hpp | |
| parent | 4379b46b46563c5a709df8d567ef75affc3fd31c (diff) | |
Replace old classes with compute shader structs
Diffstat (limited to 'include/utils.hpp')
| -rw-r--r-- | include/utils.hpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/utils.hpp b/include/utils.hpp index efa007d..0bef213 100644 --- a/include/utils.hpp +++ b/include/utils.hpp @@ -5,6 +5,26 @@ #include <vector> +#include <cmath> +#include <cstdlib> + std::vector<uint8_t> get_shader_code(const char* path); +inline float deg_to_rad(float deg) { + return deg * M_PI / 180.0; +} + +inline float randd() { + return rand() / (RAND_MAX + 1.0); +} + +inline float randd(float min, float max) { + return min + randd() * (max - min); +} +inline float clamp(float x, float min, float max) { + if (x < min) return min; + if (x > max) return max; + return x; +} + #endif // !__UTILS_HPP_ |
