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