added camera

This commit is contained in:
2024-08-27 10:28:07 +03:00
parent c662504291
commit db57dfd5f9
8 changed files with 153 additions and 6 deletions

View File

@@ -219,7 +219,12 @@ namespace omath
const auto sinYaw = std::sin(angles::DegreesToRadians(yaw));
return {cosPitch*cosYaw, cosPitch*sinYaw, sinPitch};
return
{
cosPitch*cosYaw,
cosPitch*sinYaw,
sinPitch
};
}
Vector3 Vector3::RightVector(const float pitch, const float yaw, const float roll)
@@ -230,13 +235,33 @@ namespace omath
const auto cosYaw = std::cos(angles::DegreesToRadians(yaw));
const auto sinYaw = std::sin(angles::DegreesToRadians(yaw));
const auto cosRoll = std::cos(angles::DegreesToRadians(yaw));
const auto sinRoll = std::sin(angles::DegreesToRadians(yaw));
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};
-sinRoll*cosPitch};
}
Vector3 Vector3::UpVector(float pitch, float yaw, float roll)
{
const auto cosPitch = std::cos(angles::DegreesToRadians(pitch));
const auto sinPitch = std::sin(angles::DegreesToRadians(pitch));
const auto cosYaw = std::cos(angles::DegreesToRadians(yaw));
const auto sinYaw = std::sin(angles::DegreesToRadians(yaw));
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,
};
}
Vector3 Vector3::Cross(const Vector3 &v) const