140 lines
2.8 KiB
C++
140 lines
2.8 KiB
C++
// =============================================
|
|
// Aster: constants.h
|
|
// Copyright (c) 2020-2024 Anish Bhobe
|
|
// =============================================
|
|
|
|
#pragma once
|
|
|
|
#include <vulkan/vulkan_core.h>
|
|
|
|
#include <cstdint>
|
|
#include <cstdio>
|
|
|
|
#include <glm/glm.hpp>
|
|
|
|
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 uptr = uintptr_t;
|
|
using cstr = const char *;
|
|
|
|
namespace ansi_color
|
|
{
|
|
constexpr auto Black = "\u001b[30m";
|
|
constexpr auto Red = "\u001b[31m";
|
|
constexpr auto Green = "\u001b[32m";
|
|
constexpr auto Yellow = "\u001b[33m";
|
|
constexpr auto Blue = "\u001b[34m";
|
|
constexpr auto Magenta = "\u001b[35m";
|
|
constexpr auto Cyan = "\u001b[36m";
|
|
constexpr auto White = "\u001b[37m";
|
|
constexpr auto Reset = "\u001b[0m";
|
|
} // namespace ansi_color
|
|
|
|
template <typename TType, typename TFrom>
|
|
constexpr auto
|
|
Cast(TFrom &&in)
|
|
{
|
|
return static_cast<TType>(std::forward<TFrom>(in));
|
|
}
|
|
|
|
template <typename TType, typename TFrom>
|
|
constexpr auto
|
|
Recast(TFrom &&in)
|
|
{
|
|
return reinterpret_cast<TType>(std::forward<TFrom>(in));
|
|
}
|
|
|
|
constexpr f32
|
|
operator""_deg(long double degrees)
|
|
{
|
|
return glm::radians<f32>(Cast<f32>(degrees));
|
|
}
|
|
|
|
constexpr f32
|
|
operator""_deg(unsigned long long int degrees)
|
|
{
|
|
return glm::radians<f32>(Cast<f32>(degrees));
|
|
}
|
|
|
|
constexpr f32
|
|
operator""_rad(long double rads)
|
|
{
|
|
return Cast<f32>(rads);
|
|
}
|
|
|
|
constexpr f32
|
|
operator""_rad(unsigned long long int rads)
|
|
{
|
|
return Cast<f32>(rads);
|
|
}
|
|
|
|
using glm::ivec2;
|
|
using glm::ivec3;
|
|
using glm::ivec4;
|
|
using glm::vec2;
|
|
using glm::vec3;
|
|
using glm::vec4;
|
|
using glm::quat;
|
|
|
|
using glm::mat2;
|
|
using glm::mat3;
|
|
using glm::mat4;
|
|
|
|
constexpr auto *PROJECT_NAME = "Aster";
|
|
|
|
struct Version
|
|
{
|
|
u8 m_Major;
|
|
u8 m_Minor;
|
|
u8 m_Patch;
|
|
|
|
[[nodiscard]] u32
|
|
GetVkVersion() const
|
|
{
|
|
return VK_MAKE_API_VERSION(0, m_Major, m_Minor, m_Patch);
|
|
}
|
|
};
|
|
|
|
constexpr Version VERSION = {
|
|
.m_Major = 0,
|
|
.m_Minor = 1,
|
|
.m_Patch = 0,
|
|
};
|
|
|
|
template <typename T>
|
|
constexpr T MaxValue = std::numeric_limits<T>::max();
|
|
|
|
template <typename T>
|
|
constexpr T MinValue = std::numeric_limits<T>::min();
|
|
|
|
template <typename T>
|
|
constexpr T LowestValue = std::numeric_limits<T>::lowest();
|
|
|
|
template <typename T>
|
|
constexpr T ErrEpsilon = std::numeric_limits<T>::epsilon();
|
|
|
|
template <typename T>
|
|
constexpr T PositiveInf = std::numeric_limits<T>::infinity();
|
|
|
|
template <typename T>
|
|
constexpr T NegativeInf = -std::numeric_limits<T>::infinity();
|
|
|
|
template <typename T>
|
|
constexpr T Qnan = std::numeric_limits<T>::quiet_NaN();
|
|
|
|
template <typename T>
|
|
constexpr T Snan = std::numeric_limits<T>::signalling_NaN();
|