mirror of
https://github.com/orange-cpp/omath.git
synced 2026-04-18 20:43:27 +00:00
added as_vector3 to view angles
This commit is contained in:
@@ -405,3 +405,51 @@ TEST(unit_test_frostbite_engine, look_at_down)
|
||||
std::views::zip(dir_vector.as_array(), (-omath::frostbite_engine::k_abs_up).as_array()))
|
||||
EXPECT_NEAR(result, etalon, 0.0001f);
|
||||
}
|
||||
|
||||
TEST(unit_test_frostbite_engine, ViewAnglesAsVector3Zero)
|
||||
{
|
||||
const omath::frostbite_engine::ViewAngles angles{};
|
||||
const auto vec = angles.as_vector3();
|
||||
|
||||
EXPECT_FLOAT_EQ(vec.x, 0.f);
|
||||
EXPECT_FLOAT_EQ(vec.y, 0.f);
|
||||
EXPECT_FLOAT_EQ(vec.z, 0.f);
|
||||
}
|
||||
|
||||
TEST(unit_test_frostbite_engine, ViewAnglesAsVector3Values)
|
||||
{
|
||||
const omath::frostbite_engine::ViewAngles angles{
|
||||
omath::frostbite_engine::PitchAngle::from_degrees(45.f),
|
||||
omath::frostbite_engine::YawAngle::from_degrees(-90.f),
|
||||
omath::frostbite_engine::RollAngle::from_degrees(30.f)
|
||||
};
|
||||
const auto vec = angles.as_vector3();
|
||||
|
||||
EXPECT_FLOAT_EQ(vec.x, 45.f);
|
||||
EXPECT_FLOAT_EQ(vec.y, -90.f);
|
||||
EXPECT_FLOAT_EQ(vec.z, 30.f);
|
||||
}
|
||||
|
||||
TEST(unit_test_frostbite_engine, ViewAnglesAsVector3ClampedPitch)
|
||||
{
|
||||
const omath::frostbite_engine::ViewAngles angles{
|
||||
omath::frostbite_engine::PitchAngle::from_degrees(120.f),
|
||||
omath::frostbite_engine::YawAngle::from_degrees(0.f),
|
||||
omath::frostbite_engine::RollAngle::from_degrees(0.f)
|
||||
};
|
||||
const auto vec = angles.as_vector3();
|
||||
|
||||
EXPECT_FLOAT_EQ(vec.x, 90.f);
|
||||
}
|
||||
|
||||
TEST(unit_test_frostbite_engine, ViewAnglesAsVector3NormalizedYaw)
|
||||
{
|
||||
const omath::frostbite_engine::ViewAngles angles{
|
||||
omath::frostbite_engine::PitchAngle::from_degrees(0.f),
|
||||
omath::frostbite_engine::YawAngle::from_degrees(270.f),
|
||||
omath::frostbite_engine::RollAngle::from_degrees(0.f)
|
||||
};
|
||||
const auto vec = angles.as_vector3();
|
||||
|
||||
EXPECT_NEAR(vec.y, -90.f, 0.01f);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user