mirror of
https://github.com/orange-cpp/omath.git
synced 2026-08-07 21:42:05 +00:00
improvement
This commit is contained in:
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "omath/engines/cry_engine/formulas.hpp"
|
#include "omath/engines/cry_engine/formulas.hpp"
|
||||||
#include "omath/internal/constexpr_math.hpp"
|
|
||||||
#include "omath/projection/camera.hpp"
|
#include "omath/projection/camera.hpp"
|
||||||
namespace omath::cry_engine
|
namespace omath::cry_engine
|
||||||
{
|
{
|
||||||
@@ -16,8 +15,8 @@ namespace omath::cry_engine
|
|||||||
const Vector3<float>& look_at) noexcept
|
const Vector3<float>& look_at) noexcept
|
||||||
{
|
{
|
||||||
const auto direction = (look_at - cam_origin).normalized();
|
const auto direction = (look_at - cam_origin).normalized();
|
||||||
return {PitchAngle::from_radians(internal::asin(direction.z)),
|
return {PitchAngle::from_asin(direction.z), -YawAngle::from_atan2(direction.x, direction.y),
|
||||||
YawAngle::from_radians(-internal::atan2(direction.x, direction.y)), RollAngle::from_radians(0.f)};
|
RollAngle::from_radians(0.f)};
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard("view matrix result should not be discarded")]]
|
[[nodiscard("view matrix result should not be discarded")]]
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "omath/engines/frostbite_engine/formulas.hpp"
|
#include "omath/engines/frostbite_engine/formulas.hpp"
|
||||||
#include "omath/internal/constexpr_math.hpp"
|
|
||||||
#include "omath/projection/camera.hpp"
|
#include "omath/projection/camera.hpp"
|
||||||
|
|
||||||
namespace omath::frostbite_engine
|
namespace omath::frostbite_engine
|
||||||
@@ -18,8 +17,8 @@ namespace omath::frostbite_engine
|
|||||||
{
|
{
|
||||||
const auto direction = (look_at - cam_origin).normalized();
|
const auto direction = (look_at - cam_origin).normalized();
|
||||||
|
|
||||||
return {PitchAngle::from_radians(-internal::asin(direction.y)),
|
return {-PitchAngle::from_asin(direction.y), YawAngle::from_atan2(direction.x, direction.z),
|
||||||
YawAngle::from_radians(internal::atan2(direction.x, direction.z)), RollAngle::from_radians(0.f)};
|
RollAngle::from_radians(0.f)};
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard("view matrix result should not be discarded")]]
|
[[nodiscard("view matrix result should not be discarded")]]
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "omath/engines/iw_engine/formulas.hpp"
|
#include "omath/engines/iw_engine/formulas.hpp"
|
||||||
#include "omath/internal/constexpr_math.hpp"
|
|
||||||
#include "omath/projection/camera.hpp"
|
#include "omath/projection/camera.hpp"
|
||||||
|
|
||||||
namespace omath::iw_engine
|
namespace omath::iw_engine
|
||||||
@@ -18,8 +17,8 @@ namespace omath::iw_engine
|
|||||||
{
|
{
|
||||||
const auto direction = (look_at - cam_origin).normalized();
|
const auto direction = (look_at - cam_origin).normalized();
|
||||||
|
|
||||||
return {PitchAngle::from_radians(-internal::asin(direction.z)),
|
return {-PitchAngle::from_asin(direction.z), YawAngle::from_atan2(direction.y, direction.x),
|
||||||
YawAngle::from_radians(internal::atan2(direction.y, direction.x)), RollAngle::from_radians(0.f)};
|
RollAngle::from_radians(0.f)};
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard("view matrix result should not be discarded")]]
|
[[nodiscard("view matrix result should not be discarded")]]
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "omath/engines/opengl_engine/formulas.hpp"
|
#include "omath/engines/opengl_engine/formulas.hpp"
|
||||||
#include "omath/internal/constexpr_math.hpp"
|
|
||||||
#include "omath/projection/camera.hpp"
|
#include "omath/projection/camera.hpp"
|
||||||
|
|
||||||
namespace omath::opengl_engine
|
namespace omath::opengl_engine
|
||||||
@@ -18,8 +17,8 @@ namespace omath::opengl_engine
|
|||||||
{
|
{
|
||||||
const auto direction = (look_at - cam_origin).normalized();
|
const auto direction = (look_at - cam_origin).normalized();
|
||||||
|
|
||||||
return {PitchAngle::from_radians(internal::asin(direction.y)),
|
return {PitchAngle::from_asin(direction.y), -YawAngle::from_atan2(direction.x, -direction.z),
|
||||||
YawAngle::from_radians(-internal::atan2(direction.x, -direction.z)), RollAngle::from_radians(0.f)};
|
RollAngle::from_radians(0.f)};
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard("view matrix result should not be discarded")]]
|
[[nodiscard("view matrix result should not be discarded")]]
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "omath/engines/rage_engine/formulas.hpp"
|
#include "omath/engines/rage_engine/formulas.hpp"
|
||||||
#include "omath/internal/constexpr_math.hpp"
|
|
||||||
#include "omath/projection/camera.hpp"
|
#include "omath/projection/camera.hpp"
|
||||||
|
|
||||||
namespace omath::rage_engine
|
namespace omath::rage_engine
|
||||||
@@ -18,8 +17,8 @@ namespace omath::rage_engine
|
|||||||
{
|
{
|
||||||
const auto direction = (look_at - cam_origin).normalized();
|
const auto direction = (look_at - cam_origin).normalized();
|
||||||
|
|
||||||
return {PitchAngle::from_radians(internal::asin(direction.z)),
|
return {PitchAngle::from_asin(direction.z), -YawAngle::from_atan2(direction.x, direction.y),
|
||||||
YawAngle::from_radians(-internal::atan2(direction.x, direction.y)), RollAngle::from_radians(0.f)};
|
RollAngle::from_radians(0.f)};
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard("view matrix result should not be discarded")]]
|
[[nodiscard("view matrix result should not be discarded")]]
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "omath/engines/source_engine/formulas.hpp"
|
#include "omath/engines/source_engine/formulas.hpp"
|
||||||
#include "omath/internal/constexpr_math.hpp"
|
|
||||||
#include "omath/projection/camera.hpp"
|
#include "omath/projection/camera.hpp"
|
||||||
|
|
||||||
namespace omath::source_engine
|
namespace omath::source_engine
|
||||||
@@ -18,8 +17,8 @@ namespace omath::source_engine
|
|||||||
{
|
{
|
||||||
const auto direction = (look_at - cam_origin).normalized();
|
const auto direction = (look_at - cam_origin).normalized();
|
||||||
|
|
||||||
return {PitchAngle::from_radians(-internal::asin(direction.z)),
|
return {-PitchAngle::from_asin(direction.z),
|
||||||
YawAngle::from_radians(internal::atan2(direction.y, direction.x)), RollAngle::from_radians(0.f)};
|
YawAngle::from_atan2(direction.y, direction.x), RollAngle::from_radians(0.f)};
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard("view matrix result should not be discarded")]]
|
[[nodiscard("view matrix result should not be discarded")]]
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "omath/engines/unity_engine/formulas.hpp"
|
#include "omath/engines/unity_engine/formulas.hpp"
|
||||||
#include "omath/internal/constexpr_math.hpp"
|
|
||||||
#include "omath/projection/camera.hpp"
|
#include "omath/projection/camera.hpp"
|
||||||
|
|
||||||
namespace omath::unity_engine
|
namespace omath::unity_engine
|
||||||
@@ -18,8 +17,8 @@ namespace omath::unity_engine
|
|||||||
{
|
{
|
||||||
const auto direction = (look_at - cam_origin).normalized();
|
const auto direction = (look_at - cam_origin).normalized();
|
||||||
|
|
||||||
return {PitchAngle::from_radians(-internal::asin(direction.y)),
|
return {-PitchAngle::from_asin(direction.y), YawAngle::from_atan2(direction.x, direction.z),
|
||||||
YawAngle::from_radians(internal::atan2(direction.x, direction.z)), RollAngle::from_radians(0.f)};
|
RollAngle::from_radians(0.f)};
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard("view matrix result should not be discarded")]]
|
[[nodiscard("view matrix result should not be discarded")]]
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "omath/engines/unreal_engine/formulas.hpp"
|
#include "omath/engines/unreal_engine/formulas.hpp"
|
||||||
#include "omath/internal/constexpr_math.hpp"
|
|
||||||
#include "omath/projection/camera.hpp"
|
#include "omath/projection/camera.hpp"
|
||||||
|
|
||||||
namespace omath::unreal_engine
|
namespace omath::unreal_engine
|
||||||
@@ -18,8 +17,8 @@ namespace omath::unreal_engine
|
|||||||
{
|
{
|
||||||
const auto direction = (look_at - cam_origin).normalized();
|
const auto direction = (look_at - cam_origin).normalized();
|
||||||
|
|
||||||
return {PitchAngle::from_radians(internal::asin(direction.z)),
|
return {PitchAngle::from_asin(direction.z), YawAngle::from_atan2(direction.y, direction.x),
|
||||||
YawAngle::from_radians(internal::atan2(direction.y, direction.x)), RollAngle::from_radians(0.f)};
|
RollAngle::from_radians(0.f)};
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard("view matrix result should not be discarded")]]
|
[[nodiscard("view matrix result should not be discarded")]]
|
||||||
|
|||||||
Reference in New Issue
Block a user