From 61e5bcef2629e2d68b805a956a96fff264d4f74d Mon Sep 17 00:00:00 2001 From: untodesu Date: Sat, 28 Jun 2025 01:59:49 +0500 Subject: Restructure dependencies and update to C++20 - Nuked static_assert from almost everywhere in the project - Nuked binary dependency support. Might add one later though - Separated dependency headers into a separate include subdirectory - Grafted a thirdpartylegalnotices.txt generator from RITEG - Pushed development snapshot version to 2126 (26th week of 2025) --- core/vectors.hh | 50 ++++++++++++++++++++++++-------------------------- 1 file changed, 24 insertions(+), 26 deletions(-) (limited to 'core/vectors.hh') diff --git a/core/vectors.hh b/core/vectors.hh index 86263b7..a6e9c75 100644 --- a/core/vectors.hh +++ b/core/vectors.hh @@ -2,48 +2,46 @@ #define CORE_VECTORS_HH 1 #pragma once -// cxvectors.hh - because NO ONE would POSSIBLY +#include "core/concepts.hh" + +// core/vectors.hh - because NO ONE would POSSIBLY // need integer-based distance calculations in a // game about voxels. That would be INSANE! :D -namespace cxvectors +namespace vx { -template -constexpr static inline const value_type length2(const glm::vec<2, value_type>& vector); -template -constexpr static inline const value_type length2(const glm::vec<3, value_type>& vector); -template -constexpr static inline const value_type distance2(const glm::vec<2, value_type>& vector_a, const glm::vec<2, value_type>& vector_b); -template -constexpr static inline const value_type distance2(const glm::vec<3, value_type>& vector_a, const glm::vec<3, value_type>& vector_b); -} // namespace cxvectors - -template -constexpr static inline const value_type cxvectors::length2(const glm::vec<2, value_type>& vector) +template +constexpr static inline const T length2(const glm::vec<2, T>& vector); +template +constexpr static inline const T length2(const glm::vec<3, T>& vector); +template +constexpr static inline const T distance2(const glm::vec<2, T>& vector_a, const glm::vec<2, T>& vector_b); +template +constexpr static inline const T distance2(const glm::vec<3, T>& vector_a, const glm::vec<3, T>& vector_b); +} // namespace vx + +template +constexpr static inline const T vx::length2(const glm::vec<2, T>& vector) { - static_assert(std::is_arithmetic_v); return (vector.x * vector.x) + (vector.y * vector.y); } -template -constexpr static inline const value_type cxvectors::length2(const glm::vec<3, value_type>& vector) +template +constexpr static inline const T vx::length2(const glm::vec<3, T>& vector) { - static_assert(std::is_arithmetic_v); return (vector.x * vector.x) + (vector.y * vector.y) + (vector.z * vector.z); } -template -constexpr static inline const value_type cxvectors::distance2(const glm::vec<2, value_type>& vector_a, const glm::vec<2, value_type>& vector_b) +template +constexpr static inline const T vx::distance2(const glm::vec<2, T>& vector_a, const glm::vec<2, T>& vector_b) { - static_assert(std::is_arithmetic_v); - return cxvectors::length2(vector_a - vector_b); + return vx::length2(vector_a - vector_b); } -template -constexpr static inline const value_type cxvectors::distance2(const glm::vec<3, value_type>& vector_a, const glm::vec<3, value_type>& vector_b) +template +constexpr static inline const T vx::distance2(const glm::vec<3, T>& vector_a, const glm::vec<3, T>& vector_b) { - static_assert(std::is_arithmetic_v); - return cxvectors::length2(vector_a - vector_b); + return vx::length2(vector_a - vector_b); } #endif /* CORE_VECTORS_HH */ -- cgit