mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 07:03:25 +00:00
fixed unity
This commit is contained in:
@@ -30,9 +30,9 @@ namespace omath::unity_engine
|
|||||||
}
|
}
|
||||||
Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept
|
Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept
|
||||||
{
|
{
|
||||||
return mat_rotation_axis_x<float, MatStoreType::ROW_MAJOR>(angles.pitch)
|
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)
|
||||||
* mat_rotation_axis_z<float, MatStoreType::ROW_MAJOR>(angles.roll);
|
* mat_rotation_axis_x<float, MatStoreType::ROW_MAJOR>(angles.pitch);
|
||||||
}
|
}
|
||||||
Mat4X4 calc_perspective_projection_matrix(const float field_of_view, const float aspect_ratio, const float near,
|
Mat4X4 calc_perspective_projection_matrix(const float field_of_view, const float aspect_ratio, const float near,
|
||||||
const float far) noexcept
|
const float far) noexcept
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ namespace omath::unity_engine
|
|||||||
ViewAngles CameraTrait::calc_look_at_angle(const Vector3<float>& cam_origin, const Vector3<float>& look_at) noexcept
|
ViewAngles CameraTrait::calc_look_at_angle(const Vector3<float>& cam_origin, const Vector3<float>& look_at) noexcept
|
||||||
{
|
{
|
||||||
const auto distance = cam_origin.distance_to(look_at);
|
const auto distance = cam_origin.distance_to(look_at);
|
||||||
const auto delta = cam_origin - look_at;
|
const auto delta = look_at - cam_origin;
|
||||||
|
|
||||||
return {PitchAngle::from_radians(-std::asin(delta.y / distance)),
|
return {PitchAngle::from_radians(-std::asin(delta.y / distance)),
|
||||||
YawAngle::from_radians(std::atan2(delta.z, delta.x)), RollAngle::from_radians(0.f)};
|
YawAngle::from_radians(std::atan2(delta.x, delta.z)), RollAngle::from_radians(0.f)};
|
||||||
}
|
}
|
||||||
Mat4X4 CameraTrait::calc_view_matrix(const ViewAngles& angles, const Vector3<float>& cam_origin) noexcept
|
Mat4X4 CameraTrait::calc_view_matrix(const ViewAngles& angles, const Vector3<float>& cam_origin) noexcept
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user