// // Created by Orange on 12/4/2024. // #pragma once #include "omath/engines/source_engine/constants.hpp" namespace omath::source_engine { [[nodiscard]] Vector3 forward_vector(const ViewAngles& angles) noexcept; [[nodiscard]] Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept; [[nodiscard]] Vector3 right_vector(const ViewAngles& angles) noexcept; [[nodiscard]] Vector3 up_vector(const ViewAngles& angles) noexcept; [[nodiscard]] Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3& cam_origin) noexcept; [[nodiscard]] Mat4X4 calc_perspective_projection_matrix(float field_of_view, float aspect_ratio, float near, float far, NDCDepthRange ndc_depth_range = NDCDepthRange::NEGATIVE_ONE_TO_ONE) noexcept; template requires std::is_floating_point_v [[nodiscard]] constexpr FloatingType units_to_centimeters(const FloatingType& units) { constexpr auto centimeter_in_unit = static_cast(2.54); return units * centimeter_in_unit; } template requires std::is_floating_point_v [[nodiscard]] constexpr FloatingType units_to_meters(const FloatingType& units) { return units_to_centimeters(units) / static_cast(100); } template requires std::is_floating_point_v [[nodiscard]] constexpr FloatingType units_to_kilometers(const FloatingType& units) { return units_to_meters(units) / static_cast(1000); } template requires std::is_floating_point_v [[nodiscard]] constexpr FloatingType centimeters_to_units(const FloatingType& centimeters) { constexpr auto centimeter_in_unit = static_cast(2.54); return centimeters / centimeter_in_unit; } template requires std::is_floating_point_v [[nodiscard]] constexpr FloatingType meters_to_units(const FloatingType& meters) { return centimeters_to_units(meters * static_cast(100)); } template requires std::is_floating_point_v [[nodiscard]] constexpr FloatingType kilometers_to_units(const FloatingType& kilometers) { return meters_to_units(kilometers * static_cast(1000)); } } // namespace omath::source_engine