// ============================================= // Aster: constants.h // Copyright (c) 2020-2024 Anish Bhobe // ============================================= #pragma once #include #include #include #include #include using c8 = char; using u8 = uint8_t; using u16 = uint16_t; using u32 = uint32_t; using u64 = uint64_t; using i8 = int8_t; using i16 = int16_t; using i32 = int32_t; using i64 = int64_t; using f32 = float; using f64 = double; using f128 = long double; using b8 = bool; using b32 = u32; using usize = size_t; using p64 = intptr_t; constexpr usize strlen_c(const char* s) { return *s == '\0' ? 0 : 1 + strlen_c(s + 1); } constexpr auto ANSI_Black = "\u001b[30m"; constexpr auto ANSI_Red = "\u001b[31m"; constexpr auto ANSI_Green = "\u001b[32m"; constexpr auto ANSI_Yellow = "\u001b[33m"; constexpr auto ANSI_Blue = "\u001b[34m"; constexpr auto ANSI_Magenta = "\u001b[35m"; constexpr auto ANSI_Cyan = "\u001b[36m"; constexpr auto ANSI_White = "\u001b[37m"; constexpr auto ANSI_Reset = "\u001b[0m"; using std::move; using std::forward; using std::tie; template using Option = std::optional; template constexpr auto cast(from_t&& _in) { return static_cast(forward(_in)); } template constexpr auto recast(from_t&& _in) { return reinterpret_cast(forward(_in)); } constexpr f32 operator ""_deg(f128 degrees) { return glm::radians(cast(degrees)); } constexpr f32 operator ""_deg(u64 degrees) { return glm::radians(cast(degrees)); } using glm::ivec2; using glm::ivec3; using glm::ivec4; using glm::vec2; using glm::vec3; using glm::vec4; using glm::mat2; using glm::mat3; using glm::mat4; constexpr const char* PROJECT_NAME = "Aster"; struct Version { u32 major; u32 minor; u32 patch; }; constexpr Version VERSION = { .major = 0, .minor = 0, .patch = 1, }; enum class Error { eUnknown = 1000, eNoDevices = 1001, }; template constexpr T max_value = std::numeric_limits::max(); template constexpr T min_value = std::numeric_limits::min(); template constexpr T lowest_value = std::numeric_limits::lowest(); template constexpr T err_epsilon = std::numeric_limits::epsilon(); template constexpr T positive_inf = std::numeric_limits::infinity(); template constexpr T negative_inf = -std::numeric_limits::infinity(); template constexpr T qnan = std::numeric_limits::quiet_NaN(); template constexpr T snan = std::numeric_limits::signalling_NaN();