mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 07:03:25 +00:00
changed code style
This commit is contained in:
@@ -4,34 +4,32 @@
|
||||
#include "omath/engines/source_engine/camera.hpp"
|
||||
#include "omath/engines/source_engine/formulas.hpp"
|
||||
|
||||
|
||||
namespace omath::source_engine
|
||||
{
|
||||
|
||||
Camera::Camera(const Vector3<float>& position, const ViewAngles& viewAngles, const projection::ViewPort& viewPort,
|
||||
const projection::FieldOfView& fov, const float near, const float far) :
|
||||
projection::Camera<Mat4x4, ViewAngles>(position, viewAngles, viewPort, fov, near, far)
|
||||
Camera::Camera(const Vector3<float>& position, const ViewAngles& view_angles, const projection::ViewPort& view_port,
|
||||
const projection::FieldOfView& fov, const float near, const float far)
|
||||
: projection::Camera<Mat4X4, ViewAngles>(position, view_angles, view_port, fov, near, far)
|
||||
{
|
||||
}
|
||||
void Camera::LookAt(const Vector3<float>& target)
|
||||
void Camera::look_at(const Vector3<float>& target)
|
||||
{
|
||||
const float distance = m_origin.DistTo(target);
|
||||
const float distance = m_origin.distance_to(target);
|
||||
const auto delta = target - m_origin;
|
||||
|
||||
|
||||
m_viewAngles.pitch = PitchAngle::FromRadians(std::asin(delta.z / distance));
|
||||
m_viewAngles.yaw = -YawAngle::FromRadians(std::atan2(delta.y, delta.x));
|
||||
m_viewAngles.roll = RollAngle::FromRadians(0.f);
|
||||
m_view_angles.pitch = PitchAngle::from_radians(std::asin(delta.z / distance));
|
||||
m_view_angles.yaw = -YawAngle::from_radians(std::atan2(delta.y, delta.x));
|
||||
m_view_angles.roll = RollAngle::from_radians(0.f);
|
||||
}
|
||||
|
||||
Mat4x4 Camera::CalcViewMatrix() const
|
||||
Mat4X4 Camera::calc_view_matrix() const
|
||||
{
|
||||
return source_engine::CalcViewMatrix(m_viewAngles, m_origin);
|
||||
return source_engine::calc_view_matrix(m_view_angles, m_origin);
|
||||
}
|
||||
|
||||
Mat4x4 Camera::CalcProjectionMatrix() const
|
||||
Mat4X4 Camera::calc_projection_matrix() const
|
||||
{
|
||||
return CalcPerspectiveProjectionMatrix(m_fieldOfView.AsDegrees(), m_viewPort.AspectRatio(), m_nearPlaneDistance,
|
||||
m_farPlaneDistance);
|
||||
return calc_perspective_projection_matrix(m_field_of_view.as_degrees(), m_view_port.AspectRatio(),
|
||||
m_near_plane_distance, m_far_plane_distance);
|
||||
}
|
||||
} // namespace omath::source
|
||||
} // namespace omath::source_engine
|
||||
|
||||
Reference in New Issue
Block a user