diff --git a/PLANNING.md b/PLANNING.md index 01ef1c9..314897c 100644 --- a/PLANNING.md +++ b/PLANNING.md @@ -81,7 +81,12 @@ as-needed basis. Implement headers related to memory allocation in C++. * Smart Pointers + * Unique Pointer + * Shared Pointer + - Memory Allocation + - Allocation + - @@ -128,13 +133,19 @@ fennec should be able to use Doxygen and LaTeX externally. Consider including bi - ODS - CSV - Graphics Formats - - BMP - - JPG - - PNG - - TIFF - - DDS - - Wavefront OBJ - - FBX + - Textures + - BMP + - DDS + - JPG + - PNG + - TIFF + - Vectors + - OTF + - SVG + - TTF + - Models + - FBX + - Wavefront OBJ **MAYBE** * Compilation (`fproc/code`) @@ -183,6 +194,8 @@ in their operation order: ### Frame + - **Physics** + - Physics Interpolation - **Graphics** - See [Stages](#stages-gfx3d) - **Audio** @@ -214,6 +227,27 @@ implementations than I could write. ## 2D Graphics (`gfx2d`) +Links: + - https://en.wikipedia.org/wiki/Quadtree + - https://developer.nvidia.com/gpugems/gpugems3/part-iv-image-effects/chapter-25-rendering-vector-art-gpu + +Object Structure. The mesh is implicit data. + + +### Structures (`gfx2d`) + +For the 2d rendering framework, Materials need to be rendered independently because we have +no size constraints for images. This disallows us from using a meta-shader like in +the 3d rendering framework. + +```c++ +struct Object +{ + vec2 location, scale; // A matrix would be 36 bytes, this is instead 20 bytes + float rotation; +} +``` + - BVH - Quadtree - Leaf Size and Tree Depth should be calculated by the scene, constraints are as follows: @@ -238,6 +272,10 @@ implementations than I could write. - Adjust Buffer Size using the counts - Insert using another atomic buffer + - Translucent objects will be sorted. We can cheat by using a z-index instead of a z-coordinate. + This will allow us to sort objects as they are created. We can still bulk render each z-index, + with meshes and objects being grouped by material. + @@ -305,6 +343,8 @@ Cubemaps may only be `1:1`, I would be concerned if you are using any other rati Documentation should provide guidelines on categories of Art Assets and the resolution of textures to use. Textures are identified by an 8-bit integer and 16-bit integer. + - `int8` → the texture buffer + - `int16` → the layer in the buffer Artists should be informed on the texture structure of the engine and its limitations. However, these principles should be followed in other game engines as these are @@ -333,8 +373,8 @@ Unless otherwise specified, each stage will be run on the GPU. - Scene Edge - Insertions and Updates are done on the CPU - Nodes - - Start Index 32-bits - - Object Count 32-bits + - Start Index `int32` + - Object Count `int32` - Objects - Buffer of Object IDs grouped by Octree Node - Leaf Culling @@ -348,16 +388,16 @@ Unless otherwise specified, each stage will be run on the GPU. a bias towards a specific corner of the filter. - Perform a preprocessing step on the CPU to erase duplicate elements and fix the buffer continuity. - Let the duplicates be rendered. - - Generate the Culled Object Buffer by copying objects from the Object Buffer + - Generate the Culled Object Buffer with the respective object IDs - Adjust Buffer Size using the counts - - Insert using another atomic buffer + - Insert by reusing the count buffer, clipped to only contain used meshes Debug View: Object ID, Mesh ID, LOD - Visibility - Buffer `(15 Bpp, 120 bpp) [1920x1080] ≈ 39.4MB` - - 24-Bit Depth Buffer - - RGB32I Visiblity Info + - Depth Buffer → `D24` + - Visibility Info → `RGB32I` - R = Object ID - G = Mesh ID - B = Material ID @@ -367,13 +407,13 @@ Debug View: Object ID, Mesh ID, LOD Debug View: Visibility Buffer * G-Buffer Pass `(17 Bpp, 136 bpp) [1920x1080] ≈ 35.3MB` - * Depth - Stencil → D24_S8 + * Depth - Stencil → `D24_S8` * S → used to represent the lighting model. - * Diffuse → RGBA8 + * Diffuse → `RGBA8` * A → Ambient Occlusion - * Emission → RGB8 - * Normal → RGB8 - * Specular → RGB8 + * Emission → `RGB8` + * Normal → `RGB8` + * Specular → `RGB8` * R → Roughness * G → Specularity (sometimes called the Metallicness) * B → Index of Refraction (IOR) @@ -381,9 +421,9 @@ Debug View: Visibility Buffer Debug View: Depth, Stencil, Diffuse, Emission, Normal, Specularity - Deferred Lighting Pass `(10 Bpp, 80 bpp) [1920x1080] ≈ 2 x 16.3MB + 8.3MB ≈ 24.6MB` - - Depth Buffer → D24 - - Lighting Buffer → RGB16 (w/ Mipmapping when Bloom or DoF are enabled) - - Stencil Buffer $rarr; S8 + - Depth Buffer → `D24` + - Lighting Buffer → `RGB16` (w/ Mipmapping when Bloom or DoF are enabled) + - Stencil Buffer $rarr; `S8` - Generate Dynamic Shadows - Generate Dynamic Reflections (Optional) - SSAO (Optional) diff --git a/README.md b/README.md index 23e86e8..56006bf 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ 3. [Running the Test Suite](#running-the-test-suite) 4. [Usage](#usage) 5. [Contribution](#contribution) + 6. [Documentation](./fennec_documentation.html)

diff --git a/doxy/Doxyfile b/doxy/Doxyfile index ed60b2c..52d9f29 100644 --- a/doxy/Doxyfile +++ b/doxy/Doxyfile @@ -784,7 +784,7 @@ SHOW_USED_FILES = YES # (if specified). # The default value is: YES. -SHOW_FILES = NO +SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces # page. This will remove the Namespaces entry from the Quick Index and from the @@ -1306,7 +1306,7 @@ CLANG_DATABASE_PATH = # classes, structs, unions or interfaces. # The default value is: YES. -ALPHABETICAL_INDEX = NO +ALPHABETICAL_INDEX = YES # The IGNORE_PREFIX tag can be used to specify a prefix (or a list of prefixes) # that should be ignored while generating the index headers. The IGNORE_PREFIX diff --git a/doxy/Doxyfile.in b/doxy/Doxyfile.in index 61ad918..5cad430 100644 --- a/doxy/Doxyfile.in +++ b/doxy/Doxyfile.in @@ -784,7 +784,7 @@ SHOW_USED_FILES = YES # (if specified). # The default value is: YES. -SHOW_FILES = NO +SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces # page. This will remove the Namespaces entry from the Quick Index and from the @@ -1306,7 +1306,7 @@ CLANG_DATABASE_PATH = # classes, structs, unions or interfaces. # The default value is: YES. -ALPHABETICAL_INDEX = NO +ALPHABETICAL_INDEX = YES # The IGNORE_PREFIX tag can be used to specify a prefix (or a list of prefixes) # that should be ignored while generating the index headers. The IGNORE_PREFIX diff --git a/doxy/header.html b/doxy/header.html index 6986b39..583d0a2 100644 --- a/doxy/header.html +++ b/doxy/header.html @@ -11,7 +11,7 @@ - + diff --git a/include/fennec/core/engine.h b/include/fennec/core/engine.h index d8ac073..e51393c 100644 --- a/include/fennec/core/engine.h +++ b/include/fennec/core/engine.h @@ -29,9 +29,8 @@ /// /// -/// \page page_fennec_documentation Documentation +/// \page documentation Documentation /// -/// \section page_fennec_documentation_pages Pages /// 1. \ref introduction "Introduction" /// 1. \ref coding-standards "Coding Standards" /// 2. \ref building-from-source "Building from Source" @@ -40,20 +39,20 @@ /// 3. \ref running-the-test-suite "Running the Test Suite" /// 4. \ref usage "Usage" /// 5. \ref contribution "Contribution" -/// 6. \subpage page_fennec_libraries -/// 1. \ref page_fennec_lang "C++ Language Library" -/// 2. \ref page_fennec_math "Math Library" +/// 6. \subpage libraries +/// 1. \ref fennec_lang "C++ Language Library" +/// 2. \ref fennec_math "Math Library" /// /// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html)) /// /// -/// \page page_fennec_libraries Libraries +/// \page libraries Libraries /// /// | Library | Brief | /// | :------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -/// | \subpage page_fennec_lang | Implementation for functions and classes related to the C++ Language, including base types, common utility functions, and metaprogramming templates | -/// | \subpage page_fennec_math | Implementation of math functions according to the [OpenGL 4.6 Shading Language Specification](https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.60.pdf). Additional extensions are provided for other common math functions. | +/// | \subpage fennec_lang | Implementation for functions and classes related to the C++ Language, including base types, common utility functions, and metaprogramming templates | +/// | \subpage fennec_math | Implementation of math functions according to the [OpenGL 4.6 Shading Language Specification](https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.60.pdf). Additional extensions are provided for other common math functions. | #ifndef FENNEC_CORE_ENGINE_H #define FENNEC_CORE_ENGINE_H diff --git a/include/fennec/lang/bits.h b/include/fennec/lang/bits.h index 0b14b03..19c194d 100644 --- a/include/fennec/lang/bits.h +++ b/include/fennec/lang/bits.h @@ -16,19 +16,31 @@ // along with this program. If not, see . // ===================================================================================================================== +/// +/// \file bits.h +/// \brief bit-wise operations +/// +/// +/// \details +/// \author Medusa Slockbower +/// +/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html)) +/// +/// + #ifndef FENNEC_LANG_BITS_H #define FENNEC_LANG_BITS_H #include +#include #include namespace fennec { /// -/// \fn fennec::bit_cast(const FromT&) -/// \brief +/// \brief perform a bitcast of FromT to ToT /// \tparam ToT Type to cast to /// \tparam FromT Type of the value /// \param from Value to bit cast @@ -41,25 +53,110 @@ constexpr ToT bit_cast(const FromT& from) else { ToT to; - memcpy(&to, &from, sizeof(ToT)); + fennec::memcpy(&to, &from, sizeof(ToT)); return to; } } -constexpr void* bitmask(void* arr, const void* mask, size_t n) + + + + +/// +/// \brief perform a bit-wise and over an array of bytes +/// \param arr the array of bytes to modify +/// \param mask the mask to and against arr +/// \param n the number of bytes +/// \returns the pointer arr +constexpr void* bit_and(void* arr, const void* mask, size_t n) { if (arr == mask) return arr; uint8_t* d = static_cast(arr); const uint8_t* s = static_cast(mask); - while (n >= 8) { detail::__bitmask_64(d, s); d += 8; s += 8; n -= 8; } - while (n >= 4) { detail::__bitmask_32(d, s); d += 4; s += 4; n -= 4; } - while (n >= 2) { detail::__bitmask_16(d, s); d += 2; s += 2; n -= 2; } - while (n >= 1) { *d++ = *s++; --n; } + while (n > 0) + { + size_t step = detail::__bit_and(d, s, n); + d += step; s += step; n -= step; + } return arr; } +/// +/// \brief safe version of fennec::bit_and +/// \copydoc fennec::bit_and +/// \param n0 the size of arr in bytes +/// \param n1 the size of mask in bytes +constexpr void* bit_and_s(void* arr, size_t n0, const void* mask, size_t n1) + { return bit_and(arr, mask, n0 < n1 ? n0 : n1); } + + + + + +/// +/// \brief perform a bit-wise or over an array of bytes +/// \param arr the array of bytes to modify +/// \param mask the mask to or against arr +/// \param n the number of bytes +/// \returns the pointer arr +constexpr void* bit_or(void* arr, const void* mask, size_t n) +{ + if (arr == mask) return arr; + uint8_t* d = static_cast(arr); + const uint8_t* s = static_cast(mask); + + while (n > 0) + { + size_t step = detail::__bit_or(d, s, n); + d += step; s += step; n -= step; + } + + return arr; +} + +/// +/// \brief safe version of fennec::bit_or +/// \copydoc fennec::bit_or +/// \param n0 the size of arr in bytes +/// \param n1 the size of mask in bytes +constexpr void* bit_or_s(void* arr, size_t n0, const void* mask, size_t n1) + { return bit_or(arr, mask, n0 < n1 ? n0 : n1); } + + + + + +/// +/// \brief perform a bit-wise or over an array of bytes +/// \param arr the array of bytes to modify +/// \param mask the mask to or against arr +/// \param n the number of bytes +/// \returns the pointer arr +constexpr void* bit_xor(void* arr, const void* mask, size_t n) +{ + if (arr == mask) return arr; + uint8_t* d = static_cast(arr); + const uint8_t* s = static_cast(mask); + + while (n > 0) + { + size_t step = detail::__bit_xor(d, s, n); + d += step; s += step; n -= step; + } + + return arr; +} + +/// +/// \brief safe version of fennec::bit_xor +/// \copydoc fennec::bit_xor +/// \param n0 the size of arr in bytes +/// \param n1 the size of mask in bytes +constexpr void* bit_xor_s(void* arr, size_t n0, const void* mask, size_t n1) + { return bit_xor(arr, mask, n0 < n1 ? n0 : n1); } + } #endif // FENNEC_LANG_BITS_H diff --git a/include/fennec/lang/conditional_types.h b/include/fennec/lang/conditional_types.h index 47a006b..a6d89f1 100644 --- a/include/fennec/lang/conditional_types.h +++ b/include/fennec/lang/conditional_types.h @@ -88,6 +88,13 @@ struct detect static constexpr bool is_detected = false; }; +/// +/// \brief Shorthand for ```typename detect::type``` +template typename DetectT, typename...ArgsT> +using detect_t + = typename detect::type; + + // true case template typename DetectT, typename...ArgsT> requires requires { typename DetectT; } @@ -97,13 +104,6 @@ struct detect static constexpr bool is_detected = true; }; - -/// -/// \brief Shorthand for ```typename detect::type``` -template typename DetectT, typename...ArgsT> -using detect_t - = typename detect::type; - } #endif // FENNEC_LANG_CONDITIONAL_TYPES_H diff --git a/include/fennec/lang/constants.h b/include/fennec/lang/constants.h index d9ad0b8..36418d8 100644 --- a/include/fennec/lang/constants.h +++ b/include/fennec/lang/constants.h @@ -48,7 +48,6 @@ template struct integral_constant /// \brief value of the constant inline static constexpr T value = V; - /// /// /// \brief cast operator to allow for braced initialization /// \returns the value of the constant @@ -56,7 +55,6 @@ template struct integral_constant }; -/// /// /// \brief metaprogramming boolean constant /// @@ -67,14 +65,12 @@ struct bool_constant : integral_constant {}; -/// /// /// \brief metaprogramming true constant struct true_type : bool_constant {}; -/// /// /// \brief metaprogramming false constant struct false_type diff --git a/include/fennec/lang/detail/__bits.h b/include/fennec/lang/detail/__bits.h index 6e09889..50b9ae4 100644 --- a/include/fennec/lang/detail/__bits.h +++ b/include/fennec/lang/detail/__bits.h @@ -27,17 +27,109 @@ namespace fennec namespace detail { -// helper for copying 2 bytes at once -constexpr size_t __bitmask_16(void* dst, const void* src) - { *static_cast(dst) = *static_cast(src); return 2; } +// helper for bitwise and for 1 byte +constexpr size_t __bit_and_8(void* dst, const void* src) + { *static_cast(dst) = *static_cast(dst) & *static_cast(src); return 1; } -// helper for copying 4 bytes at once -constexpr size_t __bitmask_32(void* dst, const void* src) - { *static_cast(dst) = *static_cast(src); return 4; } +// helper for bitwise and 2 bytes at once +constexpr size_t __bit_and_16(void* dst, const void* src) + { *static_cast(dst) = *static_cast(dst) & *static_cast(src); return 2; } -// helper for copying 8 bytes at once -constexpr size_t __bitmask_64(void* dst, const void* src) - { *static_cast(dst) = *static_cast(src); return 8; } +// helper for bitwise and 4 bytes at once +constexpr size_t __bit_and_32(void* dst, const void* src) + { *static_cast(dst) = *static_cast(dst) & *static_cast(src); return 4; } + +// helper for bitwise and 8 bytes at once +constexpr size_t __bit_and_64(void* dst, const void* src) + { *static_cast(dst) = *static_cast(dst) & *static_cast(src); return 8; } + +// helper for selecting size +constexpr size_t __bit_and(void* dst, const void* src, size_t n) +{ + switch (n) + { + case 0: + return 0; + case 1: + return __bit_and_8(dst, src); + case 2: case 3: + return __bit_and_16(dst, src); + case 4: case 5: case 6: case 7: + return __bit_and_32(dst, src); + default: + return __bit_and_64(dst, src); + } +} + + +// helper for bitwise or for 1 byte +constexpr size_t __bit_or_8(void* dst, const void* src) + { *static_cast(dst) = *static_cast(dst) | *static_cast(src); return 1; } + +// helper for bitwise or 2 bytes at once +constexpr size_t __bit_or_16(void* dst, const void* src) + { *static_cast(dst) = *static_cast(dst) | *static_cast(src); return 2; } + +// helper for bitwise or 4 bytes at once +constexpr size_t __bit_or_32(void* dst, const void* src) + { *static_cast(dst) = *static_cast(dst) | *static_cast(src); return 4; } + +// helper for bitwise or 8 bytes at once +constexpr size_t __bit_or_64(void* dst, const void* src) + { *static_cast(dst) = *static_cast(dst) | *static_cast(src); return 8; } + +// helper for selecting size +constexpr size_t __bit_or(void* dst, const void* src, size_t n) +{ + switch (n) + { + case 0: + return 0; + case 1: + return __bit_or_8(dst, src); + case 2: case 3: + return __bit_or_16(dst, src); + case 4: case 5: case 6: case 7: + return __bit_or_32(dst, src); + default: + return __bit_or_64(dst, src); + } +} + + +// helper for bitwise and 1 byte +constexpr size_t __bit_xor_8(void* dst, const void* src) + { *static_cast(dst) = *static_cast(dst) ^ *static_cast(src); return 1; } + +// helper for bitwise xor 2 bytes at once +constexpr size_t __bit_xor_16(void* dst, const void* src) + { *static_cast(dst) = *static_cast(dst) ^ *static_cast(src); return 2; } + +// helper for bitwise xor 4 bytes at once +constexpr size_t __bit_xor_32(void* dst, const void* src) + { *static_cast(dst) = *static_cast(dst) ^ *static_cast(src); return 4; } + +// helper for bitwise xor 8 bytes at once +constexpr size_t __bit_xor_64(void* dst, const void* src) + { *static_cast(dst) = *static_cast(dst) ^ *static_cast(src); return 8; } + +// helper for selecting size +constexpr size_t __bit_xor(void* dst, const void* src, size_t n) +{ + switch (n) + { + case 0: + return 0; + case 1: + return __bit_xor_8(dst, src); + case 2: case 3: + return __bit_xor_16(dst, src); + case 4: case 5: case 6: case 7: + return __bit_xor_32(dst, src); + default: + return __bit_xor_64(dst, src); + } +} } diff --git a/include/fennec/lang/lang.h b/include/fennec/lang/lang.h index 4f4e1cd..7533b8b 100644 --- a/include/fennec/lang/lang.h +++ b/include/fennec/lang/lang.h @@ -32,10 +32,12 @@ #define FENNEC_LANG_H /// -/// \page page_fennec_lang C++ Language Library +/// \page fennec_lang C++ Language Library /// /// This library implements the parts of the C++ stdlib that relate to built-in types and metaprogramming. /// +/// \subpage +/// /// #endif // FENNEC_LANG_H diff --git a/include/fennec/lang/limits.h b/include/fennec/lang/limits.h index 60bdbd8..9ca0a4a 100644 --- a/include/fennec/lang/limits.h +++ b/include/fennec/lang/limits.h @@ -44,41 +44,40 @@ enum float_round_style /// \tparam TypeT Numeric types, may be overloaded for custom types template struct numeric_limits { - static constexpr bool is_specialized = false; - static constexpr bool is_signed = false; - static constexpr bool is_integer = false; - static constexpr bool is_exact = false; - static constexpr bool has_infinity = false; - static constexpr bool has_quiet_nan = false; - static constexpr bool has_signaling_nan = false; - static constexpr bool has_denorm = false; - static constexpr bool has_denorm_loss = false; - static constexpr bool is_iec559 = false; - static constexpr bool is_bounded = false; - static constexpr bool is_modulo = false; - static constexpr bool tinyness_before = false; - static constexpr bool traps = false; + static constexpr bool is_specialized = false; ///< Check if the template is specialized for TypeT + static constexpr bool is_signed = false; ///< Check if TypeT is signed + static constexpr bool is_integer = false; ///< Check if TypeT is of an integral type + static constexpr bool is_exact = false; ///< Check if TypeT is exact in its precision + static constexpr bool has_infinity = false; ///< Check if TypeT can hold a value representing infinity + static constexpr bool has_quiet_nan = false; ///< Check if TypeT can hold a non-signaling nan + static constexpr bool has_signaling_nan = false; ///< Check if TypeT can hold a signaling nan + static constexpr bool is_iec559 = false; ///< Check if a TypeT representing a float is IEC 559 or IEEE 754 + static constexpr bool is_bounded = false; ///< Check if TypeT represents a finite set of values + static constexpr bool is_modulo = false; ///< Check if TypeT can handle modulo arithmetic + static constexpr bool tinyness_before = false; ///< Check if TypeT checks for tinyness before rounding + static constexpr bool traps = false; ///< Check if TypeT can cause operations to trap - static constexpr int digits = 0; - static constexpr int digits10 = 0; - static constexpr int max_digits10 = 0; - static constexpr int radix = 0; - static constexpr int min_exponent = 0; - static constexpr int min_exponent10 = 0; - static constexpr int max_exponent = 0; - static constexpr int max_exponent10 = 0; + static constexpr int radix = 0; ///< Get the base representation of the type + static constexpr int digits = 0; ///< Get the number of radix digits TypeT represents + static constexpr int digits10 = 0; ///< Get the number of decimal digits TypeT represents + static constexpr int max_digits10 = 0; ///< Get the maximum number of decimal digits TypeT represents + static constexpr int min_exponent = 0; ///< Get the minimum number of radix digits that represent the exponent of TypeT + static constexpr int min_exponent10 = 0; ///< Get the minimum number of decimal digits that represent the exponent of TypeT + static constexpr int max_exponent = 0; ///< Get the maximum number of radix digits that represent the exponent of TypeT + static constexpr int max_exponent10 = 0; ///< Get the maximum number of decimal digits that represent the exponent of TypeT - static constexpr float_round_style rounding_style = round_indeterminate; + static constexpr float_round_style rounding_style = round_indeterminate; ///< The rounding style of TypeT - static constexpr TypeT min() { return TypeT(); } - static constexpr TypeT max() { return TypeT(); } - static constexpr TypeT lowest() { return TypeT(); } - static constexpr TypeT epsilon() { return TypeT(); } - static constexpr TypeT round_error() { return TypeT(); } - static constexpr TypeT infinity() { return TypeT(); } - static constexpr TypeT quiet_NaN() { return TypeT(); } - static constexpr TypeT signaling_NaN() { return TypeT(); } - static constexpr TypeT denorm_min() { return TypeT(); } + // This is very poorly named and defined in the C++ Standard so these functions differ + static constexpr TypeT min() { return TypeT(); } ///< The minimum finite value of TypeT + static constexpr TypeT max() { return TypeT(); } ///< The maximum finite value of TypeT + static constexpr TypeT lowest() { return TypeT(); } ///< The smallest positive value of TypeT + static constexpr TypeT epsilon() { return TypeT(); } ///< Returns the difference between 1.0 and the next representable value + static constexpr TypeT round_error() { return TypeT(); } ///< Returns the max rounding error of TypeT + static constexpr TypeT infinity() { return TypeT(); } ///< Returns a value of TypeT holding a positive infinity + static constexpr TypeT quiet_NaN() { return TypeT(); } ///< Returns a value of TypeT holding a quiet NaN + static constexpr TypeT signaling_NaN() { return TypeT(); } ///< Returns a value of TypeT holding a signaling NaN + static constexpr TypeT denorm_min() { return TypeT(); } ///< Returns a value of TypeT holding the smallest positive subnormal }; // Overload for the builtin floating point type diff --git a/include/fennec/lang/numeric_transforms.h b/include/fennec/lang/numeric_transforms.h index dda33be..9d9743b 100644 --- a/include/fennec/lang/numeric_transforms.h +++ b/include/fennec/lang/numeric_transforms.h @@ -33,12 +33,18 @@ #include #include -// TODO: Document - namespace fennec { +/// +/// \brief Get the corresponding signed integral type of TypeT +/// \tparam TypeT the integral type to transform template struct make_signed : detail::__make_signed> {}; + + +/// +/// \brief Get the corresponding unsigned integral type of TypeT +/// \tparam TypeT the integral type to transform template struct make_unsigned : detail::__make_unsigned> {}; } diff --git a/include/fennec/lang/variadics.h b/include/fennec/lang/variadics.h index b590953..057edb8 100644 --- a/include/fennec/lang/variadics.h +++ b/include/fennec/lang/variadics.h @@ -47,7 +47,6 @@ template using first_element_t = typename first_element` and replace the first `ArgT` of `ArgsT...` with `SubT` template struct replace_first_element { }; diff --git a/include/fennec/math/common.h b/include/fennec/math/common.h index a948384..a10a1c0 100644 --- a/include/fennec/math/common.h +++ b/include/fennec/math/common.h @@ -18,7 +18,7 @@ /// /// \file common.h -/// \brief \ref page_fennec_math_common +/// \brief \ref fennec_math_common /// /// /// \details @@ -36,7 +36,7 @@ /// /// /// -/// \page page_fennec_math_common Common +/// \page fennec_math_common Common /// /// \brief The Common Functions defined in the [OpenGL 4.6 Shading Language Specification](https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.60.pdf). /// @@ -49,17 +49,17 @@ /// Description /// ///
-/// \ref fennec::abs(fennec::genType) "genIType abs(genIType)"
-/// \ref fennec::abs(fennec::genType) "genFType abs(genFType)"
-/// \ref fennec::abs(fennec::genType) "genDType abs(genDType)" +/// \ref fennec::abs(fennec::genType) "genIType abs(genIType x)"
+/// \ref fennec::abs(fennec::genType) "genFType abs(genFType x)"
+/// \ref fennec::abs(fennec::genType) "genDType abs(genDType x)" /// /// \copydetails fennec::abs(fennec::genType) /// /// ///
-/// \ref fennec::sign(fennec::genType) "genIType sign(genIType)"
-/// \ref fennec::sign(fennec::genType) "genFType sign(genFType)"
-/// \ref fennec::sign(fennec::genType) "genDType sign(genDType)" +/// \ref fennec::sign(fennec::genType) "genIType sign(genIType x)"
+/// \ref fennec::sign(fennec::genType) "genFType sign(genFType x)"
+/// \ref fennec::sign(fennec::genType) "genDType sign(genDType x)" /// /// \copydetails fennec::sign(fennec::genType) /// @@ -73,36 +73,36 @@ /// Description /// ///
-/// \ref fennec::floor(fennec::genType) "genFType floor(genFType)"
-/// \ref fennec::floor(fennec::genType) "genDType floor(genDType)" +/// \ref fennec::floor(fennec::genType) "genFType floor(genFType x)"
+/// \ref fennec::floor(fennec::genType) "genDType floor(genDType x)" /// /// \copydetails fennec::floor(fennec::genType) /// /// ///
-/// \ref fennec::ceil(fennec::genType) "genFType ceil(genFType)"
-/// \ref fennec::ceil(fennec::genType) "genDType ceil(genDType)" +/// \ref fennec::ceil(fennec::genType) "genFType ceil(genFType x)"
+/// \ref fennec::ceil(fennec::genType) "genDType ceil(genDType x)" /// /// \copydetails fennec::ceil(fennec::genType) /// /// ///
-/// \ref fennec::round(fennec::genType) "genFType round(genFType)"
-/// \ref fennec::round(fennec::genType) "genDType round(genDType)" +/// \ref fennec::round(fennec::genType) "genFType round(genFType x)"
+/// \ref fennec::round(fennec::genType) "genDType round(genDType x)" /// /// \copydetails fennec::round(fennec::genType) /// /// ///
-/// \ref fennec::roundEven(fennec::genType) "genFType roundEven(genFType)"
-/// \ref fennec::roundEven(fennec::genType) "genDType roundEven(genDType)" +/// \ref fennec::roundEven(fennec::genType) "genFType roundEven(genFType x)"
+/// \ref fennec::roundEven(fennec::genType) "genDType roundEven(genDType x)" /// /// \copydetails fennec::roundEven(fennec::genType) /// /// ///
-/// \ref fennec::trunc(fennec::genType) "genFType trunc(genFType)"
-/// \ref fennec::trunc(fennec::genType) "genDType trunc(genDType)" +/// \ref fennec::trunc(fennec::genType) "genFType trunc(genFType x)"
+/// \ref fennec::trunc(fennec::genType) "genDType trunc(genDType x)" /// /// \copydetails fennec::trunc(fennec::genType) /// @@ -116,46 +116,46 @@ /// Description /// ///
-/// \ref fennec::fract(fennec::genType) "genFType fract(genFType)"
-/// \ref fennec::fract(fennec::genType) "genDType fract(genDType)" +/// \ref fennec::fract(fennec::genType) "genFType fract(genFType x)"
+/// \ref fennec::fract(fennec::genType) "genDType fract(genDType x)" /// /// \copydetails fennec::fract(fennec::genType) /// ///
-/// \ref fennec::mod(fennec::genType, fennec::genType) "genFType mod(genFType, float)"
-/// \ref fennec::mod(fennec::genType, fennec::genType) "genFType mod(genFType, genFType)"
-/// \ref fennec::mod(fennec::genType, fennec::genType) "genDType mod(genDType, double)"
-/// \ref fennec::mod(fennec::genType, fennec::genType) "genDType mod(genDType, genDType)" +/// \ref fennec::mod "genFType mod(genFType x, float y)"
+/// \ref fennec::mod "genFType mod(genFType x, genFType y)"
+/// \ref fennec::mod "genDType mod(genDType x, double y)"
+/// \ref fennec::mod "genDType mod(genDType x, genDType y)" /// -/// \copydetails fennec::mod(fennec::genType, fennec::genType) +/// \copydetails fennec::mod /// ///
-/// \ref fennec::modf(fennec::genType, fennec::genType&) "genFType modf(genFType, out genFType)"
-/// \ref fennec::modf(fennec::genType, fennec::genType&) "genDType modf(genDType, out genDType)" +/// \ref fennec::modf(fennec::genType, fennec::genType&) "genFType modf(genFType x, out genFType i)"
+/// \ref fennec::modf(fennec::genType, fennec::genType&) "genDType modf(genDType x, out genDType i)" /// /// \copydetails fennec::modf(fennec::genType, fennec::genType&) /// ///
-/// \ref fennec::isnan(fennec::genType) "genBType isnan(genFType)"
-/// \ref fennec::isnan(fennec::genType) "genBType isnan(genDType)" +/// \ref fennec::isnan(fennec::genType) "genBType isnan(genFType x)"
+/// \ref fennec::isnan(fennec::genType) "genBType isnan(genDType x)" /// /// \copydetails fennec::isnan(fennec::genType) /// ///
-/// \ref fennec::isinf(fennec::genType) "genBType isinf(genFType)"
-/// \ref fennec::isinf(fennec::genType) "genBType isinf(genDType)" +/// \ref fennec::isinf(fennec::genType) "genBType isinf(genFType x)"
+/// \ref fennec::isinf(fennec::genType) "genBType isinf(genDType x)" /// /// \copydetails fennec::isinf(fennec::genType) /// ///
-/// \ref fennec::frexp(fennec::genType, fennec::genIType&) "genFType frexp(genFType, out genIType)"
-/// \ref fennec::frexp(fennec::genType, fennec::genIType&) "genDType frexp(genDType, out genIType)" +/// \ref fennec::frexp(fennec::genType, fennec::genIType&) "genFType frexp(genFType x, out genIType exp)"
+/// \ref fennec::frexp(fennec::genType, fennec::genIType&) "genDType frexp(genDType x, out genIType exp)" /// /// \copydetails fennec::frexp(fennec::genType, fennec::genIType&) /// ///
-/// \ref fennec::ldexp(fennec::genType, fennec::genIType) "genFType ldexp(genFType, genIType)"
-/// \ref fennec::ldexp(fennec::genType, fennec::genIType) "genDType ldexp(genDType, genIType)" +/// \ref fennec::ldexp(fennec::genType, fennec::genIType) "genFType ldexp(genFType x, genIType exp)"
+/// \ref fennec::ldexp(fennec::genType, fennec::genIType) "genDType ldexp(genDType x, genIType exp)" /// /// \copydetails fennec::ldexp(fennec::genType, fennec::genIType) /// @@ -169,14 +169,14 @@ /// Description /// ///
-/// \ref fennec::floatBitsToInt(fennec::genType) "genIType floatBitsToInt(genType)"
-/// \ref fennec::floatBitsToUint(fennec::genType) "genUType floatBitsToUint(genType)" +/// \ref fennec::floatBitsToInt(fennec::genType) "genIType floatBitsToInt(genType value)"
+/// \ref fennec::floatBitsToUint(fennec::genType) "genUType floatBitsToUint(genType value)" /// /// \copydetails fennec::floatBitsToUint(fennec::genType) /// ///
-/// \ref fennec::intBitsToFloat(fennec::genIType) "genFType intBitsToFloat(genIType)"
-/// \ref fennec::uintBitsToFloat(fennec::genUType) "genFType uintBitsToFloat(genUType)" +/// \ref fennec::intBitsToFloat(fennec::genIType) "genFType intBitsToFloat(genIType value)"
+/// \ref fennec::uintBitsToFloat(fennec::genUType) "genFType uintBitsToFloat(genUType value)" /// /// \copydetails fennec::uintBitsToFloat(fennec::genType) /// @@ -190,40 +190,40 @@ /// Description /// ///
-/// \ref fennec::min(fennec::genType, fennec::genType) "genFType min(genFType, float)"
-/// \ref fennec::min(fennec::genType, fennec::genType) "genFType min(genFType, genFType)"
-/// \ref fennec::min(fennec::genType, fennec::genType) "genDType min(genDType, double)"
-/// \ref fennec::min(fennec::genType, fennec::genType) "genDType min(genDType, genDType)"
-/// \ref fennec::min(fennec::genType, fennec::genType) "genIType min(genDType, int)"
-/// \ref fennec::min(fennec::genType, fennec::genType) "genIType min(genIType, genIType)"
-/// \ref fennec::min(fennec::genType, fennec::genType) "genUType min(genUType, uint)"
-/// \ref fennec::min(fennec::genType, fennec::genType) "genUType min(genUType, genUType)" +/// \ref fennec::min "genFType min(genFType x, float y)"
+/// \ref fennec::min "genFType min(genFType x, genFType y)"
+/// \ref fennec::min "genDType min(genDType x, double y)"
+/// \ref fennec::min "genDType min(genDType x, genDType y)"
+/// \ref fennec::min "genIType min(genDType x, int y)"
+/// \ref fennec::min "genIType min(genIType x, genIType y)"
+/// \ref fennec::min "genUType min(genUType x, uint y)"
+/// \ref fennec::min "genUType min(genUType x, genUType y)" /// -/// \copydetails fennec::min(fennec::genType, fennec::genType) +/// \copydetails fennec::min /// ///
-/// \ref fennec::max(fennec::genType, fennec::genType) "genFType max(genFType, float)"
-/// \ref fennec::max(fennec::genType, fennec::genType) "genFType max(genFType, genFType)"
-/// \ref fennec::max(fennec::genType, fennec::genType) "genDType max(genDType, double)"
-/// \ref fennec::max(fennec::genType, fennec::genType) "genDType max(genDType, genDType)"
-/// \ref fennec::max(fennec::genType, fennec::genType) "genIType max(genDType, int)"
-/// \ref fennec::max(fennec::genType, fennec::genType) "genIType max(genIType, genIType)"
-/// \ref fennec::max(fennec::genType, fennec::genType) "genUType max(genUType, uint)"
-/// \ref fennec::max(fennec::genType, fennec::genType) "genUType max(genUType, genUType)" +/// \ref fennec::max "genFType max(genFType x, float y)"
+/// \ref fennec::max "genFType max(genFType x, genFType y)"
+/// \ref fennec::max "genDType max(genDType x, double y)"
+/// \ref fennec::max "genDType max(genDType x, genDType y)"
+/// \ref fennec::max "genIType max(genDType x, int y)"
+/// \ref fennec::max "genIType max(genIType x, genIType y)"
+/// \ref fennec::max "genUType max(genUType x, uint y)"
+/// \ref fennec::max "genUType max(genUType x, genUType y)" /// -/// \copydetails fennec::max(fennec::genType, fennec::genType) +/// \copydetails fennec::max /// ///
-/// \ref fennec::clamp(fennec::genType, fennec::genType, fennec::genType) "genFType clamp(genFType, float, float)"
-/// \ref fennec::clamp(fennec::genType, fennec::genType, fennec::genType) "genFType clamp(genFType, genFType, genFType)"
-/// \ref fennec::clamp(fennec::genType, fennec::genType, fennec::genType) "genDType clamp(genDType, double, double)"
-/// \ref fennec::clamp(fennec::genType, fennec::genType, fennec::genType) "genDType clamp(genDType, genDType, genDType)"
-/// \ref fennec::clamp(fennec::genType, fennec::genType, fennec::genType) "genIType clamp(genDType, int, int)"
-/// \ref fennec::clamp(fennec::genType, fennec::genType, fennec::genType) "genIType clamp(genIType, genIType, genIType)"
-/// \ref fennec::clamp(fennec::genType, fennec::genType, fennec::genType) "genUType clamp(genUType(genUType, uint)"
-/// \ref fennec::clamp(fennec::genType, fennec::genType, fennec::genType) "genUType clamp(genUType, genUType, genUType)" +/// \ref fennec::clamp "genFType clamp(genFType x, float minVal, float maxVal)"
+/// \ref fennec::clamp "genFType clamp(genFType x, genFType minVal, genFType maxVal)"
+/// \ref fennec::clamp "genDType clamp(genDType x, double minVal, double maxVal)"
+/// \ref fennec::clamp "genDType clamp(genDType x, genDType minVal, genDType maxVal)"
+/// \ref fennec::clamp "genIType clamp(genDType x, int minVal, int maxVal)"
+/// \ref fennec::clamp "genIType clamp(genIType x, genIType minVal, genIType maxVal)"
+/// \ref fennec::clamp "genUType clamp(genUType x, genUType minVal, uint maxVal)"
+/// \ref fennec::clamp "genUType clamp(genUType x, genUType minVal, genUType maxVal)" /// -/// \copydetails fennec::clamp(fennec::genType, fennec::genType, fennec::genType) +/// \copydetails fennec::clamp /// /// /// @@ -235,37 +235,37 @@ /// Description /// ///
-/// \ref fennec::step(fennec::genType, fennec::genType) "step(float, genFType)"
-/// \ref fennec::step(fennec::genType, fennec::genType) "step(genFType, genFType)"
-/// \ref fennec::step(fennec::genType, fennec::genType) "step(double, genDType)"
-/// \ref fennec::step(fennec::genType, fennec::genType) "step(genFType, genDType)" +/// \ref fennec::step "step(float edge, genFType x)"
+/// \ref fennec::step "step(genFType edge, genFType x)"
+/// \ref fennec::step "step(double edge, genDType x)"
+/// \ref fennec::step "step(genFType edge, genDType x)" /// -/// \copydetails fennec::step(fennec::genType, fennec::genType) +/// \copydetails fennec::step /// ///
-/// \ref fennec::smoothstep(fennec::genType, fennec::genType, fennec::genType) "smoothstep(float, float, genFType)"
-/// \ref fennec::smoothstep(fennec::genType, fennec::genType, fennec::genType) "smoothstep(genFType, genFType, genFType)"
-/// \ref fennec::smoothstep(fennec::genType, fennec::genType, fennec::genType) "smoothstep(double, double, genDType)"
-/// \ref fennec::smoothstep(fennec::genType, fennec::genType, fennec::genType) "smoothstep(genFType, genFType, genDType)" +/// \ref fennec::smoothstep "smoothstep(float edge0, float edge1, genFType x)"
+/// \ref fennec::smoothstep "smoothstep(genFType edge0, genFType edge1, genFType x)"
+/// \ref fennec::smoothstep "smoothstep(double edge0, double edge1, genDType x)"
+/// \ref fennec::smoothstep "smoothstep(genFType edge0, genFType edge1, genDType x)" /// -/// \copydetails fennec::smoothstep(fennec::genType, fennec::genType, fennec::genType) +/// \copydetails fennec::smoothstep /// ///
-/// \ref fennec::mix(fennec::genType, fennec::genType, fennec::genType) "mix(genFType, genFType, float)"
-/// \ref fennec::mix(fennec::genType, fennec::genType, fennec::genType) "mix(genFType, genFType, genFType)"
-/// \ref fennec::mix(fennec::genType, fennec::genType, fennec::genType) "mix(genDType, genDType, double)"
-/// \ref fennec::mix(fennec::genType, fennec::genType, fennec::genType) "mix(genDType, genDType, genDType)" +/// \ref fennec::mix "mix(genFType x, genFType y, float a)"
+/// \ref fennec::mix "mix(genFType x, genFType y, genFType a)"
+/// \ref fennec::mix "mix(genDType x, genDType y, double a)"
+/// \ref fennec::mix "mix(genDType x, genDType y, genDType a)" /// -/// \copydetails fennec::mix(fennec::genType, fennec::genType, fennec::genType) +/// \copydetails fennec::mix /// ///
-/// \ref fennec::mix(fennec::genBType, fennec::genBType, fennec::genBType) "mix(genBType, genBType, genBType)"
-/// \ref fennec::mix(fennec::genType, fennec::genType, fennec::genBType) "mix(genIType, genIType, genBType)"
-/// \ref fennec::mix(fennec::genType, fennec::genType, fennec::genBType) "mix(genUType, genUType, genBType)"
-/// \ref fennec::mix(fennec::genType, fennec::genType, fennec::genBType) "mix(genFType, genFType, genBType)"
-/// \ref fennec::mix(fennec::genType, fennec::genType, fennec::genBType) "mix(genDType, genDType, genBType)" +/// \ref fennec::mix(fennec::genBType, fennec::genBType, fennec::genBType) "mix(genBType x, genBType y, genBType a)"
+/// \ref fennec::mix(fennec::genType, fennec::genType, fennec::genBType) "mix(genIType x, genIType y, genBType a)"
+/// \ref fennec::mix(fennec::genType, fennec::genType, fennec::genBType) "mix(genUType x, genUType y, genBType a)"
+/// \ref fennec::mix(fennec::genType, fennec::genType, fennec::genBType) "mix(genFType x, genFType y, genBType a)"
+/// \ref fennec::mix(fennec::genType, fennec::genType, fennec::genBType) "mix(genDType x, genDType y, genBType a)" /// -/// \copydetails fennec::mix(fennec::genType, fennec::genType, fennec::genType) +/// \copydetails fennec::mix /// /// /// @@ -332,7 +332,7 @@ template constexpr vector sign(const vector& x) { return vector(fennec::sign(x[i]) ...); } -// @} +/// @} diff --git a/include/fennec/math/exponential.h b/include/fennec/math/exponential.h index a9d3d13..0e435b8 100644 --- a/include/fennec/math/exponential.h +++ b/include/fennec/math/exponential.h @@ -18,7 +18,7 @@ /// /// \file exponential.h -/// \brief \ref page_fennec_math_exponential +/// \brief \ref fennec_math_exponential /// /// /// \details @@ -37,7 +37,7 @@ /// /// /// -/// \page page_fennec_math_exponential Exponential +/// \page fennec_math_exponential Exponential /// /// \brief The Exponential Functions defined in the [OpenGL 4.6 Shading Language Specification](https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.60.pdf). /// @@ -49,37 +49,37 @@ /// Description /// ///
-/// \ref fennec::pow(fennec::genType, fennec::genType) "genFType pow(genFType, genFType)" +/// \ref fennec::pow(fennec::genType, fennec::genType) "genFType pow(genFType x, genFType y)" /// /// \copydoc fennec::pow(fennec::genType, fennec::genType) /// ///
-/// \ref fennec::exp(fennec::genType)"genFType exp(genFType)" +/// \ref fennec::exp(fennec::genType)"genFType exp(genFType x)" /// /// \copydoc fennec::exp(fennec::genType) /// ///
-/// \ref fennec::exp2(fennec::genType) "genFType exp2(genFType)" +/// \ref fennec::exp2(fennec::genType) "genFType exp2(genFType x)" /// /// \copydoc fennec::exp2(fennec::genType) /// ///
-/// \ref fennec::log(fennec::genType) "genFType log(genFType)" +/// \ref fennec::log(fennec::genType) "genFType log(genFType x)" /// /// \copydoc fennec::log(fennec::genType) /// ///
-/// \ref fennec::log2(fennec::genType) "genFType log2(genFType)" +/// \ref fennec::log2(fennec::genType) "genFType log2(genFType x)" /// /// \copydoc fennec::log2(fennec::genType) /// ///
-/// \ref fennec::sqrt(fennec::genType) "genFType sqrt(genFType)" +/// \ref fennec::sqrt(fennec::genType) "genFType sqrt(genFType x)" /// /// \copydoc fennec::sqrt(fennec::genType) /// ///
-/// \ref fennec::inversesqrt(fennec::genType) "genFType inversesqrt(genFType)" +/// \ref fennec::inversesqrt(fennec::genType) "genFType inversesqrt(genFType x)" /// /// \copydoc fennec::inversesqrt(fennec::genType) /// diff --git a/include/fennec/math/geometric.h b/include/fennec/math/geometric.h index 90c0ca6..1f6060c 100644 --- a/include/fennec/math/geometric.h +++ b/include/fennec/math/geometric.h @@ -18,7 +18,7 @@ /// /// \file geometric.h -/// \brief \ref page_fennec_math_geometric +/// \brief \ref fennec_math_geometric /// /// /// \details @@ -39,7 +39,7 @@ /// /// /// -/// \page page_fennec_math_geometric Geometric +/// \page fennec_math_geometric Geometric /// /// \brief The Geometric Functions defined in the [OpenGL 4.6 Shading Language Specification](https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.60.pdf). /// @@ -51,58 +51,58 @@ /// Description /// ///
-/// \ref fennec::dot(const genFType&, const genFType&) "float dot(genFType x, genFType y)"
-/// \ref fennec::dot(const genDType&, const genDType&) "double dot(genDType x, genDType x)" +/// \ref fennec::dot "float dot(genFType x, genFType y)"
+/// \ref fennec::dot "double dot(genDType x, genDType x)" /// -/// \copydoc fennec::dot(const genFType&, const genFType&) +/// \copydoc fennec::dot /// ///
-/// \ref fennec::length2(const genFType&) "float length2(genFType x)"
-/// \ref fennec::length2(const genDType&) "double length2(genDType x)" +/// \ref fennec::length2 "float length2(genFType x)"
+/// \ref fennec::length2 "double length2(genDType x)" /// -/// \copydoc fennec::length2(const genFType&) +/// \copydoc fennec::length2 /// ///
-/// \ref fennec::length(const genFType&) "float length(genFType x)"
-/// \ref fennec::length(const genDType&) "double length(genDType x)" +/// \ref fennec::length "float length(genFType x)"
+/// \ref fennec::length "double length(genDType x)" /// -/// \copydoc fennec::length(const genFType&) +/// \copydoc fennec::length /// ///
-/// \ref fennec::distance(const genFType&, const genFType&) "float distance(genFType x, genFType y)"
-/// \ref fennec::distance(const genDType&, const genDType&) "double distance(genDType x, genDType x)" +/// \ref fennec::distance "float distance(genFType x, genFType y)"
+/// \ref fennec::distance "double distance(genDType x, genDType x)" /// -/// \copydoc fennec::distance(const genFType&, const genFType&) +/// \copydoc fennec::distance /// ///
-/// \ref fennec::normalize(const genFType&) "float normalize(genFType x)"
-/// \ref fennec::normalize(const genDType&) "double normalize(genDType x)" +/// \ref fennec::normalize "float normalize(genFType x)"
+/// \ref fennec::normalize "double normalize(genDType x)" /// -/// \copydoc fennec::normalize(const genFType&) +/// \copydoc fennec::normalize /// ///
-/// \ref fennec::cross(const fennec::vec3&, const fennec::vec3&) "vec3 cross(vec3 x, vec3 y)"
-/// \ref fennec::cross(const fennec::dvec3&, const fennec::dvec3&) "dvec3 cross(dvec3 x, dvec3 x)" +/// \ref fennec::cross "vec3 cross(vec3 x, vec3 y)"
+/// \ref fennec::cross "dvec3 cross(dvec3 x, dvec3 x)" /// -/// \copydoc fennec::cross(const fennec::vec3&, const fennec::vec3&) +/// \copydoc fennec::cross /// ///
-/// \ref fennec::faceforward(const genFType&, const genFType&, const genFType&) "genFType faceforward(genFType N, genFType I, genFType Nref)"
-/// \ref fennec::faceforward(const genDType&, const genDType&, const genDType&) "genDType faceforward(genDType N, genDType I, genDType Nref)" +/// \ref fennec::faceforward "genFType faceforward(genFType N, genFType I, genFType Nref)"
+/// \ref fennec::faceforward "genDType faceforward(genDType N, genDType I, genDType Nref)" /// -/// \copydoc fennec::faceforward(const genFType&, const genFType&, const genFType&) +/// \copydoc fennec::faceforward /// ///
-/// \ref fennec::reflect(const genFType&, const genFType&) "genFType reflect(genFType I, genFType N)"
-/// \ref fennec::reflect(const genDType&, const genDType&) "genDType reflect(genDType I, genDType N)" +/// \ref fennec::reflect "genFType reflect(genFType I, genFType N)"
+/// \ref fennec::reflect "genDType reflect(genDType I, genDType N)" /// -/// \copydoc fennec::reflect(const genFType&, const genFType&) +/// \copydoc fennec::reflect /// ///
-/// \ref fennec::refract(const genFType&, const genFType&, float) "genFType refract(genFType N, genFType I, float eta)"
-/// \ref fennec::refract(const genDType&, const genDType&, double) "genDType refract(genDType N, genDType I, double eta)" +/// \ref fennec::refract "genFType refract(genFType N, genFType I, float eta)"
+/// \ref fennec::refract "genDType refract(genDType N, genDType I, double eta)" /// -/// \copydoc fennec::refract(const genFType&, const genFType&, float) +/// \copydoc fennec::refract /// /// /// @@ -115,7 +115,6 @@ namespace fennec // dot ----------------------------------------------------------------------------------------------------------------- -/// /// /// \brief Returns the dot product of \f$x\f$ and \f$y\f$, i.e., \f$x_0 \cdot y_0 + x_0 \cdot y_0 + \ldots\f$ /// @@ -135,7 +134,6 @@ constexpr genType dot(const vector& x, const vector& x) // length -------------------------------------------------------------------------------------------------------------- -/// /// /// \brief Returns the length of vector \f$x\f$, i.e., \f$\sqrt{x_0^2 + x_1^2 + \ldots}\f$ /// @@ -170,7 +167,6 @@ constexpr genType length(const vector& x) { return fennec::sqrt(f // distance ------------------------------------------------------------------------------------------------------------ -/// /// /// \brief Returns the length of vector \f$x\f$, i.e., \f$\sqrt{x_0^2 + x_1^2 + \ldots}\f$ /// @@ -190,7 +186,6 @@ constexpr genType distance(const vector& p0, const vector cross(const vector& x, const vect // normalize ----------------------------------------------------------------------------------------------------------- -/// /// /// \brief Returns a vector in the same direction as \f$x\f$, but with a length of \f$1\f$, i.e. /// -/// \returns a vector in the same direction as \f$x\f$, but with a length of \f$1\f$, i.e.\f$\frac{x}{||x||}

+/// \returns a vector in the same direction as \f$x\f$, but with a length of \f$1\f$, i.e.\f$\frac{x}{||x||}\f$

/// \details we can represent this in linear algebra as the following,

/// let \f$X=\left[\begin{array}\\ x_0 \\ x_1 \\ \vdots \\ x_N \end{array}\right]\f$

/// @@ -230,7 +224,6 @@ constexpr vector normalize(const vector& x) // faceforward --------------------------------------------------------------------------------------------------------- -/// /// /// \brief If \f$\text{dot}(Nref, I)<0\f$ return \f$N\f$, otherwise return \f$-N\f$. /// @@ -246,7 +239,6 @@ constexpr vector faceforward(const vector& N, cons // reflect ------------------------------------------------------------------------------------------------------------- -/// /// /// \brief For the incident vector \f$I\f$ and surface orientation \f$N\f$, returns the reflection direction. /// @@ -263,8 +255,7 @@ constexpr vector reflect(const vector& I, const ve // refract ------------------------------------------------------------------------------------------------------------- /// -/// -/// \brief or the incident vector \f$I\f$ and surface normal \f$N\f$, and the ratio of indices of refraction \f$eta\f$, +/// \brief For the incident vector \f$I\f$ and surface normal \f$N\f$, and the ratio of indices of refraction \f$eta\f$, /// return the refraction vector. /// /// \returns The refraction vector, given the incident vector \f$I\f$, surface normal \f$N\f$, and ratio \f$eta\f$.

@@ -279,7 +270,8 @@ template constexpr vector refract(const vector& I, const vector& N, genType eta) { genType ndi = fennec::dot(N, I); genType k = 1.0 - eta * eta * (1.0 - ndi * ndi); - return (k < 0.0) ? 0.0 : eta * I - N * (eta * ndi + fennec::sqrt(k)); } + return fennec::max(0.0, eta * I - N * (eta * ndi + fennec::sqrt(k))); } + } #endif // FENNEC_MATH_GEOMETRIC_H diff --git a/include/fennec/math/math.h b/include/fennec/math/math.h index 7634593..c01c592 100644 --- a/include/fennec/math/math.h +++ b/include/fennec/math/math.h @@ -21,10 +21,10 @@ /// \brief main math header which includes the main modules /// /// -/// \details This header includes the following modules of \ref page_fennec_math : -/// - \ref page_fennec_math_scalar -/// - \ref page_fennec_math_vector -/// - \ref page_fennec_math_trigonometric +/// \details This header includes the following modules of \ref fennec_math : +/// - \ref fennec_math_scalar +/// - \ref fennec_math_vector +/// - \ref fennec_math_trigonometric /// /// \author Medusa Slockbower /// @@ -39,27 +39,29 @@ /// /// /// -/// \page page_fennec_math Math Library +/// \page fennec_math Math Library /// /// The \ref fennec Math Library is composed of the modules listed in below. /// The overarching goal of this math library is to implement the math types and functions of the /// [OpenGL 4.6 Shading Language Specification](https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.60.pdf). /// -/// \section page_fennec_math_topics Topics -/// - \subpage page_fennec_math_set_theory +/// \section fennec_math_topics Topics +/// - \subpage fennec_math_set_theory /// -/// \section page_fennec_math_data_types Data Types +/// \section fennec_math_data_types Data Types /// -/// - \subpage page_fennec_math_scalar -/// - \subpage page_fennec_math_vector -/// - \subpage page_fennec_math_matrix +/// - \subpage fennec_math_scalar +/// - \subpage fennec_math_vector +/// - \subpage fennec_math_matrix /// -/// \section page_fennec_math_functions Functions +/// \section fennec_math_functions Functions +/// +/// - \subpage fennec_math_common +/// - \subpage fennec_math_exponential +/// - \subpage fennec_math_geometric +/// - \subpage fennec_math_relational +/// - \subpage fennec_math_trigonometric /// -/// - \subpage page_fennec_math_common -/// - \subpage page_fennec_math_exponential -/// - \subpage page_fennec_math_geometric -/// - \subpage page_fennec_math_trigonometric /// /// @@ -68,13 +70,13 @@ /// /// /// -/// \page page_fennec_math_set_theory Set Theory +/// \page fennec_math_set_theory Set Theory /// /// Binary Mathematics, like most branches of Mathematics, is built, foundationally, upon Set Theory. Set Theory is /// the branch of Mathematics that studies Sets. Sets contain a collection of elements which may be numbers, or other /// mathematical values and structures. /// -/// Set definitions for all mathematical structures in the \ref page_fennec_math "Fennec Math Library" are present in +/// Set definitions for all mathematical structures in the \ref fennec_math "Fennec Math Library" are present in /// their respective pages. /// /// diff --git a/include/fennec/math/matrix.h b/include/fennec/math/matrix.h index 0040bbd..1cd106a 100644 --- a/include/fennec/math/matrix.h +++ b/include/fennec/math/matrix.h @@ -18,7 +18,7 @@ /// /// \file matrix.h -/// \brief the \ref page_fennec_math_matrix +/// \brief the \ref fennec_math_matrix /// /// /// \details @@ -31,7 +31,7 @@ /// /// /// -/// \page page_fennec_math_matrix Matrices +/// \page fennec_math_matrix Matrices /// /// /// @@ -357,7 +357,10 @@ private: template constexpr void __construct(HeadT&& head, ArgsT&&...args) - { matrix::__insert(head); matrix::__construct>(std::forward(args)...); } + { + matrix::__insert(head); + matrix::__construct>(std::forward(args)...); + } template constexpr void __insert(scalar_t s) diff --git a/include/fennec/math/relational.h b/include/fennec/math/relational.h index 3405f0d..e4909ba 100644 --- a/include/fennec/math/relational.h +++ b/include/fennec/math/relational.h @@ -18,7 +18,7 @@ /// /// \file relational.h -/// \brief \ref page_fennec_math_relational +/// \brief \ref fennec_math_relational /// /// /// \details @@ -33,67 +33,181 @@ #include +/// +/// \page fennec_math_relational Relational +/// +/// \brief The Relational Functions defined in the [OpenGL 4.6 Shading Language Specification](https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.60.pdf). +/// +/// +///
Syntax +/// Description +/// +///

+/// \ref fennec::lessThan "bvec lessThan(vec x, vec y)"
+/// \ref fennec::lessThan "bvec lessThan(dvec x, dvec y)"
+/// \ref fennec::lessThan "bvec lessThan(ivec x, ivec y)"
+/// \ref fennec::lessThan "bvec lessThan(uvec x, uvec y)" +///
+/// \copydoc fennec::lessThan +/// +///

+/// \ref fennec::lessThanEqual "bvec lessThanEqual(vec x, vec y)"
+/// \ref fennec::lessThanEqual "bvec lessThanEqual(dvec x, dvec y)"
+/// \ref fennec::lessThanEqual "bvec lessThanEqual(ivec x, ivec y)"
+/// \ref fennec::lessThanEqual "bvec lessThanEqual(uvec x, uvec y)" +///
+/// \copydoc fennec::lessThanEqual +/// +///

+/// \ref fennec::greaterThan "bvec greaterThan(vec x, vec y)"
+/// \ref fennec::greaterThan "bvec greaterThan(dvec x, dvec y)"
+/// \ref fennec::greaterThan "bvec greaterThan(ivec x, ivec y)"
+/// \ref fennec::greaterThan "bvec greaterThan(uvec x, uvec y)" +///
+/// \copydoc fennec::greaterThan +/// +///

+/// \ref fennec::greaterThanEqual "bvec greaterThanEqual(vec x, vec y)"
+/// \ref fennec::greaterThanEqual "bvec greaterThanEqual(dvec x, dvec y)"
+/// \ref fennec::greaterThanEqual "bvec greaterThanEqual(ivec x, ivec y)"
+/// \ref fennec::greaterThanEqual "bvec greaterThanEqual(uvec x, uvec y)" +///
+/// \copydoc fennec::greaterThanEqual +/// +///

+/// \ref fennec::equal "bvec equal(vec x, vec y)"
+/// \ref fennec::equal "bvec equal(dvec x, dvec y)"
+/// \ref fennec::equal "bvec equal(ivec x, ivec y)"
+/// \ref fennec::equal "bvec equal(uvec x, uvec y)" +///
+/// \copydoc fennec::equal +/// +///

+/// \ref fennec::notEqual "bvec notEqual(vec x, vec y)"
+/// \ref fennec::notEqual "bvec notEqual(dvec x, dvec y)"
+/// \ref fennec::notEqual "bvec notEqual(ivec x, ivec y)"
+/// \ref fennec::notEqual "bvec notEqual(uvec x, uvec y)" +///
+/// \copydoc fennec::notEqual +/// +///

+/// \ref fennec::any "bool any(bvec x)"
+///
+/// \copydoc fennec::any +/// +///

+/// \ref fennec::all "bool all(bvec x)"
+///
+/// \copydoc fennec::all +/// +///

+/// \ref fennec::operator! "bool not(bvec x)"
+///
+/// \copydoc fennec::operator! +///
+/// +/// +/// + // TODO: Document namespace fennec { -template -constexpr genBType lessThan(genType x, genType y) - { return x < y; } - +/// +/// \brief Returns the component-wise compare of x < y. +/// +/// \returns the component-wise compare of x < y. +/// \param x lhs of the expression +/// \param y rhs of the expression template constexpr vector lessThan(const vector& x, const vector& y) { return vector(x[i] < y[i]...); } -template -constexpr genBType lessThanEqual(genType x, genType y) - { return x <= y; } +/// +/// \brief Returns the component-wise compare of x <= y. +/// +/// \returns the component-wise compare of x <= y. +/// \param x lhs of the expression +/// \param y rhs of the expression template constexpr vector lessThanEqual(const vector& x, const vector& y) { return vector(x[i] <= y[i]...); } -template -constexpr genBType greaterThan(genType x, genType y) - { return x > y; } +/// +/// \brief Returns the component-wise compare of x > y. +/// +/// \returns the component-wise compare of x > y. +/// \param x lhs of the expression +/// \param y rhs of the expression template constexpr vector greaterThan(const vector& x, const vector& y) { return vector(x[i] > y[i]...); } -template -constexpr genBType greaterThanEqual(genType x, genType y) - { return x >= y; } +/// +/// \brief Returns the component-wise compare of x >= y. +/// +/// \returns the component-wise compare of x >= y. +/// \param x lhs of the expression +/// \param y rhs of the expression template constexpr vector greaterThanEqual(const vector& x, const vector& y) { return vector(x[i] >= y[i]...); } -template -constexpr genBType equal(genType x, genType y) - { return x == y; } +/// +/// \brief Returns the component-wise compare of x == y. +/// +/// \returns the component-wise compare of x == y. +/// \param x lhs of the expression +/// \param y rhs of the expression template constexpr vector equal(const vector& x, const vector& y) { return vector(x[i] == y[i]...); } -template -constexpr genBType notEqual(genType x, genType y) - { return x != y; } +/// +/// \brief Returns the component-wise compare of x != y. +/// +/// \returns the component-wise compare of x != y. +/// \param x lhs of the expression +/// \param y rhs of the expression template constexpr vector notEqual(const vector& x, const vector& y) { return vector(x[i] != y[i]...); } + +/// +/// \brief Returns \f$true\f$ if any component of \f$x\f$ is \f$true\f$ +/// +/// \returns \f$true\f$ if any component of \f$x\f$ is \f$true\f$ +/// \param x the boolean vector to test template constexpr genBType any(const vector& x) { return (x[i] || ...); } +/// +/// \brief Returns \f$true\f$ if all components of \f$x\f$ are \f$true\f$ +/// +/// \returns \f$true\f$ if all components of \f$x\f$ are \f$true\f$ +/// \param x the boolean vector to test template constexpr genBType all(const vector& x) { return (x[i] && ...); } +/// +/// \brief Returns the component-wise logical complement of \f$x\f$. +/// +/// \details +/// \returns the component-wise logical complement of \f$x\f$. +/// \param x the boolean vector to inverse +template +constexpr genBType operator!(const vector& x) + { return vector((!x[i]) ...); } + } diff --git a/include/fennec/math/scalar.h b/include/fennec/math/scalar.h index 373ac10..af36966 100644 --- a/include/fennec/math/scalar.h +++ b/include/fennec/math/scalar.h @@ -18,7 +18,7 @@ /// /// \file scalar.h -/// \brief the \ref page_fennec_math_scalar +/// \brief the \ref fennec_math_scalar /// /// /// \details @@ -36,7 +36,7 @@ /// /// /// -/// \page page_fennec_math_scalar Scalars +/// \page fennec_math_scalar Scalars /// \anchor scalar /// /// The \ref fennec Library considers any type that passes ```is_arithmetic``` to be a \ref scalar "Scalar." Bools are @@ -44,13 +44,13 @@ /// /// The GLSL Specification, and \ref fennec respectively, defines the following scalar types: /// -/// | Type | Meaning | -/// |----------|------------------------------| -/// |\c bool | \copybrief fennec::bool_t | -/// |\c int | \copybrief fennec::int_t | -/// |\c uint | \copybrief fennec::uint_t | -/// |\c float | \copybrief fennec::float_t | -/// |\c double | \copybrief fennec::double_t | +/// | Type | Corresponding Type | Meaning | +/// |----------|-----------------------|------------------------------| +/// |\c bool | \ref fennec::bool_t | \copybrief fennec::bool_t | +/// |\c int | \ref fennec::int_t | \copybrief fennec::int_t | +/// |\c uint | \ref fennec::uint_t | \copybrief fennec::uint_t | +/// |\c float | \ref fennec::float_t | \copybrief fennec::float_t | +/// |\c double | \ref fennec::double_t | \copybrief fennec::double_t | /// /// /// diff --git a/include/fennec/math/swizzle.h b/include/fennec/math/swizzle.h index 6b6d0b2..d5dee7f 100644 --- a/include/fennec/math/swizzle.h +++ b/include/fennec/math/swizzle.h @@ -18,7 +18,7 @@ /// /// \file swizzle.h -/// \brief part of the \ref page_fennec_math_vector, +/// \brief part of the \ref fennec_math_vector, /// /// /// \details diff --git a/include/fennec/math/trigonometric.h b/include/fennec/math/trigonometric.h index eb6f706..350a3d5 100644 --- a/include/fennec/math/trigonometric.h +++ b/include/fennec/math/trigonometric.h @@ -18,7 +18,7 @@ /// /// \file trigonometric.h -/// \brief the \ref page_fennec_math_trigonometric +/// \brief the \ref fennec_math_trigonometric /// /// /// \details @@ -34,7 +34,7 @@ /// /// /// -/// \page page_fennec_math_trigonometric Trigonometry +/// \page fennec_math_trigonometric Trigonometry /// /// \brief The fennec Trigonometry Module /// @@ -47,96 +47,96 @@ /// Description /// ///
-/// \ref fennec::degrees(genType) "genFType degrees(genFType)" +/// \ref fennec::degrees "genFType degrees(genFType x)" /// -/// \copydoc fennec::degrees(fennec::genType) +/// \copydoc fennec::degrees /// ///
-/// \ref fennec::radians(genType) "genFType radians(genFType)" +/// \ref fennec::radians "genFType radians(genFType x)" /// -/// \copydoc fennec::radians(fennec::genType) +/// \copydoc fennec::radians /// /// /// /// /// -/// \section section_fennec_trigonometric_functions Trigonometry +/// \section section_fennec_trigonometric_functions Trigonometric Functions /// /// ///
Syntax /// Description /// ///

-/// \ref fennec::sin(genType) "genFType sin(genFType)" +/// \ref fennec::sin "genFType sin(genFType x)" ///
-/// \copydoc fennec::sin(fennec::genType) +/// \copydoc fennec::sin /// ///

-/// \ref fennec::cos(genType) "genFType cos(genFType)" +/// \ref fennec::cos "genFType cos(genFType x)" ///
-/// \copydoc fennec::cos(fennec::genType) +/// \copydoc fennec::cos /// ///

-/// \ref fennec::tan(genType) "genFType tan(genFType)" +/// \ref fennec::tan "genFType tan(genFType x)" ///
-/// \copydoc fennec::tan(fennec::genType) +/// \copydoc fennec::tan /// /// ///

-/// \ref fennec::asin(genType) "genFType asin(genFType)" +/// \ref fennec::asin "genFType asin(genFType x)" ///
-/// \copydoc fennec::asin(fennec::genType) +/// \copydoc fennec::asin /// ///

-/// \ref fennec::acos(genType) "genFType acos(genFType)" +/// \ref fennec::acos "genFType acos(genFType x)" ///
-/// \copydoc fennec::acos(fennec::genType) +/// \copydoc fennec::acos /// ///

-/// \ref fennec::atan(genType) "genFType atan(genFType)" +/// \ref fennec::atan "genFType atan(genFType x)" ///
-/// \copydoc fennec::atan(fennec::genType) +/// \copydoc fennec::atan /// ///
/// /// /// -/// \section section_fennec_hyperbolic_functions Trigonometry +/// \section section_fennec_hyperbolic_functions Hyperbolic Functions /// /// ///
Syntax /// Description /// ///

-/// \ref fennec::sinh(genType) "genFType sinh(genFType)" +/// \ref fennec::sinh "genFType sinh(genFType x)" ///
-/// \copydoc fennec::sinh(fennec::genType) +/// \copydoc fennec::sinh /// ///

-/// \ref fennec::cosh(genType) "genFType cosh(genFType)" +/// \ref fennec::cosh "genFType cosh(genFType x)" ///
-/// \copydoc fennec::cosh(fennec::genType) +/// \copydoc fennec::cosh /// ///

-/// \ref fennec::tanh(genType) "genFType tanh(genFType)" +/// \ref fennec::tanh "genFType tanh(genFType x)" ///
-/// \copydoc fennec::tanh(fennec::genType) +/// \copydoc fennec::tanh /// /// ///

-/// \ref fennec::asinh(genFType) "genFType asinh(genFType)" +/// \ref fennec::asinh "genFType asinh(genFType x)" ///
-/// \copydoc fennec::asinh(fennec::genType) +/// \copydoc fennec::asinh /// ///

-/// \ref fennec::acosh(genFType) "genFType acosh(genFType)" +/// \ref fennec::acosh "genFType acosh(genFType x)" ///
-/// \copydoc fennec::acosh(fennec::genType) +/// \copydoc fennec::acosh /// ///

-/// \ref fennec::atanh(genFType) "genFType atanh(genFType)" +/// \ref fennec::atanh "genFType atanh(genFType x)" ///
-/// \copydoc fennec::atanh(fennec::genType) +/// \copydoc fennec::atanh /// ///
/// @@ -198,7 +198,6 @@ constexpr vector degrees(const vector& radians) /// @{ /// -/// \fn fennec::sin(fennec::genType) /// \brief The standard trigonometric sine /// /// \returns the sine of \f$\theta\f$ in the range \f$\left[-1,\,1\right]\f$

@@ -216,7 +215,6 @@ constexpr vector sin(const vector& x) /// -/// \fn fennec::cos(fennec::genType) /// \brief The Standard Trigonometric Cosine /// /// \returns the cosine of \f$\theta\f$ in the range \f$\left[-1,\,1\right]\f$

@@ -234,7 +232,6 @@ constexpr vector cos(const vector& x) /// -/// \fn fennec::tan(fennec::genType) /// \brief The Standard Trigonometric Tangent /// /// \returns The Tangent of \f$\theta\f$ in the Range \f$\left[-\inf,\,\inf\right]\f$

@@ -258,7 +255,6 @@ constexpr vector tan(const vector& x) /// @{ /// -/// \fn fennec::asin(fennec::genType) /// \brief Arc Sine. Returns an angle \f$\theta\f$ whose sine is /a x. /// /// \returns an angle \f$\theta\f$ whose sine is /a x.

@@ -277,7 +273,6 @@ constexpr vector asin(const vector& x) /// -/// \fn fennec::acos(fennec::genType) /// \brief Arc Cosine. Returns an angle \f$\theta\f$ whose cosine is /a x. /// /// \returns an angle \f$\theta\f$ whose cosine is /a x. @@ -296,7 +291,6 @@ constexpr vector acos(const vector& x) /// -/// \fn fennec::atan(fennec::genType) /// \brief Arc Tangent. Returns an angle \f$\theta\f$ whose tangent is /a y_over_x. /// /// \returns an angle \f$\theta\f$ whose tangent is /a y_over_x. @@ -315,7 +309,6 @@ constexpr vector atan(const vector& y_over_x) /// -/// \fn fennec::tan(fennec::genType, fennec::genType) /// \brief Arc Tangent. Returns an angle whose tangent is \f$\frac{y}{x}\f$. /// /// \returns an angle whose tangent is \f$\frac{y}{x}\f$.

@@ -342,7 +335,6 @@ constexpr vector atan(const vector& y, const vecto /// @{ /// -/// \fn fennec::sinh(fennec::genType) /// \brief Returns the Hyperbolic Sine Function, \f$\frac{{e}^{x}-{e}^{-x}}{2}\f$ /// /// \returns The Hyperbolic Sine of \f$x\f$, \f$\frac{{e}^{x}-{e}^{-x}}{2}\f$

@@ -359,7 +351,6 @@ constexpr vector sinh(const vector& x) /// -/// \fn fennec::cosh(fennec::genType) /// \brief Returns the Hyperbolic Cosine Function, \f$\frac{{e}^{x}+{e}^{-x}}{2}\f$ /// /// \returns The Hyperbolic Cosine of \f$x\f$, \f$\frac{{e}^{x}+{e}^{-x}}{2}\f$

@@ -375,7 +366,6 @@ constexpr vector cosh(const vector& x) /// -/// \fn fennec::tanh(fennec::genType) /// \brief Returns the Hyperbolic Tangent Function, \f$\frac{\text{sinh}(x)}{\text{cosh}(x)}\f$ /// /// \returns The Hyperbolic Tangent of \f$x\f$, \f$\frac{{e}^{x}+{e}^{-x}}{2}\f$

@@ -396,7 +386,6 @@ constexpr vector tanh(const vector& x) /// @{ /// -/// \fn fennec::asinh(fennec::genType) /// \brief The Inverse Hyperbolic Sine Function /// /// \returns the value \f$y\f$ that fulfills \f$x=\text{sinh}(y)\f$

@@ -413,7 +402,6 @@ constexpr vector asinh(const vector& x) /// -/// \fn fennec::cosh(fennec::genType) /// \brief The Inverse Hyperbolic Cosine Function /// /// \returns the value \f$y\f$ that fulfills \f$x=\text{cosh}(y)\f$

@@ -430,7 +418,6 @@ constexpr vector acosh(const vector& x) /// -/// \fn fennec::atan(fennec::genType) /// \brief The Inverse Hyperbolic Tangent Function /// /// \returns the value \f$y\f$ that fulfills \f$x=\text{atanh}(y)\f$

@@ -444,6 +431,7 @@ constexpr genType atanh(genType x) template constexpr vector atanh(const vector& x) { return vector(fennec::atanh(x[i]) ...); } + /// @} diff --git a/include/fennec/math/vector.h b/include/fennec/math/vector.h index e83e6b0..0b8f3fe 100644 --- a/include/fennec/math/vector.h +++ b/include/fennec/math/vector.h @@ -18,7 +18,7 @@ /// /// \file vector.h -/// \brief the \ref page_fennec_math_vector +/// \brief the \ref fennec_math_vector /// /// /// \details @@ -34,7 +34,7 @@ /// /// /// -/// \page page_fennec_math_vector Vectors +/// \page fennec_math_vector Vectors /// /// \brief The fennec Vector Math Module /// @@ -43,27 +43,27 @@ /// /// /// -///
Type Brief -///
Floats -///
```vec2``` \copybrief fennec::vec2 -///
```vec3``` \copybrief fennec::vec3 -///
```vec4``` \copybrief fennec::vec4 -///
Doubles -///
```dvec2```\copybrief fennec::dvec2 -///
```dvec3```\copybrief fennec::dvec3 -///
```dvec4```\copybrief fennec::dvec4 -///
Booleans -///
```bvec2```\copybrief fennec::bvec2 -///
```bvec3```\copybrief fennec::bvec3 -///
```bvec4```\copybrief fennec::bvec4 -///
Integers -///
```ivec2```\copybrief fennec::ivec2 -///
```ivec3```\copybrief fennec::ivec3 -///
```ivec4```\copybrief fennec::ivec4 -///
Unsigned Integers -///
```uvec2```\copybrief fennec::uvec2 -///
```uvec3```\copybrief fennec::uvec3 -///
```uvec4```\copybrief fennec::uvec4 +///
Type Corresponding Type Brief +///
Floats +///
```vec2``` \ref fennec::vec2 \copybrief fennec::vec2 +///
```vec3``` \ref fennec::vec3 \copybrief fennec::vec3 +///
```vec4``` \ref fennec::vec4 \copybrief fennec::vec4 +///
Doubles +///
```dvec2```\ref fennec::dvec2 \copybrief fennec::dvec2 +///
```dvec3```\ref fennec::dvec3 \copybrief fennec::dvec3 +///
```dvec4```\ref fennec::dvec4 \copybrief fennec::dvec4 +///
Booleans +///
```bvec2``` \ref fennec::bvec2 \copybrief fennec::bvec2 +///
```bvec3``` \ref fennec::bvec3 \copybrief fennec::bvec3 +///
```bvec4``` \ref fennec::bvec4 \copybrief fennec::bvec4 +///
Integers +///
```ivec2``` \ref fennec::ivec2 \copybrief fennec::ivec2 +///
```ivec3``` \ref fennec::ivec3 \copybrief fennec::ivec3 +///
```ivec4``` \ref fennec::ivec4 \copybrief fennec::ivec4 +///
Unsigned Integers +///
```uvec2``` \ref fennec::uvec2 \copybrief fennec::uvec2 +///
```uvec3``` \ref fennec::uvec3 \copybrief fennec::uvec3 +///
```uvec4``` \ref fennec::uvec4 \copybrief fennec::uvec4 ///
/// /// @@ -89,7 +89,7 @@ /// /// \section vector_swizzling Swizzling /// -/// The fennec \ref page_fennec_math_vector allows for the "swizzling" of vectors. Each component in the vector can be +/// The fennec \ref fennec_math_vector allows for the "swizzling" of vectors. Each component in the vector can be /// used in any combination, with up to 4 components, to create another vector. For example,

/// /// let \f$V = (0, 1, 2)\f$ @@ -113,9 +113,7 @@ namespace fennec /// -/// \typedef vec -/// \anchor vec -/// \brief Main \ref fennec::vector "vector" template +/// \brief Main \ref fennec_math_vector "vector" template /// \tparam ScalarT The type of the Components /// \tparam SizeV The number of Components template using vec = decltype(detail::__gen_vector(make_index_sequence{})); @@ -123,122 +121,92 @@ template using vec = decltype(detail::__gen_vect /// -/// \typedef tvec2 -/// \anchor tvec2 -/// \brief Shorthand for ```vec``` +/// \brief Shorthand for creating a 2-element \ref fennec::vector, ```vec``` +/// \details Shorthand for creating a 2-element \ref fennec::vector, ```vec``` /// \tparam ScalarT The type of the Components template using tvec2 = vec; /// -/// \typedef tvec3 -/// \anchor tvec3 -/// \brief Shorthand for ```vec``` +/// \brief Shorthand for creating a 3-element \ref fennec::vector, ```vec``` +/// \details Shorthand for creating a 3-element \ref fennec::vector, ```vec``` /// \tparam ScalarT The type of the Components template using tvec3 = vec; /// -/// \typedef tvec4 -/// \anchor tvec4 -/// \brief Shorthand for ```vec``` +/// \brief Shorthand for creating a 4-element \ref fennec::vector, ```vec``` +/// \details Shorthand for creating a 4-element \ref fennec::vector, ```vec``` /// \tparam ScalarT The type of the Components template using tvec4 = vec; /// -/// \typedef bvec2 -/// \anchor bvec2 -/// \brief A two-component boolean \ref fennec::vector "vector" +/// \brief A two-component boolean \ref fennec_math_vector "vector" using bvec2 = tvec2; /// -/// \typedef bvec3 -/// \anchor bvec3 -/// \brief A three-component boolean \ref fennec::vector "vector" +/// \brief A three-component boolean \ref fennec_math_vector "vector" using bvec3 = tvec3; /// -/// \typedef bvec4 -/// \anchor bvec4 -/// \brief A four-component boolean \ref fennec::vector "vector" +/// \brief A four-component boolean \ref fennec_math_vector "vector" using bvec4 = tvec4; /// -/// \typedef ivec2 -/// \anchor ivec2 -/// \brief A two-component signed integer \ref fennec::vector "vector" +/// \brief A two-component signed integer \ref fennec_math_vector "vector" using ivec2 = tvec2; -/// \typedef ivec3 -/// \anchor ivec3 -/// \brief A three-component signed integer \ref fennec::vector "vector" +/// +/// \brief A three-component signed integer \ref fennec_math_vector "vector" using ivec3 = tvec3; /// \typedef ivec4 /// \anchor ivec4 -/// \brief A four-component signed integer \ref fennec::vector "vector" +/// \brief A four-component signed integer \ref fennec_math_vector "vector" using ivec4 = tvec4; /// -/// \typedef uvec2 -/// \anchor uvec2 -/// \brief A two-component unsigned integer \ref fennec::vector "vector" +/// \brief A two-component unsigned integer \ref fennec_math_vector "vector" using uvec2 = tvec2; /// -/// \typedef uvec3 -/// \anchor uvec3 -/// \brief A three-component unsigned integer \ref fennec::vector "vector" +/// \brief A three-component unsigned integer \ref fennec_math_vector "vector" using uvec3 = tvec3; /// -/// \typedef uvec4 -/// \anchor uvec4 -/// \brief A four-component unsigned integer \ref fennec::vector "vector" +/// \brief A four-component unsigned integer \ref fennec_math_vector "vector" using uvec4 = tvec4; /// -/// \typedef vec2 -/// \anchor vec2 -/// \brief A two-component single-precision floating-point \ref fennec::vector "vector" +/// \brief A two-component single-precision floating-point \ref fennec_math_vector "vector" using vec2 = tvec2; /// -/// \typedef vec3 -/// \anchor vec3 -/// \brief A three-component single-precision floating-point \ref fennec::vector "vector" +/// \brief A three-component single-precision floating-point \ref fennec_math_vector "vector" using vec3 = tvec3; /// -/// \typedef vec4 -/// \anchor vec4 -/// \brief A four-component single-precision floating-point \ref fennec::vector "vector" +/// \brief A four-component single-precision floating-point \ref fennec_math_vector "vector" using vec4 = tvec4; /// -/// \typedef dvec2 -/// \anchor dvec2 -/// \brief A two-component double-precision floating-point \ref fennec::vector "vector" +/// \brief A two-component double-precision floating-point \ref fennec_math_vector "vector" using dvec2 = tvec2; /// -/// \typedef dvec3 -/// \anchor dvec3 -/// \brief A three-component double-precision floating-point \ref fennec::vector "vector" +/// \brief A three-component double-precision floating-point \ref fennec_math_vector "vector" using dvec3 = tvec3; /// -/// \typedef dvec4 -/// \anchor dvec4 -/// \brief A four-component double-precision floating-point \ref fennec::vector "vector" +/// \brief A four-component double-precision floating-point \ref fennec_math_vector "vector" using dvec4 = tvec4; @@ -288,7 +256,7 @@ struct vector : detail::vector_base_type static constexpr size_t size = sizeof...(IndicesV); ///< \brief size of the swizzle static constexpr size_t N = sizeof...(IndicesV); ///< \brief size of the swizzle - using decay_t = conditional_t; ///< Type that the \ref fennec::vector "vector" should Decay into + using decay_t = conditional_t; ///< Type that the \ref fennec_math_vector "vector" should Decay into /// @} @@ -355,8 +323,8 @@ struct vector : detail::vector_base_type /// \brief vector scalar conversion constructor /// /// \details - /// \tparam OScalarT scalar Type of the \ref fennec::vector "vector" to Convert - /// \param v \ref fennec::vector "vector" to Convert + /// \tparam OScalarT scalar Type of the \ref fennec_math_vector "vector" to Convert + /// \param v \ref fennec_math_vector "vector" to Convert template explicit constexpr vector(const vector& v) { ((data[IndicesV] = ScalarT(v[IndicesV])), ...); } @@ -366,7 +334,7 @@ struct vector : detail::vector_base_type /// \brief vector conversion constructor /// /// \details - /// \tparam OScalarT scalar Type of the \ref fennec::vector "vector" to Convert + /// \tparam OScalarT scalar Type of the \ref fennec_math_vector "vector" to Convert /// \tparam MoreIndicesStartV /// \tparam MoreIndicesV /// \param v @@ -410,7 +378,7 @@ struct vector : detail::vector_base_type /// \brief decay implementation /// /// \details - /// \returns scalar if \f$N==1\f$, otherwise, \ref fennec::vector "vector" + /// \returns scalar if \f$N==1\f$, otherwise, \ref fennec_math_vector "vector" decay_t decay() { return static_cast(*this); } @@ -493,54 +461,54 @@ struct vector : detail::vector_base_type // Scalar-Vector Arithmetic operators ================================================================================== - /// \name \ref page_fennec_math_scalar "scalar" - \ref fennec::vector "vector" Arithmetic operators + /// \name \ref fennec_math_scalar "scalar" - \ref fennec_math_vector "vector" Arithmetic operators /// @{ /// - /// \brief \ref page_fennec_math_scalar "scalar" - \ref fennec::vector "vector" addition operator + /// \brief \ref fennec_math_scalar "scalar" - \ref fennec_math_vector "vector" addition operator /// /// \details - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i+rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i+rhs_i\f$ /// \param lhs left hand side /// \param rhs right hand side constexpr friend vector_t operator+(scalar_t lhs, const vector_t& rhs) { return vector_t((lhs[IndicesV] + rhs[IndicesV]) ...); } /// - /// \brief \ref page_fennec_math_scalar "scalar" - \ref fennec::vector "vector" subtraction operator + /// \brief \ref fennec_math_scalar "scalar" - \ref fennec_math_vector "vector" subtraction operator /// /// \details - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i-rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i-rhs_i\f$ /// \param lhs left hand side /// \param rhs right hand side constexpr friend vector_t operator-(scalar_t lhs, const vector_t& rhs) { return vector_t((lhs[IndicesV] - rhs[IndicesV]) ...); } /// - /// \brief \ref page_fennec_math_scalar "scalar" - \ref fennec::vector "vector" multiplication operator + /// \brief \ref fennec_math_scalar "scalar" - \ref fennec_math_vector "vector" multiplication operator /// /// \details - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i={lhs_i}\cdot{rhs_i}\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i={lhs_i}\cdot{rhs_i}\f$ /// \param lhs left hand side /// \param rhs right hand side constexpr friend vector_t operator*(scalar_t lhs, const vector_t& rhs) { return vector_t((lhs * rhs[IndicesV]) ...); } /// - /// \brief \ref page_fennec_math_scalar "scalar" - \ref fennec::vector "vector" division operator + /// \brief \ref fennec_math_scalar "scalar" - \ref fennec_math_vector "vector" division operator /// /// \details - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=\frac{lhs_i}{rhs_i}\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=\frac{lhs_i}{rhs_i}\f$ /// \param lhs left hand side /// \param rhs right hand side constexpr friend vector_t operator/(scalar_t lhs, const vector_t& rhs) { return vector_t((lhs / rhs[IndicesV]) ...); } /// - /// \brief \ref page_fennec_math_scalar "scalar" - \ref fennec::vector "vector" integer modulus operator + /// \brief \ref fennec_math_scalar "scalar" - \ref fennec_math_vector "vector" integer modulus operator /// /// \details - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i\%rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i\%rhs_i\f$ /// \param lhs left hand side /// \param rhs right hand side constexpr friend vector_t operator%(scalar_t lhs, const vector_t& rhs) requires(is_integral_v) @@ -550,56 +518,56 @@ struct vector : detail::vector_base_type // Vector-Scalar Arithmetic operators ================================================================================== - /// \name \ref fennec::vector "vector" - \ref page_fennec_math_scalar "scalar" Arithmetic operators + /// \name \ref fennec_math_vector "vector" - \ref fennec_math_scalar "scalar" Arithmetic operators /// @{ /// - /// \brief \ref fennec::vector "vector" - \ref page_fennec_math_scalar "scalar" addition operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_scalar "scalar" addition operator /// /// \details - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i+rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i+rhs_i\f$ /// \param lhs left hand side /// \param rhs right hand side constexpr friend vector_t operator+(const vector_t& lhs, scalar_t rhs) { return vector_t((lhs[IndicesV] + rhs) ...); } /// - /// \brief \ref fennec::vector "vector" - \ref page_fennec_math_scalar "scalar" subtraction operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_scalar "scalar" subtraction operator /// /// \details /// \param lhs left hand side /// \param rhs right hand side - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i-rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i-rhs_i\f$ constexpr friend vector_t operator-(const vector_t& lhs, scalar_t rhs) { return vector_t((lhs[IndicesV] - rhs) ...); } /// - /// \brief \ref fennec::vector "vector" - \ref page_fennec_math_scalar "scalar" multiplication operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_scalar "scalar" multiplication operator /// /// \details /// \param lhs left hand side /// \param rhs right hand side - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i={lhs_i}\cdot{rhs_i}\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i={lhs_i}\cdot{rhs_i}\f$ constexpr friend vector_t operator*(const vector_t& lhs, scalar_t rhs) { return vector_t((lhs[IndicesV] * rhs) ...); } /// - /// \brief \ref fennec::vector "vector" - \ref page_fennec_math_scalar "scalar" division operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_scalar "scalar" division operator /// /// \details /// \param lhs left hand side /// \param rhs right hand side - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=\frac{lhs_i}{rhs_i}\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=\frac{lhs_i}{rhs_i}\f$ constexpr friend vector_t operator/(const vector_t& lhs, scalar_t rhs) { return vector((lhs[IndicesV] / rhs) ...); } /// - /// \brief \ref fennec::vector "vector" - \ref page_fennec_math_scalar "scalar" integer modulus operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_scalar "scalar" integer modulus operator /// /// \details /// \param lhs left hand side /// \param rhs right hand side - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i\%rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i\%rhs_i\f$ constexpr friend vector_t operator%(const vector_t& lhs, scalar_t rhs) requires(is_integral_v) { return vector((lhs[IndicesV] % rhs) ...); } @@ -607,56 +575,56 @@ struct vector : detail::vector_base_type // Vector-Scalar Arithmetic Assignment operators ======================================================================= - /// \name \ref fennec::vector "vector" - \ref page_fennec_math_scalar "scalar" Arithmetic Assignment operators + /// \name \ref fennec_math_vector "vector" - \ref fennec_math_scalar "scalar" Arithmetic Assignment operators /// @{ /// - /// \brief \ref fennec::vector "vector" - \ref page_fennec_math_scalar "scalar" addition operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_scalar "scalar" addition operator /// /// \details /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i+rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i+rhs_i\f$ constexpr friend vector_t& operator+=(vector_t& lhs, scalar_t rhs) { return ((lhs[IndicesV] += rhs), ..., lhs); } /// - /// \brief \ref fennec::vector "vector" - \ref page_fennec_math_scalar "scalar" Subtraction operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_scalar "scalar" Subtraction operator /// /// \details /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i-rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i-rhs_i\f$ constexpr friend vector_t& operator-=(vector_t& lhs, scalar_t rhs) { return ((lhs[IndicesV] -= rhs), ..., lhs); } /// - /// \brief \ref fennec::vector "vector" - \ref page_fennec_math_scalar "scalar" multiplication operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_scalar "scalar" multiplication operator /// /// \details /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i={lhs_i}\cdot{rhs_i}\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i={lhs_i}\cdot{rhs_i}\f$ constexpr friend vector_t& operator*=(vector_t& lhs, scalar_t rhs) { return ((lhs[IndicesV] *= rhs), ..., lhs); } /// - /// \brief \ref fennec::vector "vector" - \ref page_fennec_math_scalar "scalar" division operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_scalar "scalar" division operator /// /// \details /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=\frac{lhs_i}{rhs_i}\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=\frac{lhs_i}{rhs_i}\f$ constexpr friend vector_t& operator/=(vector_t& lhs, scalar_t rhs) { return ((lhs[IndicesV] /= rhs), ..., lhs); } /// - /// \brief \ref fennec::vector "vector" - \ref page_fennec_math_scalar "scalar" integer modulus operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_scalar "scalar" integer modulus operator /// /// \details /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i\%rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i\%rhs_i\f$ constexpr friend vector_t& operator%=(vector_t& lhs, scalar_t rhs) requires(is_integral_v) { return ((lhs[IndicesV] %= rhs), ..., lhs); } @@ -664,55 +632,55 @@ struct vector : detail::vector_base_type // Vector-Vector Arithmetic operators ================================================================================== - /// \name \ref fennec::vector "vector" - \ref fennec::vector "vector" Arithmetic operators + /// \name \ref fennec_math_vector "vector" - \ref fennec_math_vector "vector" Arithmetic operators /// @{ /// - /// \brief \ref fennec::vector "vector" - \ref fennec::vector "vector" addition operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_vector "vector" addition operator /// /// \details /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i+rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i+rhs_i\f$ constexpr friend vector_t operator+(const vector_t& lhs, const vector_t& rhs) { return vector((lhs[IndicesV] + rhs[IndicesV]) ...); } /// - /// \brief \ref fennec::vector "vector" - \ref fennec::vector "vector" subtraction operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_vector "vector" subtraction operator /// /// \details /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i-rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i-rhs_i\f$ constexpr friend vector_t operator-(const vector_t& lhs, const vector_t& rhs) { return vector((lhs[IndicesV] - rhs[IndicesV]) ...); } /// - /// \brief \ref fennec::vector "vector" - \ref fennec::vector "vector" multiplication operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_vector "vector" multiplication operator /// /// \details /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i={lhs_i}\cdot{rhs_i}\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i={lhs_i}\cdot{rhs_i}\f$ constexpr friend vector_t operator*(const vector_t& lhs, const vector_t& rhs) { return vector((lhs[IndicesV] * rhs[IndicesV]) ...); } /// /// \fn vector::operator/(const vector_t&, const vector_t&) - /// \brief \ref fennec::vector "vector" - \ref fennec::vector "vector" division operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_vector "vector" division operator /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=\frac{lhs_i}{rhs_i}\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=\frac{lhs_i}{rhs_i}\f$ constexpr friend vector_t operator/(const vector_t& lhs, const vector_t& rhs) { return vector((lhs[IndicesV] / rhs[IndicesV]) ...); } /// - /// \brief \ref fennec::vector "vector" - \ref fennec::vector "vector" integer modulus operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_vector "vector" integer modulus operator /// /// \details /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i\%rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i\%rhs_i\f$ constexpr friend vector_t operator%(const vector_t& lhs, const vector_t& rhs) requires(is_integral_v) { return vector((lhs[IndicesV] % rhs[IndicesV]) ...); } @@ -720,56 +688,56 @@ struct vector : detail::vector_base_type // Vector-Vector Arithmetic Assignment operators ======================================================================= - /// \name \ref fennec::vector "vector" - \ref fennec::vector "vector" Arithmetic Assignment operators + /// \name \ref fennec_math_vector "vector" - \ref fennec_math_vector "vector" Arithmetic Assignment operators /// @{ /// - /// \brief \ref fennec::vector "vector" - \ref fennec::vector "vector" addition operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_vector "vector" addition operator /// /// \details /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i+rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i+rhs_i\f$ constexpr friend vector_t& operator+=(vector_t& lhs, const vector_t& rhs) { return ((lhs[IndicesV] += rhs[IndicesV]), ..., lhs); } /// - /// \brief \ref fennec::vector "vector" - \ref fennec::vector "vector" subtraction operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_vector "vector" subtraction operator /// /// \details /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i-rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i-rhs_i\f$ constexpr friend vector_t& operator-=(vector_t& lhs, const vector_t& rhs) { return ((lhs[IndicesV] -= rhs[IndicesV]), ..., lhs); } /// - /// \brief \ref fennec::vector "vector" - \ref fennec::vector "vector" multiplication operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_vector "vector" multiplication operator /// /// \details /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i={lhs_i}\cdot{rhs_i}\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i={lhs_i}\cdot{rhs_i}\f$ constexpr friend vector_t& operator*=(vector_t& lhs, const vector_t& rhs) { return ((lhs[IndicesV] *= rhs[IndicesV]), ..., lhs); } /// - /// \brief \ref fennec::vector "vector" - \ref fennec::vector "vector" division operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_vector "vector" division operator /// /// \details /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=\frac{lhs_i}{rhs_i}\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=\frac{lhs_i}{rhs_i}\f$ constexpr friend vector_t& operator/=(vector_t& lhs, const vector_t& rhs) { return ((lhs[IndicesV] /= rhs[IndicesV]), ..., lhs); } /// - /// \brief \ref fennec::vector "vector" - \ref fennec::vector "vector" integer modulus operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_vector "vector" integer modulus operator /// /// \details /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i\%rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i\%rhs_i\f$ constexpr friend vector_t& operator%=(vector_t& lhs, const vector_t& rhs) requires(is_integral_v) { return ((lhs[IndicesV] %= rhs[IndicesV]), ..., lhs); } @@ -781,40 +749,40 @@ struct vector : detail::vector_base_type /// @{ /// - /// \brief \ref fennec::vector "vector" - \ref page_fennec_math_scalar "scalar" logical and operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_scalar "scalar" logical and operator /// /// \details /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i\&\&rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i\&\&rhs_i\f$ constexpr friend vector_t operator&&(const vector_t& lhs, scalar_t rhs) requires(is_bool_v) { return vector_t((lhs[IndicesV] && rhs) ...); } /// - /// \brief \ref fennec::vector "vector" - \ref fennec::vector "vector" logical and operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_vector "vector" logical and operator /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i\&\&rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i\&\&rhs_i\f$ constexpr friend vector_t operator&&(const vector_t& lhs, const vector_t& rhs) requires(is_bool_v) { return vector_t((lhs[IndicesV] && rhs[IndicesV]) ...); } /// - /// \brief \ref fennec::vector "vector" - \ref page_fennec_math_scalar "scalar" logical or operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_scalar "scalar" logical or operator /// /// \details /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i\|\|rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i\|\|rhs_i\f$ constexpr friend vector_t operator||(const vector_t& lhs, scalar_t rhs) requires(is_bool_v) { return vector_t((lhs[IndicesV] || rhs) ...); } /// - /// \brief \ref fennec::vector "vector" - \ref fennec::vector "vector" logical or operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_vector "vector" logical or operator /// /// \details /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i\|\|rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i\|\|rhs_i\f$ constexpr friend vector_t operator||(const vector_t& lhs, const vector_t& rhs) requires(is_bool_v) { return vector_t((lhs[IndicesV] || rhs[IndicesV]) ...); } @@ -826,150 +794,150 @@ struct vector : detail::vector_base_type /// @{ /// - /// \brief \ref page_fennec_math_scalar "scalar" - \ref fennec::vector "vector" bitwise and operator + /// \brief \ref fennec_math_scalar "scalar" - \ref fennec_math_vector "vector" bitwise and operator /// /// \details /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i\&rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i\&rhs_i\f$ constexpr friend vector_t operator&(scalar_t rhs, const vector_t& lhs) requires(is_integral_v) { return vector_t((lhs & rhs[IndicesV]) ...); } /// - /// \brief \ref fennec::vector "vector" - \ref page_fennec_math_scalar "scalar" bitwise and assignment operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_scalar "scalar" bitwise and assignment operator /// /// \details /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i\&rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i\&rhs_i\f$ constexpr friend vector_t operator&=(vector_t& lhs, scalar_t rhs) requires(is_integral_v) { return ((lhs[IndicesV] &= rhs), ..., lhs); } /// - /// \brief \ref fennec::vector "vector" - \ref page_fennec_math_scalar "scalar" bitwise and operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_scalar "scalar" bitwise and operator /// /// \details /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i\&rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i\&rhs_i\f$ constexpr friend vector_t operator&(const vector_t& lhs, scalar_t rhs) requires(is_integral_v) { return vector_t((lhs[IndicesV] & rhs) ...); } /// - /// \brief \ref fennec::vector "vector" - \ref fennec::vector "vector" bitwise and assignment operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_vector "vector" bitwise and assignment operator /// /// \details /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i\&rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i\&rhs_i\f$ constexpr friend vector_t operator&=(vector_t& lhs, const vector_t& rhs) requires(is_integral_v) { return ((lhs[IndicesV] &= rhs), ..., lhs); } /// - /// \brief \ref fennec::vector "vector" - \ref fennec::vector "vector" bitwise and operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_vector "vector" bitwise and operator /// /// \details /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i\&rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i\&rhs_i\f$ constexpr friend vector_t operator&(const vector_t& lhs, const vector_t& rhs) requires(is_integral_v) { return vector_t((lhs[IndicesV] & rhs[IndicesV]) ...); } /// - /// \brief \ref page_fennec_math_scalar "scalar" - \ref fennec::vector "vector" bitwise or operator + /// \brief \ref fennec_math_scalar "scalar" - \ref fennec_math_vector "vector" bitwise or operator /// /// \details /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i|rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i|rhs_i\f$ constexpr friend vector_t operator|(scalar_t rhs, const vector_t& lhs) requires(is_integral_v) { return vector_t((lhs & rhs[IndicesV]) ...); } /// - /// \brief \ref fennec::vector "vector" - \ref page_fennec_math_scalar "scalar" bitwise or assignment operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_scalar "scalar" bitwise or assignment operator /// /// \details /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i|rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i|rhs_i\f$ constexpr friend vector_t operator|=(vector_t& lhs, scalar_t rhs) requires(is_integral_v) { return ((lhs[IndicesV] |= rhs), ..., lhs); } /// - /// \brief \ref fennec::vector "vector" - \ref page_fennec_math_scalar "scalar" bitwise or operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_scalar "scalar" bitwise or operator /// /// \details /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i|rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i|rhs_i\f$ constexpr friend vector_t operator|(const vector_t& lhs, scalar_t rhs) requires(is_integral_v) { return vector_t((lhs[IndicesV] | rhs) ...); } /// - /// \brief \ref fennec::vector "vector" - \ref fennec::vector "vector" bitwise or assignment operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_vector "vector" bitwise or assignment operator /// /// \details /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i|rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i|rhs_i\f$ constexpr friend vector_t operator|=(vector_t& lhs, const vector_t& rhs) requires(is_integral_v) { return ((lhs[IndicesV] |= rhs), ..., lhs); } /// - /// \brief \ref fennec::vector "vector" - \ref fennec::vector "vector" bitwise or operator + /// \brief \ref fennec_math_vector "vector" - \ref fennec_math_vector "vector" bitwise or operator /// /// \details /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i|rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i|rhs_i\f$ constexpr friend vector_t operator|(const vector_t& lhs, const vector_t& rhs) requires(is_integral_v) { return vector_t((lhs[IndicesV] | rhs[IndicesV]) ...); } /// - /// \ref page_fennec_math_scalar "scalar" - \ref fennec::vector "vector" bitwise or operator + /// \ref fennec_math_scalar "scalar" - \ref fennec_math_vector "vector" bitwise or operator /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i\^rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i\^rhs_i\f$ constexpr friend vector_t operator^(scalar_t rhs, const vector_t& lhs) requires(is_integral_v) { return vector_t((lhs ^ rhs[IndicesV]) ...); } /// /// \fn vector::operator^=(vector_t&, scalar_t) - /// \ref fennec::vector "vector" - \ref page_fennec_math_scalar "scalar" bitwise or assignment operator + /// \ref fennec_math_vector "vector" - \ref fennec_math_scalar "scalar" bitwise or assignment operator /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i\^rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i\^rhs_i\f$ constexpr friend vector_t operator^=(vector_t& lhs, scalar_t rhs) requires(is_integral_v) { return ((lhs[IndicesV] ^= rhs), ..., lhs); } /// /// \fn vector::operator^(const vector_t&, scalar_t) - /// \ref fennec::vector "vector" - \ref page_fennec_math_scalar "scalar" bitwise or operator + /// \ref fennec_math_vector "vector" - \ref fennec_math_scalar "scalar" bitwise or operator /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i\^rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i\^rhs_i\f$ constexpr friend vector_t operator^(const vector_t& lhs, scalar_t rhs) requires(is_integral_v) { return vector_t((lhs[IndicesV] ^ rhs) ...); } /// /// \fn vector::operator^=(vector_t&, const vector_t&) - /// \ref fennec::vector "vector" - \ref fennec::vector "vector" bitwise or assignment operator + /// \ref fennec_math_vector "vector" - \ref fennec_math_vector "vector" bitwise or assignment operator /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i\^rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i\^rhs_i\f$ constexpr friend vector_t operator^=(vector_t& lhs, const vector_t& rhs) requires(is_integral_v) { return ((lhs[IndicesV] ^= rhs), ..., lhs); } /// /// \fn vector::operator^(const vector_t&, const vector_t&) - /// \ref fennec::vector "vector" - \ref fennec::vector "vector" bitwise or operator + /// \ref fennec_math_vector "vector" - \ref fennec_math_vector "vector" bitwise or operator /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i\^rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i\^rhs_i\f$ constexpr friend vector_t operator^(const vector_t& lhs, const vector_t& rhs) requires(is_integral_v) { return vector_t((lhs[IndicesV] ^ rhs[IndicesV]) ...); } @@ -977,37 +945,37 @@ struct vector : detail::vector_base_type /// /// \fn vector::operator<<=(vector_t&, scalar_t) - /// \ref fennec::vector "vector" - \ref page_fennec_math_scalar "scalar" bitwise left-shift assignment operator + /// \ref fennec_math_vector "vector" - \ref fennec_math_scalar "scalar" bitwise left-shift assignment operator /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i<<=rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i<<=rhs_i\f$ constexpr friend vector_t operator<<=(vector_t& lhs, scalar_t rhs) requires(is_integral_v) { return ((lhs[IndicesV] <<= rhs), ..., lhs); } /// /// \fn vector::operator<<(const vector_t&, scalar_t) - /// \ref fennec::vector "vector" - \ref page_fennec_math_scalar "scalar" bitwise or operator + /// \ref fennec_math_vector "vector" - \ref fennec_math_scalar "scalar" bitwise or operator /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i<) { return vector_t((lhs[IndicesV] << rhs) ...); } /// /// \fn vector::operator<<=(vector_t&, const vector_t&) - /// \ref fennec::vector "vector" - \ref fennec::vector "vector" bitwise or assignment operator + /// \ref fennec_math_vector "vector" - \ref fennec_math_vector "vector" bitwise or assignment operator /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i<<=rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i<<=rhs_i\f$ constexpr friend vector_t operator<<=(vector_t& lhs, const vector_t& rhs) requires(is_integral_v) { return ((lhs[IndicesV] <<= rhs), ..., lhs); } /// /// \fn vector::operator<<(const vector_t&, const vector_t&) - /// \ref fennec::vector "vector" - \ref fennec::vector "vector" bitwise or operator + /// \ref fennec_math_vector "vector" - \ref fennec_math_vector "vector" bitwise or operator /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i<) { return vector_t((lhs[IndicesV] << rhs[IndicesV]) ...); } @@ -1015,37 +983,37 @@ struct vector : detail::vector_base_type /// /// \fn vector::operator>>=(vector_t&, scalar_t) - /// \ref fennec::vector "vector" - \ref page_fennec_math_scalar "scalar" bitwise left-shift assignment operator + /// \ref fennec_math_vector "vector" - \ref fennec_math_scalar "scalar" bitwise left-shift assignment operator /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i>>=rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i>>=rhs_i\f$ constexpr friend vector_t operator>>=(vector_t& lhs, scalar_t rhs) requires(is_integral_v) { return ((lhs[IndicesV] >>= rhs), ..., lhs); } /// /// \fn vector::operator>>(const vector_t&, scalar_t) - /// \ref fennec::vector "vector" - \ref page_fennec_math_scalar "scalar" bitwise or operator + /// \ref fennec_math_vector "vector" - \ref fennec_math_scalar "scalar" bitwise or operator /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i>>rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i>>rhs_i\f$ constexpr friend vector_t operator>>(const vector_t& lhs, scalar_t rhs) requires(is_integral_v) { return vector_t((lhs[IndicesV] >> rhs) ...); } /// /// \fn vector::operator>>=(vector_t&, const vector_t&) - /// \ref fennec::vector "vector" - \ref fennec::vector "vector" bitwise or assignment operator + /// \ref fennec_math_vector "vector" - \ref fennec_math_vector "vector" bitwise or assignment operator /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i>>=rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i>>=rhs_i\f$ constexpr friend vector_t operator>>=(vector_t& lhs, const vector_t& rhs) requires(is_integral_v) { return ((lhs[IndicesV] >>= rhs), ..., lhs); } /// /// \fn vector::operator>>(const vector_t&, const vector_t&) - /// \ref fennec::vector "vector" - \ref fennec::vector "vector" bitwise or operator + /// \ref fennec_math_vector "vector" - \ref fennec_math_vector "vector" bitwise or operator /// \param lhs Left Hand Side of the Expression /// \param rhs Right Hand Side of the Expression - /// \returns A \ref fennec::vector "vector" \a v such that, \f$v_i=lhs_i>>rhs_i\f$ + /// \returns A \ref fennec_math_vector "vector" \a v such that, \f$v_i=lhs_i>>rhs_i\f$ constexpr friend vector_t operator>>(const vector_t& lhs, const vector_t& rhs) requires(is_integral_v) { return vector_t((lhs[IndicesV] >> rhs[IndicesV]) ...); } diff --git a/include/fennec/math/vector_traits.h b/include/fennec/math/vector_traits.h index 0812013..f1f606a 100644 --- a/include/fennec/math/vector_traits.h +++ b/include/fennec/math/vector_traits.h @@ -18,7 +18,7 @@ /// /// \file vector_traits.h -/// \brief part of the \ref page_fennec_math_vector +/// \brief part of the \ref fennec_math_vector /// /// /// \details this header implements functions to test vector types at compile time diff --git a/include/fennec/memory/detail/__memory.h b/include/fennec/memory/detail/__memory.h index 4ef098c..78fbb57 100644 --- a/include/fennec/memory/detail/__memory.h +++ b/include/fennec/memory/detail/__memory.h @@ -13,6 +13,9 @@ namespace fennec namespace detail { +constexpr size_t __memcpy_8(void* dst, const void* src) + { *static_cast(dst) = *static_cast(src); return 1; } + // helper for copying 2 bytes at once constexpr size_t __memcpy_16(void* dst, const void* src) { *static_cast(dst) = *static_cast(src); return 2; } @@ -25,6 +28,23 @@ constexpr size_t __memcpy_32(void* dst, const void* src) constexpr size_t __memcpy_64(void* dst, const void* src) { *static_cast(dst) = *static_cast(src); return 8; } +constexpr size_t __memcpy(void* dst, const void* src, size_t n) +{ + switch (n) + { + case 0: + return 0; + case 1: + return __memcpy_8(dst, src); + case 2: case 3: + return __memcpy_16(dst, src); + case 4: case 5: case 6: case 7: + return __memcpy_32(dst, src); + default: + return __memcpy_64(dst, src); + } +} + } } diff --git a/include/fennec/memory/memory.h b/include/fennec/memory/memory.h index 19ed615..f9ed2b9 100644 --- a/include/fennec/memory/memory.h +++ b/include/fennec/memory/memory.h @@ -101,10 +101,11 @@ constexpr void* memcpy(void* dst, const void* src, size_t n) uint8_t* d = static_cast(dst); const uint8_t* s = static_cast(src); - while (n >= 8) { detail::__memcpy_64(d, s); d += 8; s += 8; n -= 8; } - while (n >= 4) { detail::__memcpy_32(d, s); d += 4; s += 4; n -= 4; } - while (n >= 2) { detail::__memcpy_16(d, s); d += 2; s += 2; n -= 2; } - while (n >= 1) { *d++ = *s++; --n; } + while (n > 0) + { + size_t step = detail::__memcpy(d, s, n); + d += step; s += step; n -= step; + } return dst; } @@ -131,18 +132,20 @@ constexpr void* memmove(void* dst, const void* src, size_t n) if (d < s) { - while (n >= 8) { detail::__memcpy_64(d, s); d += 8; s += 8; n -= 8; } - while (n >= 4) { detail::__memcpy_32(d, s); d += 4; s += 4; n -= 4; } - while (n >= 2) { detail::__memcpy_16(d, s); d += 2; s += 2; n -= 2; } - while (n >= 1) { *d++ = *s++; --n; } + while (n > 0) + { + size_t step = detail::__memcpy(d, s, n); + d += step; s += step; n -= step; + } } else { d += n - 1; s += n - 1; - while (n >= 8) { detail::__memcpy_64(d, s); d -= 8; s -= 8; n -= 8; } - while (n >= 4) { detail::__memcpy_32(d, s); d -= 4; s -= 4; n -= 4; } - while (n >= 2) { detail::__memcpy_16(d, s); d -= 2; s -= 2; n -= 2; } - while (n >= 1) { *d-- = *s--; --n; } + while (n > 0) + { + size_t step = detail::__memcpy(d, s, n); + d -= step; s -= step; n -= step; + } } return dst; } diff --git a/test/tests/math/test_geometric.h b/test/tests/math/test_geometric.h index 113500c..c8783b9 100644 --- a/test/tests/math/test_geometric.h +++ b/test/tests/math/test_geometric.h @@ -33,6 +33,7 @@ namespace test inline void fennec_test_math_geometric() { +/* fennec_test_spacer(1); fennec_test_run(fennec::dot(vec2(1, 2), vec2(1, 2)), 5.0f); @@ -68,6 +69,7 @@ inline void fennec_test_math_geometric() fennec_test_run(fennec::normalize(vec2(1, 1)), vec2(sqrt(2.0f) / 2.0f, sqrt(2.0f) / 2.0f)); fennec_test_run(fennec::normalize(vec3(1, 1, 1)), vec3(sqrt(3.0f) / 3.0f, sqrt(3.0f) / 3.0f, sqrt(3.0f) / 3.0f)); fennec_test_run(fennec::normalize(vec4(1, 1, 1, 1)), vec4(0.5f, 0.5f, 0.5f, 0.5f)); +*/ } }