Initial Commit
This commit is contained in:
38
include/fennec/math/detail/__fwd.h
Normal file
38
include/fennec/math/detail/__fwd.h
Normal file
@@ -0,0 +1,38 @@
|
||||
// =====================================================================================================================
|
||||
// fennec, a free and open source game engine
|
||||
// Copyright © 2025 Medusa Slockbower
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
// =====================================================================================================================
|
||||
|
||||
/// \file __fwd.h
|
||||
/// \internal
|
||||
|
||||
#ifndef FWD_H
|
||||
#define FWD_H
|
||||
|
||||
#include <fennec/math/detail/__types.h>
|
||||
|
||||
namespace fennec
|
||||
{
|
||||
|
||||
template<typename ScalarT, size_t...IndicesV> struct vector;
|
||||
template<typename ScalarT, size_t RowsV, size_t...ColIndicesV> struct matrix;
|
||||
|
||||
template<typename ScalarT, size_t SizeV> using vec = decltype(detail::__gen_vector<vector, ScalarT>(make_index_sequence<SizeV>{}));
|
||||
template<typename ScalarT, size_t RowsV, size_t ColsV> using mat = decltype(detail::__gen_matrix<matrix, ScalarT, RowsV>(make_index_sequence<ColsV>{}));
|
||||
|
||||
}
|
||||
|
||||
#endif //FWD_H
|
||||
43
include/fennec/math/detail/__types.h
Normal file
43
include/fennec/math/detail/__types.h
Normal file
@@ -0,0 +1,43 @@
|
||||
// =====================================================================================================================
|
||||
// fennec, a free and open source game engine
|
||||
// Copyright © 2025 Medusa Slockbower
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
// =====================================================================================================================
|
||||
|
||||
/// \file __types.h
|
||||
/// \internal
|
||||
|
||||
#ifndef FENNEC_MATH_DETAIL_TYPES_H
|
||||
#define FENNEC_MATH_DETAIL_TYPES_H
|
||||
|
||||
#include <fennec/lang/sequences.h>
|
||||
|
||||
namespace fennec
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
/// \internal
|
||||
template<template<typename, size_t...> typename VectorT, typename ScalarT, size_t...IndicesV> VectorT<ScalarT, IndicesV...> __gen_vector(index_sequence<IndicesV...>);
|
||||
|
||||
/// \internal
|
||||
template<template<typename, size_t...> typename MatrixT, typename ScalarT, size_t RowsV, size_t...IndicesV> MatrixT<ScalarT, RowsV, IndicesV...> __gen_matrix(index_sequence<IndicesV...>);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // FENNEC_MATH_DETAIL_TYPES_H
|
||||
52
include/fennec/math/detail/__vector_traits.h
Normal file
52
include/fennec/math/detail/__vector_traits.h
Normal file
@@ -0,0 +1,52 @@
|
||||
// =====================================================================================================================
|
||||
// fennec, a free and open source game engine
|
||||
// Copyright © 2025 Medusa Slockbower
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
// =====================================================================================================================
|
||||
|
||||
/// \file __vector_traits.h
|
||||
/// \internal
|
||||
|
||||
#ifndef FENNEC_MATH_DETAIL_VECTOR_TRAITS_H
|
||||
#define FENNEC_MATH_DETAIL_VECTOR_TRAITS_H
|
||||
|
||||
#include <fennec/math/detail/__fwd.h>
|
||||
|
||||
#include <fennec/lang/type_traits.h>
|
||||
#include <fennec/math/swizzle.h>
|
||||
|
||||
namespace fennec
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template<typename> struct __is_vector_helper : false_type {};
|
||||
template<typename ScalarT, size_t...IndicesV> struct __is_vector_helper<vector<ScalarT, IndicesV...>> : true_type {};
|
||||
template<typename VectorT, typename DataT, typename ScalarT, size_t...IndicesV>
|
||||
struct __is_vector_helper<swizzle<VectorT, DataT, ScalarT, IndicesV...>> : true_type {};
|
||||
|
||||
template<typename> struct __component_count_helper;
|
||||
template<typename TypeT> requires(is_arithmetic_v<TypeT>) struct __component_count_helper<TypeT> : integral_constant<size_t, 1> {};
|
||||
template<typename ScalarT, size_t...IndicesV> struct __component_count_helper<vector<ScalarT, IndicesV...>> : integral_constant<size_t, sizeof...(IndicesV)> {};
|
||||
template<typename VectorT, typename DataT, typename ScalarT, size_t...IndicesV> struct __component_count_helper<swizzle<VectorT, DataT, ScalarT, IndicesV...>> : integral_constant<size_t, sizeof...(IndicesV)> {};
|
||||
template<typename ScalarT, size_t RowsV, size_t...ColIndicesV> struct __component_count_helper<matrix<ScalarT, RowsV, ColIndicesV...>> : integral_constant<size_t, RowsV * sizeof...(ColIndicesV)> {};
|
||||
template<typename> struct __component_count_helper : integral_constant<size_t, 0> {};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // FENNEC_MATH_DETAIL_VECTOR_TRAITS_H
|
||||
Reference in New Issue
Block a user