core, android: add support for camera roll (#3011)
This commit is contained in:
@@ -180,8 +180,8 @@ TEST(FreeCameraOptions, LookAtPoint) {
|
||||
ASSERT_TRUE(options.orientation);
|
||||
std::tie(right, up, forward) = rotatedFrame(options.orientation.value());
|
||||
|
||||
ASSERT_THAT(right, Vec3NearEquals1E7(vec3{{0.0, 1.0, 0.0}}));
|
||||
ASSERT_THAT(up, Vec3NearEquals1E7(vec3{{0.0, 0.0, 1.0}}));
|
||||
ASSERT_THAT(right, Vec3NearEquals1E7(vec3{{0.0, 0.9714568644195829, 0.2372162738348117}}));
|
||||
ASSERT_THAT(up, Vec3NearEquals1E7(vec3{{0.0, -0.23721627383481167, 0.97145686441958301}}));
|
||||
ASSERT_THAT(forward, Vec3NearEquals1E7(vec3{{1.0, 0.0, 0.0}}));
|
||||
|
||||
// Up vector pointing downwards
|
||||
@@ -226,18 +226,18 @@ TEST(FreeCameraOptions, LookAtPointInvalidInput) {
|
||||
ASSERT_FALSE(options.orientation);
|
||||
}
|
||||
|
||||
TEST(FreeCameraOptions, SetPitchBearing) {
|
||||
TEST(FreeCameraOptions, SetRollPitchBearing) {
|
||||
FreeCameraOptions options;
|
||||
vec3 right, up, forward;
|
||||
|
||||
options.setPitchBearing(0.0, 0.0);
|
||||
options.setRollPitchBearing(0.0, 0.0, 0.0);
|
||||
ASSERT_TRUE(options.orientation);
|
||||
std::tie(right, up, forward) = rotatedFrame(options.orientation.value());
|
||||
ASSERT_THAT(right, Vec3NearEquals1E7(vec3{{1.0, 0.0, 0.0}}));
|
||||
ASSERT_THAT(up, Vec3NearEquals1E7(vec3{{0.0, -1.0, 0.0}}));
|
||||
ASSERT_THAT(forward, Vec3NearEquals1E7(vec3{{0.0, 0.0, -1.0}}));
|
||||
|
||||
options.setPitchBearing(0.0, 180.0);
|
||||
options.setRollPitchBearing(0.0, 0.0, 180.0);
|
||||
ASSERT_TRUE(options.orientation);
|
||||
std::tie(right, up, forward) = rotatedFrame(options.orientation.value());
|
||||
ASSERT_THAT(right, Vec3NearEquals1E7(vec3{{-1.0, 0.0, 0.0}}));
|
||||
@@ -247,14 +247,14 @@ TEST(FreeCameraOptions, SetPitchBearing) {
|
||||
const double cos60 = std::cos(util::deg2rad(60.0));
|
||||
const double sin60 = std::sin(util::deg2rad(60.0));
|
||||
|
||||
options.setPitchBearing(60.0, 0.0);
|
||||
options.setRollPitchBearing(0.0, 60.0, 0.0);
|
||||
ASSERT_TRUE(options.orientation);
|
||||
std::tie(right, up, forward) = rotatedFrame(options.orientation.value());
|
||||
ASSERT_THAT(right, Vec3NearEquals1E7(vec3{{1.0, 0.0, 0.0}}));
|
||||
ASSERT_THAT(up, Vec3NearEquals1E7(vec3{{0.0, -cos60, sin60}}));
|
||||
ASSERT_THAT(forward, Vec3NearEquals1E7(vec3{{0.0, -sin60, -cos60}}));
|
||||
|
||||
options.setPitchBearing(60.0, -450);
|
||||
options.setRollPitchBearing(0.0, 60.0, -450);
|
||||
ASSERT_TRUE(options.orientation);
|
||||
std::tie(right, up, forward) = rotatedFrame(options.orientation.value());
|
||||
ASSERT_THAT(right, Vec3NearEquals1E7(vec3{{0.0, 1.0, 0.0}}));
|
||||
|
||||
@@ -78,9 +78,8 @@ TEST(TileCover, PitchOverAllowedByContentInsets) {
|
||||
// Top padding of 376 leads to capped pitch. See Transform::getMaxPitchForEdgeInsets.
|
||||
EXPECT_LE(transform.getPitch() + 0.001, util::deg2rad(60));
|
||||
|
||||
EXPECT_EQ(
|
||||
(std::vector<OverscaledTileID>{{3, 4, 3}, {3, 3, 3}, {3, 4, 4}, {3, 3, 4}, {3, 4, 2}, {3, 5, 3}, {3, 5, 2}}),
|
||||
util::tileCover({transform.getState()}, 3));
|
||||
EXPECT_EQ((std::vector<OverscaledTileID>{{3, 4, 3}, {3, 3, 3}, {3, 4, 4}, {3, 3, 4}}),
|
||||
util::tileCover({transform.getState()}, 3));
|
||||
}
|
||||
|
||||
TEST(TileCover, PitchWithLargerResultSet) {
|
||||
@@ -102,17 +101,17 @@ TEST(TileCover, PitchWithLargerResultSet) {
|
||||
EXPECT_EQ((std::vector<OverscaledTileID>{{5, 15, 16},
|
||||
{5, 15, 17},
|
||||
{5, 14, 16},
|
||||
{5, 14, 17},
|
||||
{5, 16, 16},
|
||||
{5, 16, 17},
|
||||
{5, 15, 15},
|
||||
{5, 14, 17},
|
||||
{5, 16, 17},
|
||||
{5, 14, 15},
|
||||
{5, 15, 18},
|
||||
{5, 14, 18},
|
||||
{5, 16, 15},
|
||||
{5, 15, 18},
|
||||
{5, 13, 16},
|
||||
{5, 13, 17},
|
||||
{5, 14, 18},
|
||||
{5, 16, 18},
|
||||
{5, 13, 17},
|
||||
{5, 13, 18},
|
||||
{5, 15, 19}}),
|
||||
(std::vector<OverscaledTileID>{cover.begin(), cover.begin() + 16}));
|
||||
|
||||
Reference in New Issue
Block a user