Removes preprocessor check for FMA instructions in matrix multiplication functions.
This simplifies the code and relies on the compiler's ability to optimize the
code based on available hardware support. The assumption is that modern
compilers will automatically utilize FMA instructions if available, and fall
back to alternative implementations if not.
Ensures that AVX2 intrinsics are only included when the
OMATH_USE_AVX2 preprocessor definition is set. This prevents
compilation errors when AVX2 support is not available or
explicitly disabled.
The C standard library function fmodf is not guaranteed to be in namespace std, and in fact is not with a default Ubuntu 24.04 installation, leading to the following compile error:
```console
Change Dir: '/vcpkg/buildtrees/vcpkg-ci-orange-math/x64-linux-dbg'
Run Build Command(s): /vcpkg/downloads/tools/ninja/1.12.1-linux/ninja -v -v -j33
[1/2] /usr/bin/c++ -DOMATH_SUPRESS_SAFETY_CHECKS -DOMATH_VERSION=\"3.5.0\" -isystem /vcpkg/installed/x64-linux/include -fPIC -g -std=gnu++23 -MD -MT CMakeFiles/main.dir/main.cpp.o -MF CMakeFiles/main.dir/main.cpp.o.d -o CMakeFiles/main.dir/main.cpp.o -c /vcpkg/scripts/test_ports/vcpkg-ci-orange-math/project/main.cpp
FAILED: CMakeFiles/main.dir/main.cpp.o
/usr/bin/c++ -DOMATH_SUPRESS_SAFETY_CHECKS -DOMATH_VERSION=\"3.5.0\" -isystem /vcpkg/installed/x64-linux/include -fPIC -g -std=gnu++23 -MD -MT CMakeFiles/main.dir/main.cpp.o -MF CMakeFiles/main.dir/main.cpp.o.d -o CMakeFiles/main.dir/main.cpp.o -c /vcpkg/scripts/test_ports/vcpkg-ci-orange-math/project/main.cpp
In file included from /vcpkg/installed/x64-linux/include/omath/omath.hpp:22,
from /vcpkg/scripts/test_ports/vcpkg-ci-orange-math/project/main.cpp:1:
/vcpkg/installed/x64-linux/include/omath/color.hpp: In member function ‘constexpr omath::Hsv omath::Color::to_hsv() const’:
/vcpkg/installed/x64-linux/include/omath/color.hpp:98:45: error: ‘fmodf’ is not a member of ‘std’; did you mean ‘modf’?
98 | hsv_data.hue = 60.f * (std::fmodf(((green - blue) / delta), 6.f));
| ^~~~~
| modf
ninja: build stopped: subcommand failed.
```
Only the 'sufficient additional overloads' of `fmod` are guaranteed to be in `std`. Since this is clearly intended to call the (float, float) overload, explicitly cast `((green - blue) / delta)` (which is a `double`) to `float` and call the name in `std` as suggested by the diagnostic.
Optimizes matrix multiplication by specializing the algorithm
based on the matrix storage type (row-major or column-major).
This change significantly improves performance by leveraging
memory access patterns specific to each storage order.
Adds a partial specialization of `std::formatter` for `omath::Angle`
to provide formatting support using `std::format`.
This allows `Angle` objects to be easily formatted as strings,
including degree symbol representation, using standard formatting
techniques.
Fixes a potential type conversion issue by explicitly casting the x-coordinate to float in the world_to_screen test. This prevents possible compiler warnings and ensures the intended behavior.
Adds functionality to convert screen coordinates to world space, including handling for cases where the inverse view projection matrix is singular or when the world position is out of screen bounds.
Also exposes Camera class to unit tests.
Adds an angle class with support for different normalization
and clamping strategies. Includes trigonometric functions and
arithmetic operators. Introduces unit tests to verify correct
functionality.
Disables unity builds to address a compilation issue.
Removes the deprecated `Matrix` class and its associated source files and unit tests.
This change is to ensure code cleanliness and prevent accidental usage of the slow and outdated `Matrix` class.
The `Mat` class should be used instead.
Updates the include paths in omath.hpp to be more explicit,
ensuring correct referencing of header files.
Removes unnecessary include of vector3.hpp from vector2.hpp.
Moves linear algebra headers to a new subdirectory to improve project structure.
Updates includes to reflect the directory change.
Adds vcpkg to the tracked repositories.
Adds functions to generate left- and right-handed orthographic projection matrices.
This provides more flexibility when defining a projection for rendering.
Adds formatters for `omath::Angle` and `omath::Color` to allow for easy formatting using `std::format`.
This allows users to easily output Angle and Color values in a human-readable format.
Adds `std::formatter` specializations for `Mat`, `Vector2`, `Vector3`, and `Vector4` types, enabling the use of `std::format` for these types.
This simplifies formatting and printing of these mathematical objects, improving code readability and consistency.
Also adds a hash function specialization for Vector3.
Creates the main omath header file that includes all
omath library components. This provides a single point
of inclusion for the entire library, simplifying usage
and dependency management.
Also, adjusts the return types for projectile prediction
functions within the legacy engine to explicitly use
the `Vector3` type for consistency and clarity.
Corrects namespace naming from unity_engine to unreal_engine.
Adjusts projectile prediction and angle calculations for accuracy
in Unreal Engine environments.
Adds Unreal Engine-specific implementations for camera and projectile prediction calculations.
This includes:
- Defining constants and data types tailored for Unreal Engine's coordinate system and conventions.
- Implementing functions for calculating forward, right, and up vectors, view matrices, and perspective projection matrices.
- Providing camera trait for look-at angle calculations and projection matrix generation.
- Implements projectile prediction traits and utilities.
Adds a compiler definition for MSVC to prevent redefinition of min/max macros by the Windows SDK.
Removes unnecessary undef directives in color.hpp as the NOMINMAX definition now handles the issue.
Includes the necessary formula headers in the camera trait files for different rendering engines.
This ensures that the required mathematical functions and definitions are available when using camera traits.
Introduces a concept `PredEngineConcept` to ensure that classes used as projectile prediction engine traits conform to a specific interface.
This enforces the presence and return types of required methods and ensures that these methods are `noexcept`, improving type safety and predictability.
Adds a concept `CameraEngineConcept` to ensure that camera
engine implementations provide the necessary functions
with the correct signatures and `noexcept` specifications.
This enables compile-time checks for valid camera engine
implementations, improving code reliability and preventing
runtime errors.
Adds less than, greater than, less than or equal, and greater than or equal operators to the Vector2, Vector3 and Vector4 classes.
The comparison is based on the lengths of the vectors.
Adds corresponding unit tests.