mirror of
https://github.com/orange-cpp/omath.git
synced 2026-06-12 02:04:35 +00:00
patch
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
namespace omath::cry_engine
|
namespace omath::cry_engine
|
||||||
{
|
{
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
OMATH_CONSTEXPR Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept
|
inline OMATH_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]]
|
||||||
OMATH_CONSTEXPR Vector3<float> forward_vector(const ViewAngles& angles) noexcept
|
inline OMATH_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]]
|
||||||
OMATH_CONSTEXPR Vector3<float> right_vector(const ViewAngles& angles) noexcept
|
inline OMATH_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]]
|
||||||
OMATH_CONSTEXPR Vector3<float> up_vector(const ViewAngles& angles) noexcept
|
inline OMATH_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]]
|
||||||
OMATH_CONSTEXPR Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3<float>& cam_origin) noexcept
|
inline OMATH_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]]
|
||||||
OMATH_CONSTEXPR Vector3<float> extract_origin(const Mat4X4& mat) noexcept
|
inline OMATH_CONSTEXPR Vector3<float> extract_origin(const Mat4X4& mat) noexcept
|
||||||
{
|
{
|
||||||
return mat_extract_origin(mat);
|
return mat_extract_origin(mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
OMATH_CONSTEXPR Vector3<float> extract_scale(const Mat4X4& mat) noexcept
|
inline OMATH_CONSTEXPR Vector3<float> extract_scale(const Mat4X4& mat) noexcept
|
||||||
{
|
{
|
||||||
return mat_extract_scale(mat);
|
return mat_extract_scale(mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
OMATH_CONSTEXPR ViewAngles extract_rotation_angles(const Mat4X4& mat) noexcept
|
inline OMATH_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,8 +69,7 @@ namespace omath::cry_engine
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
OMATH_CONSTEXPR Mat4X4
|
inline OMATH_CONSTEXPR Mat4X4 calc_perspective_projection_matrix(
|
||||||
calc_perspective_projection_matrix(
|
|
||||||
const float field_of_view, const float aspect_ratio, const float near, const float far,
|
const float field_of_view, const float aspect_ratio, const float near, const float far,
|
||||||
const NDCDepthRange ndc_depth_range = NDCDepthRange::ZERO_TO_ONE) noexcept
|
const NDCDepthRange ndc_depth_range = NDCDepthRange::ZERO_TO_ONE) noexcept
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user