mirror of
https://github.com/orange-cpp/omath.git
synced 2026-06-16 04:04:34 +00:00
removed useless inline keywords
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
namespace omath::cry_engine
|
namespace omath::cry_engine
|
||||||
{
|
{
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept
|
constexpr Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept
|
||||||
{
|
{
|
||||||
return mat_rotation_axis_z<float, MatStoreType::ROW_MAJOR>(angles.yaw)
|
return mat_rotation_axis_z<float, MatStoreType::ROW_MAJOR>(angles.yaw)
|
||||||
* mat_rotation_axis_y<float, MatStoreType::ROW_MAJOR>(angles.roll)
|
* mat_rotation_axis_y<float, MatStoreType::ROW_MAJOR>(angles.roll)
|
||||||
@@ -16,7 +16,7 @@ namespace omath::cry_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> forward_vector(const ViewAngles& angles) noexcept
|
constexpr Vector3<float> forward_vector(const ViewAngles& angles) noexcept
|
||||||
{
|
{
|
||||||
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_forward);
|
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_forward);
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ namespace omath::cry_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> right_vector(const ViewAngles& angles) noexcept
|
constexpr Vector3<float> right_vector(const ViewAngles& angles) noexcept
|
||||||
{
|
{
|
||||||
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_right);
|
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_right);
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ namespace omath::cry_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> up_vector(const ViewAngles& angles) noexcept
|
constexpr Vector3<float> up_vector(const ViewAngles& angles) noexcept
|
||||||
{
|
{
|
||||||
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_up);
|
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_up);
|
||||||
|
|
||||||
@@ -40,26 +40,26 @@ namespace omath::cry_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3<float>& cam_origin) noexcept
|
constexpr Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3<float>& cam_origin) noexcept
|
||||||
{
|
{
|
||||||
return mat_camera_view<float, MatStoreType::ROW_MAJOR>(forward_vector(angles), right_vector(angles),
|
return mat_camera_view<float, MatStoreType::ROW_MAJOR>(forward_vector(angles), right_vector(angles),
|
||||||
up_vector(angles), cam_origin);
|
up_vector(angles), cam_origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> extract_origin(const Mat4X4& mat) noexcept
|
constexpr Vector3<float> extract_origin(const Mat4X4& mat) noexcept
|
||||||
{
|
{
|
||||||
return mat_extract_origin(mat);
|
return mat_extract_origin(mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> extract_scale(const Mat4X4& mat) noexcept
|
constexpr Vector3<float> extract_scale(const Mat4X4& mat) noexcept
|
||||||
{
|
{
|
||||||
return mat_extract_scale(mat);
|
return mat_extract_scale(mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr ViewAngles extract_rotation_angles(const Mat4X4& mat) noexcept
|
constexpr ViewAngles extract_rotation_angles(const Mat4X4& mat) noexcept
|
||||||
{
|
{
|
||||||
const auto angles = mat_extract_rotation_zyx(mat);
|
const auto angles = mat_extract_rotation_zyx(mat);
|
||||||
return {
|
return {
|
||||||
@@ -69,7 +69,7 @@ namespace omath::cry_engine
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Mat4X4
|
constexpr Mat4X4
|
||||||
calc_perspective_projection_matrix(const float field_of_view, const float aspect_ratio, const float near_plane,
|
calc_perspective_projection_matrix(const float field_of_view, const float aspect_ratio, const float near_plane,
|
||||||
const float far_plane,
|
const float far_plane,
|
||||||
const NDCDepthRange ndc_depth_range = NDCDepthRange::ZERO_TO_ONE) noexcept
|
const NDCDepthRange ndc_depth_range = NDCDepthRange::ZERO_TO_ONE) noexcept
|
||||||
|
|||||||
@@ -8,10 +8,10 @@
|
|||||||
namespace omath::frostbite_engine
|
namespace omath::frostbite_engine
|
||||||
{
|
{
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept;
|
constexpr Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> forward_vector(const ViewAngles& angles) noexcept
|
constexpr Vector3<float> forward_vector(const ViewAngles& angles) noexcept
|
||||||
{
|
{
|
||||||
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_forward);
|
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_forward);
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ namespace omath::frostbite_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> right_vector(const ViewAngles& angles) noexcept
|
constexpr Vector3<float> right_vector(const ViewAngles& angles) noexcept
|
||||||
{
|
{
|
||||||
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_right);
|
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_right);
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ namespace omath::frostbite_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> up_vector(const ViewAngles& angles) noexcept
|
constexpr Vector3<float> up_vector(const ViewAngles& angles) noexcept
|
||||||
{
|
{
|
||||||
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_up);
|
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_up);
|
||||||
|
|
||||||
@@ -35,14 +35,14 @@ namespace omath::frostbite_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3<float>& cam_origin) noexcept
|
constexpr Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3<float>& cam_origin) noexcept
|
||||||
{
|
{
|
||||||
return mat_camera_view<float, MatStoreType::ROW_MAJOR>(forward_vector(angles), right_vector(angles),
|
return mat_camera_view<float, MatStoreType::ROW_MAJOR>(forward_vector(angles), right_vector(angles),
|
||||||
up_vector(angles), cam_origin);
|
up_vector(angles), cam_origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept
|
constexpr Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept
|
||||||
{
|
{
|
||||||
return mat_rotation_axis_z<float, MatStoreType::ROW_MAJOR>(angles.roll)
|
return mat_rotation_axis_z<float, MatStoreType::ROW_MAJOR>(angles.roll)
|
||||||
* mat_rotation_axis_y<float, MatStoreType::ROW_MAJOR>(angles.yaw)
|
* mat_rotation_axis_y<float, MatStoreType::ROW_MAJOR>(angles.yaw)
|
||||||
@@ -50,19 +50,19 @@ namespace omath::frostbite_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> extract_origin(const Mat4X4& mat) noexcept
|
constexpr Vector3<float> extract_origin(const Mat4X4& mat) noexcept
|
||||||
{
|
{
|
||||||
return mat_extract_origin(mat);
|
return mat_extract_origin(mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> extract_scale(const Mat4X4& mat) noexcept
|
constexpr Vector3<float> extract_scale(const Mat4X4& mat) noexcept
|
||||||
{
|
{
|
||||||
return mat_extract_scale(mat);
|
return mat_extract_scale(mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr ViewAngles extract_rotation_angles(const Mat4X4& mat) noexcept
|
constexpr ViewAngles extract_rotation_angles(const Mat4X4& mat) noexcept
|
||||||
{
|
{
|
||||||
const auto angles = mat_extract_rotation_zyx(mat);
|
const auto angles = mat_extract_rotation_zyx(mat);
|
||||||
return {
|
return {
|
||||||
@@ -73,7 +73,7 @@ namespace omath::frostbite_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Mat4X4 calc_perspective_projection_matrix(
|
constexpr Mat4X4 calc_perspective_projection_matrix(
|
||||||
const float field_of_view, const float aspect_ratio, const float near_plane, const float far_plane,
|
const float field_of_view, const float aspect_ratio, const float near_plane, const float far_plane,
|
||||||
const NDCDepthRange ndc_depth_range = NDCDepthRange::NEGATIVE_ONE_TO_ONE) noexcept
|
const NDCDepthRange ndc_depth_range = NDCDepthRange::NEGATIVE_ONE_TO_ONE) noexcept
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,10 +8,10 @@
|
|||||||
namespace omath::iw_engine
|
namespace omath::iw_engine
|
||||||
{
|
{
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept;
|
constexpr Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> forward_vector(const ViewAngles& angles) noexcept
|
constexpr Vector3<float> forward_vector(const ViewAngles& angles) noexcept
|
||||||
{
|
{
|
||||||
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_forward);
|
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_forward);
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ namespace omath::iw_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> right_vector(const ViewAngles& angles) noexcept
|
constexpr Vector3<float> right_vector(const ViewAngles& angles) noexcept
|
||||||
{
|
{
|
||||||
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_right);
|
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_right);
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ namespace omath::iw_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> up_vector(const ViewAngles& angles) noexcept
|
constexpr Vector3<float> up_vector(const ViewAngles& angles) noexcept
|
||||||
{
|
{
|
||||||
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_up);
|
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_up);
|
||||||
|
|
||||||
@@ -35,25 +35,25 @@ namespace omath::iw_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept
|
constexpr Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept
|
||||||
{
|
{
|
||||||
return mat_rotation_axis_z(angles.yaw) * mat_rotation_axis_y(angles.pitch) * mat_rotation_axis_x(angles.roll);
|
return mat_rotation_axis_z(angles.yaw) * mat_rotation_axis_y(angles.pitch) * mat_rotation_axis_x(angles.roll);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> extract_origin(const Mat4X4& mat) noexcept
|
constexpr Vector3<float> extract_origin(const Mat4X4& mat) noexcept
|
||||||
{
|
{
|
||||||
return mat_extract_origin(mat);
|
return mat_extract_origin(mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> extract_scale(const Mat4X4& mat) noexcept
|
constexpr Vector3<float> extract_scale(const Mat4X4& mat) noexcept
|
||||||
{
|
{
|
||||||
return mat_extract_scale(mat);
|
return mat_extract_scale(mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr ViewAngles extract_rotation_angles(const Mat4X4& mat) noexcept
|
constexpr ViewAngles extract_rotation_angles(const Mat4X4& mat) noexcept
|
||||||
{
|
{
|
||||||
const auto angles = mat_extract_rotation_zyx(mat);
|
const auto angles = mat_extract_rotation_zyx(mat);
|
||||||
return {
|
return {
|
||||||
@@ -64,13 +64,13 @@ namespace omath::iw_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3<float>& cam_origin) noexcept
|
constexpr Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3<float>& cam_origin) noexcept
|
||||||
{
|
{
|
||||||
return mat_camera_view(forward_vector(angles), right_vector(angles), up_vector(angles), cam_origin);
|
return mat_camera_view(forward_vector(angles), right_vector(angles), up_vector(angles), cam_origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Mat4X4 calc_perspective_projection_matrix(
|
constexpr Mat4X4 calc_perspective_projection_matrix(
|
||||||
const float field_of_view, const float aspect_ratio, const float near_plane, const float far_plane,
|
const float field_of_view, const float aspect_ratio, const float near_plane, const float far_plane,
|
||||||
const NDCDepthRange ndc_depth_range = NDCDepthRange::NEGATIVE_ONE_TO_ONE) noexcept
|
const NDCDepthRange ndc_depth_range = NDCDepthRange::NEGATIVE_ONE_TO_ONE) noexcept
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,10 +7,10 @@
|
|||||||
namespace omath::opengl_engine
|
namespace omath::opengl_engine
|
||||||
{
|
{
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept;
|
constexpr Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> forward_vector(const ViewAngles& angles) noexcept
|
constexpr Vector3<float> forward_vector(const ViewAngles& angles) noexcept
|
||||||
{
|
{
|
||||||
const auto vec =
|
const auto vec =
|
||||||
rotation_matrix(angles) * mat_column_from_vector<float, MatStoreType::COLUMN_MAJOR>(k_abs_forward);
|
rotation_matrix(angles) * mat_column_from_vector<float, MatStoreType::COLUMN_MAJOR>(k_abs_forward);
|
||||||
@@ -19,7 +19,7 @@ namespace omath::opengl_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> right_vector(const ViewAngles& angles) noexcept
|
constexpr Vector3<float> right_vector(const ViewAngles& angles) noexcept
|
||||||
{
|
{
|
||||||
const auto vec =
|
const auto vec =
|
||||||
rotation_matrix(angles) * mat_column_from_vector<float, MatStoreType::COLUMN_MAJOR>(k_abs_right);
|
rotation_matrix(angles) * mat_column_from_vector<float, MatStoreType::COLUMN_MAJOR>(k_abs_right);
|
||||||
@@ -28,7 +28,7 @@ namespace omath::opengl_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> up_vector(const ViewAngles& angles) noexcept
|
constexpr Vector3<float> up_vector(const ViewAngles& angles) noexcept
|
||||||
{
|
{
|
||||||
const auto vec = rotation_matrix(angles) * mat_column_from_vector<float, MatStoreType::COLUMN_MAJOR>(k_abs_up);
|
const auto vec = rotation_matrix(angles) * mat_column_from_vector<float, MatStoreType::COLUMN_MAJOR>(k_abs_up);
|
||||||
|
|
||||||
@@ -36,13 +36,13 @@ namespace omath::opengl_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3<float>& cam_origin) noexcept
|
constexpr Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3<float>& cam_origin) noexcept
|
||||||
{
|
{
|
||||||
return mat_look_at_right_handed(cam_origin, cam_origin + forward_vector(angles), up_vector(angles));
|
return mat_look_at_right_handed(cam_origin, cam_origin + forward_vector(angles), up_vector(angles));
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept
|
constexpr Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept
|
||||||
{
|
{
|
||||||
return mat_rotation_axis_z<float, MatStoreType::COLUMN_MAJOR>(angles.roll)
|
return mat_rotation_axis_z<float, MatStoreType::COLUMN_MAJOR>(angles.roll)
|
||||||
* mat_rotation_axis_y<float, MatStoreType::COLUMN_MAJOR>(angles.yaw)
|
* mat_rotation_axis_y<float, MatStoreType::COLUMN_MAJOR>(angles.yaw)
|
||||||
@@ -50,19 +50,19 @@ namespace omath::opengl_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> extract_origin(const Mat4X4& mat) noexcept
|
constexpr Vector3<float> extract_origin(const Mat4X4& mat) noexcept
|
||||||
{
|
{
|
||||||
return mat_extract_origin(mat);
|
return mat_extract_origin(mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> extract_scale(const Mat4X4& mat) noexcept
|
constexpr Vector3<float> extract_scale(const Mat4X4& mat) noexcept
|
||||||
{
|
{
|
||||||
return mat_extract_scale(mat);
|
return mat_extract_scale(mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr ViewAngles extract_rotation_angles(const Mat4X4& mat) noexcept
|
constexpr ViewAngles extract_rotation_angles(const Mat4X4& mat) noexcept
|
||||||
{
|
{
|
||||||
const auto angles = mat_extract_rotation_zyx(mat);
|
const auto angles = mat_extract_rotation_zyx(mat);
|
||||||
return {
|
return {
|
||||||
@@ -73,7 +73,7 @@ namespace omath::opengl_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Mat4X4 calc_perspective_projection_matrix(
|
constexpr Mat4X4 calc_perspective_projection_matrix(
|
||||||
const float field_of_view, const float aspect_ratio, const float near_plane, const float far_plane,
|
const float field_of_view, const float aspect_ratio, const float near_plane, const float far_plane,
|
||||||
const NDCDepthRange ndc_depth_range = NDCDepthRange::NEGATIVE_ONE_TO_ONE) noexcept
|
const NDCDepthRange ndc_depth_range = NDCDepthRange::NEGATIVE_ONE_TO_ONE) noexcept
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
namespace omath::rage_engine
|
namespace omath::rage_engine
|
||||||
{
|
{
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept;
|
constexpr Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> forward_vector(const ViewAngles& angles) noexcept
|
constexpr Vector3<float> forward_vector(const ViewAngles& angles) noexcept
|
||||||
{
|
{
|
||||||
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_forward);
|
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_forward);
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ namespace omath::rage_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> right_vector(const ViewAngles& angles) noexcept
|
constexpr Vector3<float> right_vector(const ViewAngles& angles) noexcept
|
||||||
{
|
{
|
||||||
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_right);
|
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_right);
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ namespace omath::rage_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> up_vector(const ViewAngles& angles) noexcept
|
constexpr Vector3<float> up_vector(const ViewAngles& angles) noexcept
|
||||||
{
|
{
|
||||||
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_up);
|
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_up);
|
||||||
|
|
||||||
@@ -36,14 +36,14 @@ namespace omath::rage_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3<float>& cam_origin) noexcept
|
constexpr Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3<float>& cam_origin) noexcept
|
||||||
{
|
{
|
||||||
return mat_camera_view<float, MatStoreType::ROW_MAJOR>(forward_vector(angles), right_vector(angles),
|
return mat_camera_view<float, MatStoreType::ROW_MAJOR>(forward_vector(angles), right_vector(angles),
|
||||||
up_vector(angles), cam_origin);
|
up_vector(angles), cam_origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept
|
constexpr Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept
|
||||||
{
|
{
|
||||||
return mat_rotation_axis_z<float, MatStoreType::ROW_MAJOR>(angles.yaw)
|
return mat_rotation_axis_z<float, MatStoreType::ROW_MAJOR>(angles.yaw)
|
||||||
* mat_rotation_axis_y<float, MatStoreType::ROW_MAJOR>(angles.roll)
|
* mat_rotation_axis_y<float, MatStoreType::ROW_MAJOR>(angles.roll)
|
||||||
@@ -51,19 +51,19 @@ namespace omath::rage_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> extract_origin(const Mat4X4& mat) noexcept
|
constexpr Vector3<float> extract_origin(const Mat4X4& mat) noexcept
|
||||||
{
|
{
|
||||||
return mat_extract_origin(mat);
|
return mat_extract_origin(mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> extract_scale(const Mat4X4& mat) noexcept
|
constexpr Vector3<float> extract_scale(const Mat4X4& mat) noexcept
|
||||||
{
|
{
|
||||||
return mat_extract_scale(mat);
|
return mat_extract_scale(mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr ViewAngles extract_rotation_angles(const Mat4X4& mat) noexcept
|
constexpr ViewAngles extract_rotation_angles(const Mat4X4& mat) noexcept
|
||||||
{
|
{
|
||||||
const auto angles = mat_extract_rotation_zyx(mat);
|
const auto angles = mat_extract_rotation_zyx(mat);
|
||||||
return {
|
return {
|
||||||
@@ -74,7 +74,7 @@ namespace omath::rage_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Mat4X4
|
constexpr Mat4X4
|
||||||
calc_perspective_projection_matrix(const float field_of_view, const float aspect_ratio, const float near_plane,
|
calc_perspective_projection_matrix(const float field_of_view, const float aspect_ratio, const float near_plane,
|
||||||
const float far_plane,
|
const float far_plane,
|
||||||
const NDCDepthRange ndc_depth_range = NDCDepthRange::ZERO_TO_ONE) noexcept
|
const NDCDepthRange ndc_depth_range = NDCDepthRange::ZERO_TO_ONE) noexcept
|
||||||
|
|||||||
@@ -7,10 +7,10 @@
|
|||||||
namespace omath::source_engine
|
namespace omath::source_engine
|
||||||
{
|
{
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept;
|
constexpr Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> forward_vector(const ViewAngles& angles) noexcept
|
constexpr Vector3<float> forward_vector(const ViewAngles& angles) noexcept
|
||||||
{
|
{
|
||||||
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_forward);
|
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_forward);
|
||||||
|
|
||||||
@@ -18,25 +18,25 @@ namespace omath::source_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept
|
constexpr Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept
|
||||||
{
|
{
|
||||||
return mat_rotation_axis_z(angles.yaw) * mat_rotation_axis_y(angles.pitch) * mat_rotation_axis_x(angles.roll);
|
return mat_rotation_axis_z(angles.yaw) * mat_rotation_axis_y(angles.pitch) * mat_rotation_axis_x(angles.roll);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> extract_origin(const Mat4X4& mat) noexcept
|
constexpr Vector3<float> extract_origin(const Mat4X4& mat) noexcept
|
||||||
{
|
{
|
||||||
return mat_extract_origin(mat);
|
return mat_extract_origin(mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> extract_scale(const Mat4X4& mat) noexcept
|
constexpr Vector3<float> extract_scale(const Mat4X4& mat) noexcept
|
||||||
{
|
{
|
||||||
return mat_extract_scale(mat);
|
return mat_extract_scale(mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr ViewAngles extract_rotation_angles(const Mat4X4& mat) noexcept
|
constexpr ViewAngles extract_rotation_angles(const Mat4X4& mat) noexcept
|
||||||
{
|
{
|
||||||
const auto angles = mat_extract_rotation_zyx(mat);
|
const auto angles = mat_extract_rotation_zyx(mat);
|
||||||
return {
|
return {
|
||||||
@@ -47,7 +47,7 @@ namespace omath::source_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> right_vector(const ViewAngles& angles) noexcept
|
constexpr Vector3<float> right_vector(const ViewAngles& angles) noexcept
|
||||||
{
|
{
|
||||||
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_right);
|
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_right);
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ namespace omath::source_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> up_vector(const ViewAngles& angles) noexcept
|
constexpr Vector3<float> up_vector(const ViewAngles& angles) noexcept
|
||||||
{
|
{
|
||||||
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_up);
|
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_up);
|
||||||
|
|
||||||
@@ -63,13 +63,13 @@ namespace omath::source_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3<float>& cam_origin) noexcept
|
constexpr Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3<float>& cam_origin) noexcept
|
||||||
{
|
{
|
||||||
return mat_camera_view(forward_vector(angles), right_vector(angles), up_vector(angles), cam_origin);
|
return mat_camera_view(forward_vector(angles), right_vector(angles), up_vector(angles), cam_origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Mat4X4 calc_perspective_projection_matrix(
|
constexpr Mat4X4 calc_perspective_projection_matrix(
|
||||||
const float field_of_view, const float aspect_ratio, const float near_plane, const float far_plane,
|
const float field_of_view, const float aspect_ratio, const float near_plane, const float far_plane,
|
||||||
const NDCDepthRange ndc_depth_range = NDCDepthRange::NEGATIVE_ONE_TO_ONE) noexcept
|
const NDCDepthRange ndc_depth_range = NDCDepthRange::NEGATIVE_ONE_TO_ONE) noexcept
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,10 +8,10 @@
|
|||||||
namespace omath::unity_engine
|
namespace omath::unity_engine
|
||||||
{
|
{
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept;
|
constexpr Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> forward_vector(const ViewAngles& angles) noexcept
|
constexpr Vector3<float> forward_vector(const ViewAngles& angles) noexcept
|
||||||
{
|
{
|
||||||
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_forward);
|
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_forward);
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ namespace omath::unity_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> right_vector(const ViewAngles& angles) noexcept
|
constexpr Vector3<float> right_vector(const ViewAngles& angles) noexcept
|
||||||
{
|
{
|
||||||
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_right);
|
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_right);
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ namespace omath::unity_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> up_vector(const ViewAngles& angles) noexcept
|
constexpr Vector3<float> up_vector(const ViewAngles& angles) noexcept
|
||||||
{
|
{
|
||||||
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_up);
|
const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_up);
|
||||||
|
|
||||||
@@ -35,14 +35,14 @@ namespace omath::unity_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3<float>& cam_origin) noexcept
|
constexpr Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3<float>& cam_origin) noexcept
|
||||||
{
|
{
|
||||||
return mat_camera_view<float, MatStoreType::ROW_MAJOR>(-forward_vector(angles), right_vector(angles),
|
return mat_camera_view<float, MatStoreType::ROW_MAJOR>(-forward_vector(angles), right_vector(angles),
|
||||||
up_vector(angles), cam_origin);
|
up_vector(angles), cam_origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept
|
constexpr Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept
|
||||||
{
|
{
|
||||||
return mat_rotation_axis_z<float, MatStoreType::ROW_MAJOR>(angles.roll)
|
return mat_rotation_axis_z<float, MatStoreType::ROW_MAJOR>(angles.roll)
|
||||||
* mat_rotation_axis_y<float, MatStoreType::ROW_MAJOR>(angles.yaw)
|
* mat_rotation_axis_y<float, MatStoreType::ROW_MAJOR>(angles.yaw)
|
||||||
@@ -50,19 +50,19 @@ namespace omath::unity_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> extract_origin(const Mat4X4& mat) noexcept
|
constexpr Vector3<float> extract_origin(const Mat4X4& mat) noexcept
|
||||||
{
|
{
|
||||||
return mat_extract_origin(mat);
|
return mat_extract_origin(mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Vector3<float> extract_scale(const Mat4X4& mat) noexcept
|
constexpr Vector3<float> extract_scale(const Mat4X4& mat) noexcept
|
||||||
{
|
{
|
||||||
return mat_extract_scale(mat);
|
return mat_extract_scale(mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr ViewAngles extract_rotation_angles(const Mat4X4& mat) noexcept
|
constexpr ViewAngles extract_rotation_angles(const Mat4X4& mat) noexcept
|
||||||
{
|
{
|
||||||
const auto angles = mat_extract_rotation_zyx(mat);
|
const auto angles = mat_extract_rotation_zyx(mat);
|
||||||
return {
|
return {
|
||||||
@@ -73,7 +73,7 @@ namespace omath::unity_engine
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline constexpr Mat4X4 calc_perspective_projection_matrix(
|
constexpr Mat4X4 calc_perspective_projection_matrix(
|
||||||
const float field_of_view, const float aspect_ratio, const float near_plane, const float far_plane,
|
const float field_of_view, const float aspect_ratio, const float near_plane, const float far_plane,
|
||||||
const NDCDepthRange ndc_depth_range = NDCDepthRange::NEGATIVE_ONE_TO_ONE) noexcept
|
const NDCDepthRange ndc_depth_range = NDCDepthRange::NEGATIVE_ONE_TO_ONE) noexcept
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user