mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 07:03:25 +00:00
added unit test
This commit is contained in:
@@ -238,10 +238,12 @@ namespace omath
|
||||
const auto cosRoll = std::cos(angles::DegreesToRadians(roll));
|
||||
const auto sinRoll = std::sin(angles::DegreesToRadians(roll));
|
||||
|
||||
|
||||
return {-sinRoll*sinPitch*cosYaw + -cosRoll*-sinYaw,
|
||||
-sinRoll*sinPitch*sinYaw + -cosRoll*cosYaw,
|
||||
-sinRoll*cosPitch};
|
||||
// Right vector calculation
|
||||
return {
|
||||
cosYaw * cosRoll - sinYaw * sinPitch * sinRoll, // X component
|
||||
sinRoll * cosPitch, // Y component
|
||||
sinYaw * cosRoll + cosYaw * sinPitch * sinRoll // Z component
|
||||
};
|
||||
}
|
||||
|
||||
Vector3 Vector3::UpVector(float pitch, float yaw, float roll)
|
||||
@@ -255,12 +257,11 @@ namespace omath
|
||||
const auto cosRoll = std::cos(angles::DegreesToRadians(roll));
|
||||
const auto sinRoll = std::sin(angles::DegreesToRadians(roll));
|
||||
|
||||
|
||||
return
|
||||
{
|
||||
cosRoll*sinPitch*cosYaw+-sinRoll*-sinYaw,
|
||||
cosRoll*sinPitch*cosYaw+-sinRoll*-sinYaw,
|
||||
cosRoll*cosPitch,
|
||||
// Up vector calculation
|
||||
return {
|
||||
-sinRoll * cosYaw + cosRoll * sinPitch * sinYaw, // X component
|
||||
cosRoll * cosPitch, // Y component
|
||||
-sinRoll * sinYaw - cosRoll * sinPitch * cosYaw // Z component
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,17 @@
|
||||
|
||||
namespace omath::projection
|
||||
{
|
||||
Camera::Camera(const Vector3 &position, const Vector3 &viewAngles, const Vector3 &viewPort, const float fov, const float near,
|
||||
const float far)
|
||||
{
|
||||
m_origin = position;
|
||||
m_viewAngles = viewAngles;
|
||||
m_viewPort = viewPort;
|
||||
m_fieldOfView = fov;
|
||||
m_nearPlaneDistance = near;
|
||||
m_farPlaneDistance = far;
|
||||
}
|
||||
|
||||
Matrix Camera::GetViewMatrix() const
|
||||
{
|
||||
return GetOrientationMatrix() * GetTranslationMatrix();
|
||||
|
||||
Reference in New Issue
Block a user