From 5b1d6917efa67f6f0209cf2460f7fd5c66354248 Mon Sep 17 00:00:00 2001 From: elsid Date: Mon, 12 Sep 2022 18:06:08 +0200 Subject: [PATCH] Add comments to prevent line splitting on formatting --- .../detournavigator/navigator.cpp | 224 +++++++++--------- .../detournavigator/recastmeshbuilder.cpp | 214 ++++++++--------- 2 files changed, 215 insertions(+), 223 deletions(-) diff --git a/apps/openmw_test_suite/detournavigator/navigator.cpp b/apps/openmw_test_suite/detournavigator/navigator.cpp index 23df6c1e93..1fe0cfebf7 100644 --- a/apps/openmw_test_suite/detournavigator/navigator.cpp +++ b/apps/openmw_test_suite/detournavigator/navigator.cpp @@ -145,11 +145,11 @@ namespace TEST_F(DetourNavigatorNavigatorTest, update_then_find_path_should_return_path) { constexpr std::array heightfieldData {{ - 0, 0, 0, 0, 0, - 0, -25, -25, -25, -25, - 0, -25, -100, -100, -100, - 0, -25, -100, -100, -100, - 0, -25, -100, -100, -100, + 0, 0, 0, 0, 0, // row 0 + 0, -25, -25, -25, -25, // row 1 + 0, -25, -100, -100, -100, // row 2 + 0, -25, -100, -100, -100, // row 3 + 0, -25, -100, -100, -100, // row 4 }}; const HeightfieldSurface surface = makeSquareHeightfieldSurface(heightfieldData); const int cellSize = mHeightfieldTileSize * (surface.mSize - 1); @@ -196,11 +196,11 @@ namespace mNavigator.reset(new NavigatorImpl(mSettings, std::make_unique(":memory:", std::numeric_limits::max()))); const std::array heightfieldData {{ - 0, 0, 0, 0, 0, - 0, -25, -25, -25, -25, - 0, -25, -100, -100, -100, - 0, -25, -100, -100, -100, - 0, -25, -100, -100, -100, + 0, 0, 0, 0, 0, // row 0 + 0, -25, -25, -25, -25, // row 1 + 0, -25, -100, -100, -100, // row 2 + 0, -25, -100, -100, -100, // row 3 + 0, -25, -100, -100, -100, // row 4 }}; const HeightfieldSurface surface = makeSquareHeightfieldSurface(heightfieldData); const int cellSize = mHeightfieldTileSize * (surface.mSize - 1); @@ -283,11 +283,11 @@ namespace TEST_F(DetourNavigatorNavigatorTest, update_changed_object_should_change_navmesh) { const std::array heightfieldData {{ - 0, 0, 0, 0, 0, - 0, -25, -25, -25, -25, - 0, -25, -100, -100, -100, - 0, -25, -100, -100, -100, - 0, -25, -100, -100, -100, + 0, 0, 0, 0, 0, // row 0 + 0, -25, -25, -25, -25, // row 1 + 0, -25, -100, -100, -100, // row 2 + 0, -25, -100, -100, -100, // row 3 + 0, -25, -100, -100, -100, // row 4 }}; const HeightfieldSurface surface = makeSquareHeightfieldSurface(heightfieldData); const int cellSize = mHeightfieldTileSize * (surface.mSize - 1); @@ -370,21 +370,21 @@ namespace TEST_F(DetourNavigatorNavigatorTest, for_overlapping_heightfields_objects_should_use_higher) { const std::array heightfieldData1 {{ - 0, 0, 0, 0, 0, - 0, -25, -25, -25, -25, - 0, -25, -100, -100, -100, - 0, -25, -100, -100, -100, - 0, -25, -100, -100, -100, + 0, 0, 0, 0, 0, // row 0 + 0, -25, -25, -25, -25, // row 1 + 0, -25, -100, -100, -100, // row 2 + 0, -25, -100, -100, -100, // row 3 + 0, -25, -100, -100, -100, // row 4 }}; CollisionShapeInstance heightfield1(makeSquareHeightfieldTerrainShape(heightfieldData1)); heightfield1.shape().setLocalScaling(btVector3(128, 128, 1)); const std::array heightfieldData2 {{ - -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, // row 0 + -25, -25, -25, -25, -25, // row 1 + -25, -25, -25, -25, -25, // row 2 + -25, -25, -25, -25, -25, // row 3 + -25, -25, -25, -25, -25, // row 4 }}; CollisionShapeInstance heightfield2(makeSquareHeightfieldTerrainShape(heightfieldData2)); heightfield2.shape().setLocalScaling(btVector3(128, 128, 1)); @@ -427,21 +427,21 @@ namespace TEST_F(DetourNavigatorNavigatorTest, only_one_heightfield_per_cell_is_allowed) { const std::array heightfieldData1 {{ - 0, 0, 0, 0, 0, - 0, -25, -25, -25, -25, - 0, -25, -100, -100, -100, - 0, -25, -100, -100, -100, - 0, -25, -100, -100, -100, + 0, 0, 0, 0, 0, // row 0 + 0, -25, -25, -25, -25, // row 1 + 0, -25, -100, -100, -100, // row 2 + 0, -25, -100, -100, -100, // row 3 + 0, -25, -100, -100, -100, // row 4 }}; const HeightfieldSurface surface1 = makeSquareHeightfieldSurface(heightfieldData1); const int cellSize1 = mHeightfieldTileSize * (surface1.mSize - 1); const std::array heightfieldData2 {{ - -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, // row 0 + -25, -25, -25, -25, -25, // row 1 + -25, -25, -25, -25, -25, // row 2 + -25, -25, -25, -25, -25, // row 3 + -25, -25, -25, -25, -25, // row 4 }}; const HeightfieldSurface surface2 = makeSquareHeightfieldSurface(heightfieldData2); const int cellSize2 = mHeightfieldTileSize * (surface2.mSize - 1); @@ -465,22 +465,22 @@ namespace osg::ref_ptr bulletShape(new Resource::BulletShape); std::array heightfieldData {{ - 0, 0, 0, 0, 0, - 0, -25, -25, -25, -25, - 0, -25, -100, -100, -100, - 0, -25, -100, -100, -100, - 0, -25, -100, -100, -100, + 0, 0, 0, 0, 0, // row 0 + 0, -25, -25, -25, -25, // row 1 + 0, -25, -100, -100, -100, // row 2 + 0, -25, -100, -100, -100, // row 3 + 0, -25, -100, -100, -100, // row 4 }}; std::unique_ptr shapePtr = makeSquareHeightfieldTerrainShape(heightfieldData); shapePtr->setLocalScaling(btVector3(128, 128, 1)); bulletShape->mCollisionShape.reset(shapePtr.release()); std::array heightfieldDataAvoid {{ - -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, - -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, // row 0 + -25, -25, -25, -25, -25, // row 1 + -25, -25, -25, -25, -25, // row 2 + -25, -25, -25, -25, -25, // row 3 + -25, -25, -25, -25, -25, // row 4 }}; std::unique_ptr shapeAvoidPtr = makeSquareHeightfieldTerrainShape(heightfieldDataAvoid); shapeAvoidPtr->setLocalScaling(btVector3(128, 128, 1)); @@ -526,11 +526,11 @@ namespace TEST_F(DetourNavigatorNavigatorTest, path_should_be_over_water_ground_lower_than_water_with_only_swim_flag) { std::array heightfieldData {{ - -50, -50, -50, -50, 0, - -50, -100, -150, -100, -50, - -50, -150, -200, -150, -100, - -50, -100, -150, -100, -100, - 0, -50, -100, -100, -100, + -50, -50, -50, -50, 0, // row 0 + -50, -100, -150, -100, -50, // row 1 + -50, -150, -200, -150, -100, // row 2 + -50, -100, -150, -100, -100, // row 3 + 0, -50, -100, -100, -100, // row 4 }}; const HeightfieldSurface surface = makeSquareHeightfieldSurface(heightfieldData); const int cellSize = mHeightfieldTileSize * (surface.mSize - 1); @@ -572,13 +572,13 @@ namespace TEST_F(DetourNavigatorNavigatorTest, path_should_be_over_water_when_ground_cross_water_with_swim_and_walk_flags) { std::array heightfieldData {{ - 0, 0, 0, 0, 0, 0, 0, - 0, -100, -100, -100, -100, -100, 0, - 0, -100, -150, -150, -150, -100, 0, - 0, -100, -150, -200, -150, -100, 0, - 0, -100, -150, -150, -150, -100, 0, - 0, -100, -100, -100, -100, -100, 0, - 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, // row 0 + 0, -100, -100, -100, -100, -100, 0, // row 1 + 0, -100, -150, -150, -150, -100, 0, // row 2 + 0, -100, -150, -200, -150, -100, 0, // row 3 + 0, -100, -150, -150, -150, -100, 0, // row 4 + 0, -100, -100, -100, -100, -100, 0, // row 5 + 0, 0, 0, 0, 0, 0, 0, // row 6 }}; const HeightfieldSurface surface = makeSquareHeightfieldSurface(heightfieldData); const int cellSize = mHeightfieldTileSize * (surface.mSize - 1); @@ -618,13 +618,13 @@ namespace TEST_F(DetourNavigatorNavigatorTest, path_should_be_over_water_when_ground_cross_water_with_max_int_cells_size_and_swim_and_walk_flags) { std::array heightfieldData {{ - 0, 0, 0, 0, 0, 0, 0, - 0, -100, -100, -100, -100, -100, 0, - 0, -100, -150, -150, -150, -100, 0, - 0, -100, -150, -200, -150, -100, 0, - 0, -100, -150, -150, -150, -100, 0, - 0, -100, -100, -100, -100, -100, 0, - 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, // row 0 + 0, -100, -100, -100, -100, -100, 0, // row 1 + 0, -100, -150, -150, -150, -100, 0, // row 2 + 0, -100, -150, -200, -150, -100, 0, // row 3 + 0, -100, -150, -150, -150, -100, 0, // row 4 + 0, -100, -100, -100, -100, -100, 0, // row 5 + 0, 0, 0, 0, 0, 0, 0, // row 6 }}; const HeightfieldSurface surface = makeSquareHeightfieldSurface(heightfieldData); const int cellSize = mHeightfieldTileSize * (surface.mSize - 1); @@ -664,13 +664,13 @@ namespace TEST_F(DetourNavigatorNavigatorTest, path_should_be_over_ground_when_ground_cross_water_with_only_walk_flag) { std::array heightfieldData {{ - 0, 0, 0, 0, 0, 0, 0, - 0, -100, -100, -100, -100, -100, 0, - 0, -100, -150, -150, -150, -100, 0, - 0, -100, -150, -200, -150, -100, 0, - 0, -100, -150, -150, -150, -100, 0, - 0, -100, -100, -100, -100, -100, 0, - 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, // row 0 + 0, -100, -100, -100, -100, -100, 0, // row 1 + 0, -100, -150, -150, -150, -100, 0, // row 2 + 0, -100, -150, -200, -150, -100, 0, // row 3 + 0, -100, -150, -150, -150, -100, 0, // row 4 + 0, -100, -100, -100, -100, -100, 0, // row 5 + 0, 0, 0, 0, 0, 0, 0, // row 6 }}; const HeightfieldSurface surface = makeSquareHeightfieldSurface(heightfieldData); const int cellSize = mHeightfieldTileSize * (surface.mSize - 1); @@ -710,11 +710,11 @@ namespace TEST_F(DetourNavigatorNavigatorTest, update_object_remove_and_update_then_find_path_should_return_path) { const std::array heightfieldData {{ - 0, 0, 0, 0, 0, - 0, -25, -25, -25, -25, - 0, -25, -100, -100, -100, - 0, -25, -100, -100, -100, - 0, -25, -100, -100, -100, + 0, 0, 0, 0, 0, // row 0 + 0, -25, -25, -25, -25, // row 1 + 0, -25, -100, -100, -100, // row 2 + 0, -25, -100, -100, -100, // row 3 + 0, -25, -100, -100, -100, // row 4 }}; CollisionShapeInstance heightfield(makeSquareHeightfieldTerrainShape(heightfieldData)); heightfield.shape().setLocalScaling(btVector3(128, 128, 1)); @@ -764,11 +764,11 @@ namespace TEST_F(DetourNavigatorNavigatorTest, update_heightfield_remove_and_update_then_find_path_should_return_path) { const std::array heightfieldData {{ - 0, 0, 0, 0, 0, - 0, -25, -25, -25, -25, - 0, -25, -100, -100, -100, - 0, -25, -100, -100, -100, - 0, -25, -100, -100, -100, + 0, 0, 0, 0, 0, // row 0 + 0, -25, -25, -25, -25, // row 1 + 0, -25, -100, -100, -100, // row 2 + 0, -25, -100, -100, -100, // row 3 + 0, -25, -100, -100, -100, // row 4 }}; const HeightfieldSurface surface = makeSquareHeightfieldSurface(heightfieldData); const int cellSize = mHeightfieldTileSize * (surface.mSize - 1); @@ -818,12 +818,12 @@ namespace TEST_F(DetourNavigatorNavigatorTest, update_then_find_random_point_around_circle_should_return_position) { const std::array heightfieldData {{ - 0, 0, 0, 0, 0, 0, - 0, -25, -25, -25, -25, -25, - 0, -25, -1000, -1000, -100, -100, - 0, -25, -1000, -1000, -100, -100, - 0, -25, -100, -100, -100, -100, - 0, -25, -100, -100, -100, -100, + 0, 0, 0, 0, 0, 0, // row 0 + 0, -25, -25, -25, -25, -25, // row 1 + 0, -25, -1000, -1000, -100, -100, // row 2 + 0, -25, -1000, -1000, -100, -100, // row 3 + 0, -25, -100, -100, -100, -100, // row 4 + 0, -25, -100, -100, -100, -100, // row 5 }}; const HeightfieldSurface surface = makeSquareHeightfieldSurface(heightfieldData); const int cellSize = mHeightfieldTileSize * (surface.mSize - 1); @@ -852,11 +852,11 @@ namespace mNavigator.reset(new NavigatorImpl(mSettings, std::make_unique(":memory:", std::numeric_limits::max()))); const std::array heightfieldData {{ - 0, 0, 0, 0, 0, - 0, -25, -25, -25, -25, - 0, -25, -100, -100, -100, - 0, -25, -100, -100, -100, - 0, -25, -100, -100, -100, + 0, 0, 0, 0, 0, // row 0 + 0, -25, -25, -25, -25, // row 1 + 0, -25, -100, -100, -100, // row 2 + 0, -25, -100, -100, -100, // row 3 + 0, -25, -100, -100, -100, // row 4 }}; const HeightfieldSurface surface = makeSquareHeightfieldSurface(heightfieldData); const int cellSize = mHeightfieldTileSize * (surface.mSize - 1); @@ -957,11 +957,11 @@ namespace TEST_F(DetourNavigatorNavigatorTest, update_then_raycast_should_return_position) { const std::array heightfieldData {{ - 0, 0, 0, 0, 0, - 0, -25, -25, -25, -25, - 0, -25, -100, -100, -100, - 0, -25, -100, -100, -100, - 0, -25, -100, -100, -100, + 0, 0, 0, 0, 0, // row 0 + 0, -25, -25, -25, -25, // row 1 + 0, -25, -100, -100, -100, // row 2 + 0, -25, -100, -100, -100, // row 3 + 0, -25, -100, -100, -100, // row 4 }}; const HeightfieldSurface surface = makeSquareHeightfieldSurface(heightfieldData); const int cellSize = mHeightfieldTileSize * (surface.mSize - 1); @@ -982,11 +982,11 @@ namespace TEST_F(DetourNavigatorNavigatorTest, update_for_oscillating_object_that_does_not_change_navmesh_should_not_trigger_navmesh_update) { const std::array heightfieldData {{ - 0, 0, 0, 0, 0, - 0, -25, -25, -25, -25, - 0, -25, -100, -100, -100, - 0, -25, -100, -100, -100, - 0, -25, -100, -100, -100, + 0, 0, 0, 0, 0, // row 0 + 0, -25, -25, -25, -25, // row 1 + 0, -25, -100, -100, -100, // row 2 + 0, -25, -100, -100, -100, // row 3 + 0, -25, -100, -100, -100, // row 4 }}; const HeightfieldSurface surface = makeSquareHeightfieldSurface(heightfieldData); const int cellSize = mHeightfieldTileSize * (surface.mSize - 1); @@ -1066,11 +1066,11 @@ namespace TEST_F(DetourNavigatorNavigatorTest, for_not_reachable_destination_find_path_should_provide_partial_path) { const std::array heightfieldData {{ - 0, 0, 0, 0, 0, - 0, -25, -25, -25, -25, - 0, -25, -100, -100, -100, - 0, -25, -100, -100, -100, - 0, -25, -100, -100, -100, + 0, 0, 0, 0, 0, // row 0 + 0, -25, -25, -25, -25, // row 1 + 0, -25, -100, -100, -100, // row 2 + 0, -25, -100, -100, -100, // row 3 + 0, -25, -100, -100, -100, // row 4 }}; const HeightfieldSurface surface = makeSquareHeightfieldSurface(heightfieldData); const int cellSize = mHeightfieldTileSize * (surface.mSize - 1); @@ -1105,11 +1105,11 @@ namespace TEST_F(DetourNavigatorNavigatorTest, end_tolerance_should_extent_available_destinations) { const std::array heightfieldData {{ - 0, 0, 0, 0, 0, - 0, -25, -25, -25, -25, - 0, -25, -100, -100, -100, - 0, -25, -100, -100, -100, - 0, -25, -100, -100, -100, + 0, 0, 0, 0, 0, // row 0 + 0, -25, -25, -25, -25, // row 1 + 0, -25, -100, -100, -100, // row 2 + 0, -25, -100, -100, -100, // row 3 + 0, -25, -100, -100, -100, // row 4 }}; const HeightfieldSurface surface = makeSquareHeightfieldSurface(heightfieldData); const int cellSize = mHeightfieldTileSize * (surface.mSize - 1); diff --git a/apps/openmw_test_suite/detournavigator/recastmeshbuilder.cpp b/apps/openmw_test_suite/detournavigator/recastmeshbuilder.cpp index 4018b02de0..818d7b8623 100644 --- a/apps/openmw_test_suite/detournavigator/recastmeshbuilder.cpp +++ b/apps/openmw_test_suite/detournavigator/recastmeshbuilder.cpp @@ -91,9 +91,9 @@ namespace AreaType_ground, mSource, mObjectTransform); const auto recastMesh = std::move(builder).create(mVersion); EXPECT_EQ(recastMesh->getMesh().getVertices(), std::vector({ - -1, -1, 0, - -1, 1, 0, - 1, -1, 0, + -1, -1, 0, // vertex 0 + -1, 1, 0, // vertex 1 + 1, -1, 0, // vertex 2 })) << recastMesh->getMesh().getVertices(); EXPECT_EQ(recastMesh->getMesh().getIndices(), std::vector({2, 1, 0})); EXPECT_EQ(recastMesh->getMesh().getAreaTypes(), std::vector({AreaType_ground})); @@ -112,9 +112,9 @@ namespace ); const auto recastMesh = std::move(builder).create(mVersion); EXPECT_EQ(recastMesh->getMesh().getVertices(), std::vector({ - 0, 0, 3, - 0, 4, 3, - 2, 0, 3, + 0, 0, 3, // vertex 0 + 0, 4, 3, // vertex 1 + 2, 0, 3, // vertex 2 })) << recastMesh->getMesh().getVertices(); EXPECT_EQ(recastMesh->getMesh().getIndices(), std::vector({2, 1, 0})); EXPECT_EQ(recastMesh->getMesh().getAreaTypes(), std::vector({AreaType_ground})); @@ -129,10 +129,10 @@ namespace AreaType_ground, mSource, mObjectTransform); const auto recastMesh = std::move(builder).create(mVersion); EXPECT_EQ(recastMesh->getMesh().getVertices(), std::vector({ - -0.5, -0.5, 0, - -0.5, 0.5, 0, - 0.5, -0.5, 0, - 0.5, 0.5, 0, + -0.5, -0.5, 0, // vertex 0 + -0.5, 0.5, 0, // vertex 1 + 0.5, -0.5, 0, // vertex 2 + 0.5, 0.5, 0, // vertex 3 })) << recastMesh->getMesh().getVertices(); EXPECT_EQ(recastMesh->getMesh().getIndices(), std::vector({0, 1, 2, 2, 1, 3})); EXPECT_EQ(recastMesh->getMesh().getAreaTypes(), std::vector({AreaType_ground, AreaType_ground})); @@ -146,28 +146,28 @@ namespace AreaType_ground, mSource, mObjectTransform); const auto recastMesh = std::move(builder).create(mVersion); EXPECT_EQ(recastMesh->getMesh().getVertices(), std::vector({ - -1, -1, -2, - -1, -1, 2, - -1, 1, -2, - -1, 1, 2, - 1, -1, -2, - 1, -1, 2, - 1, 1, -2, - 1, 1, 2, + -1, -1, -2, // vertex 0 + -1, -1, 2, // vertex 1 + -1, 1, -2, // vertex 2 + -1, 1, 2, // vertex 3 + 1, -1, -2, // vertex 4 + 1, -1, 2, // vertex 5 + 1, 1, -2, // vertex 6 + 1, 1, 2, // vertex 7 })) << recastMesh->getMesh().getVertices(); EXPECT_EQ(recastMesh->getMesh().getIndices(), std::vector({ - 0, 1, 5, - 0, 2, 3, - 0, 4, 6, - 1, 3, 7, - 2, 6, 7, - 3, 1, 0, - 4, 5, 7, - 5, 4, 0, - 6, 2, 0, - 7, 3, 2, - 7, 5, 1, - 7, 6, 4, + 0, 1, 5, // triangle 0 + 0, 2, 3, // triangle 1 + 0, 4, 6, // triangle 2 + 1, 3, 7, // triangle 3 + 2, 6, 7, // triangle 4 + 3, 1, 0, // triangle 5 + 4, 5, 7, // triangle 6 + 5, 4, 0, // triangle 7 + 6, 2, 0, // triangle 8 + 7, 3, 2, // triangle 9 + 7, 5, 1, // triangle 10 + 7, 6, 4, // triangle 11 })) << recastMesh->getMesh().getIndices(); EXPECT_EQ(recastMesh->getMesh().getAreaTypes(), std::vector(12, AreaType_ground)); } @@ -193,34 +193,34 @@ namespace ); const auto recastMesh = std::move(builder).create(mVersion); EXPECT_EQ(recastMesh->getMesh().getVertices(), std::vector({ - -1, -1, -2, - -1, -1, 0, - -1, -1, 2, - -1, 1, -2, - -1, 1, 0, - -1, 1, 2, - 1, -1, -2, - 1, -1, 0, - 1, -1, 2, - 1, 1, -2, - 1, 1, 0, - 1, 1, 2, + -1, -1, -2, // vertex 0 + -1, -1, 0, // vertex 1 + -1, -1, 2, // vertex 2 + -1, 1, -2, // vertex 3 + -1, 1, 0, // vertex 4 + -1, 1, 2, // vertex 5 + 1, -1, -2, // vertex 6 + 1, -1, 0, // vertex 7 + 1, -1, 2, // vertex 8 + 1, 1, -2, // vertex 9 + 1, 1, 0, // vertex 10 + 1, 1, 2, // vertex 11 })) << recastMesh->getMesh().getVertices(); EXPECT_EQ(recastMesh->getMesh().getIndices(), std::vector({ - 0, 2, 8, - 0, 3, 5, - 0, 6, 9, - 2, 5, 11, - 3, 9, 11, - 5, 2, 0, - 6, 8, 11, - 7, 4, 1, - 7, 4, 10, - 8, 6, 0, - 9, 3, 0, - 11, 5, 3, - 11, 8, 2, - 11, 9, 6, + 0, 2, 8, // triangle 0 + 0, 3, 5, // triangle 1 + 0, 6, 9, // triangle 2 + 2, 5, 11, // triangle 3 + 3, 9, 11, // triangle 4 + 5, 2, 0, // triangle 5 + 6, 8, 11, // triangle 6 + 7, 4, 1, // triangle 7 + 7, 4, 10, // triangle 8 + 8, 6, 0, // triangle 9 + 9, 3, 0, // triangle 10 + 11, 5, 3, // triangle 11 + 11, 8, 2, // triangle 12 + 11, 9, 6, // triangle 13 })) << recastMesh->getMesh().getIndices(); EXPECT_EQ(recastMesh->getMesh().getAreaTypes(), std::vector(14, AreaType_ground)); } @@ -240,9 +240,9 @@ namespace ); const auto recastMesh = std::move(builder).create(mVersion); EXPECT_EQ(recastMesh->getMesh().getVertices(), std::vector({ - 0, 0, 3, - 0, 4, 3, - 2, 0, 3, + 0, 0, 3, // vertex 0 + 0, 4, 3, // vertex 1 + 2, 0, 3, // vertex 2 })) << recastMesh->getMesh().getVertices(); EXPECT_EQ(recastMesh->getMesh().getIndices(), std::vector({2, 1, 0})); EXPECT_EQ(recastMesh->getMesh().getAreaTypes(), std::vector({AreaType_ground})); @@ -264,9 +264,9 @@ namespace ); const auto recastMesh = std::move(builder).create(mVersion); EXPECT_EQ(recastMesh->getMesh().getVertices(), std::vector({ - 1, 2, 12, - 1, 10, 12, - 3, 2, 12, + 1, 2, 12, // vertex 0 + 1, 10, 12, // vertex 1 + 3, 2, 12, // vertex 2 })) << recastMesh->getMesh().getVertices(); EXPECT_EQ(recastMesh->getMesh().getIndices(), std::vector({2, 1, 0})); EXPECT_EQ(recastMesh->getMesh().getAreaTypes(), std::vector({AreaType_ground})); @@ -286,12 +286,12 @@ namespace ); const auto recastMesh = std::move(builder).create(mVersion); EXPECT_EQ(recastMesh->getMesh().getVertices(), std::vector({ - -3, -3, 0, - -3, -2, 0, - -2, -3, 0, - -1, -1, 0, - -1, 1, 0, - 1, -1, 0, + -3, -3, 0, // vertex 0 + -3, -2, 0, // vertex 1 + -2, -3, 0, // vertex 2 + -1, -1, 0, // vertex 3 + -1, 1, 0, // vertex 4 + 1, -1, 0, // vertex 5 })) << recastMesh->getMesh().getVertices(); EXPECT_EQ(recastMesh->getMesh().getIndices(), std::vector({2, 1, 0, 5, 4, 3})); EXPECT_EQ(recastMesh->getMesh().getAreaTypes(), std::vector(2, AreaType_ground)); @@ -313,9 +313,9 @@ namespace ); const auto recastMesh = std::move(builder).create(mVersion); EXPECT_EQ(recastMesh->getMesh().getVertices(), std::vector({ - -3, -3, 0, - -3, -2, 0, - -2, -3, 0, + -3, -3, 0, // vertex 0 + -3, -2, 0, // vertex 1 + -2, -3, 0, // vertex 2 })) << recastMesh->getMesh().getVertices(); EXPECT_EQ(recastMesh->getMesh().getIndices(), std::vector({2, 1, 0})); EXPECT_EQ(recastMesh->getMesh().getAreaTypes(), std::vector({AreaType_ground})); @@ -338,9 +338,9 @@ namespace ); const auto recastMesh = std::move(builder).create(mVersion); EXPECT_THAT(recastMesh->getMesh().getVertices(), Pointwise(FloatNear(1e-5f), std::vector({ - 0, -4.24264049530029296875f, 4.44089209850062616169452667236328125e-16f, - 0, -3.535533905029296875f, -0.707106769084930419921875f, - 0, -3.535533905029296875f, 0.707106769084930419921875f, + 0, -4.24264049530029296875f, 4.44089209850062616169452667236328125e-16f, // vertex 0 + 0, -3.535533905029296875f, -0.707106769084930419921875f, // vertex 1 + 0, -3.535533905029296875f, 0.707106769084930419921875f, // vertex 2 }))) << recastMesh->getMesh().getVertices(); EXPECT_EQ(recastMesh->getMesh().getIndices(), std::vector({1, 2, 0})); EXPECT_EQ(recastMesh->getMesh().getAreaTypes(), std::vector({AreaType_ground})); @@ -363,9 +363,9 @@ namespace ); const auto recastMesh = std::move(builder).create(mVersion); EXPECT_THAT(recastMesh->getMesh().getVertices(), Pointwise(FloatNear(1e-5f), std::vector({ - -4.24264049530029296875f, 0, 4.44089209850062616169452667236328125e-16f, - -3.535533905029296875f, 0, -0.707106769084930419921875f, - -3.535533905029296875f, 0, 0.707106769084930419921875f, + -4.24264049530029296875f, 0, 4.44089209850062616169452667236328125e-16f, // vertex 0 + -3.535533905029296875f, 0, -0.707106769084930419921875f, // vertex 1 + -3.535533905029296875f, 0, 0.707106769084930419921875f, // vertex 2 }))) << recastMesh->getMesh().getVertices(); EXPECT_EQ(recastMesh->getMesh().getIndices(), std::vector({1, 2, 0})); EXPECT_EQ(recastMesh->getMesh().getAreaTypes(), std::vector({AreaType_ground})); @@ -388,9 +388,9 @@ namespace ); const auto recastMesh = std::move(builder).create(mVersion); EXPECT_THAT(recastMesh->getMesh().getVertices(), Pointwise(FloatNear(1e-5f), std::vector({ - -1.41421353816986083984375f, -1.1102230246251565404236316680908203125e-16f, 0, - 1.1102230246251565404236316680908203125e-16f, -1.41421353816986083984375f, 0, - 1.41421353816986083984375f, 1.1102230246251565404236316680908203125e-16f, 0, + -1.41421353816986083984375f, -1.1102230246251565404236316680908203125e-16f, 0, // vertex 0 + 1.1102230246251565404236316680908203125e-16f, -1.41421353816986083984375f, 0, // vertex 1 + 1.41421353816986083984375f, 1.1102230246251565404236316680908203125e-16f, 0, // vertex 2 }))) << recastMesh->getMesh().getVertices(); EXPECT_EQ(recastMesh->getMesh().getIndices(), std::vector({2, 0, 1})); EXPECT_EQ(recastMesh->getMesh().getAreaTypes(), std::vector({AreaType_ground})); @@ -417,12 +417,12 @@ namespace ); const auto recastMesh = std::move(builder).create(mVersion); EXPECT_EQ(recastMesh->getMesh().getVertices(), std::vector({ - -3, -3, 0, - -3, -2, 0, - -2, -3, 0, - -1, -1, 0, - -1, 1, 0, - 1, -1, 0, + -3, -3, 0, // vertex 0 + -3, -2, 0, // vertex 1 + -2, -3, 0, // vertex 2 + -1, -1, 0, // vertex 3 + -1, 1, 0, // vertex 4 + 1, -1, 0, // vertex 5 })) << recastMesh->getMesh().getVertices(); EXPECT_EQ(recastMesh->getMesh().getIndices(), std::vector({2, 1, 0, 5, 4, 3})); EXPECT_EQ(recastMesh->getMesh().getAreaTypes(), std::vector({AreaType_null, AreaType_ground})); @@ -449,10 +449,10 @@ namespace builder.addObject(static_cast(shape), btTransform::getIdentity(), AreaType_ground, mSource, mObjectTransform); const auto recastMesh = std::move(builder).create(mVersion); EXPECT_EQ(recastMesh->getMesh().getVertices(), std::vector({ - -1, -1, 0, - -1, 1, 0, - 1, -1, 0, - 1, 1, 0, + -1, -1, 0, // vertex 0 + -1, 1, 0, // vertex 1 + 1, -1, 0, // vertex 2 + 1, 1, 0, // vertex 3 })) << recastMesh->getMesh().getVertices(); EXPECT_EQ(recastMesh->getMesh().getIndices(), std::vector({2, 1, 0, 2, 1, 3})); EXPECT_EQ(recastMesh->getMesh().getAreaTypes(), std::vector({AreaType_ground, AreaType_ground})); @@ -476,9 +476,9 @@ namespace { constexpr std::size_t size = 3; constexpr std::array heights {{ - 0, 1, 2, - 3, 4, 5, - 6, 7, 8, + 0, 1, 2, // row 0 + 3, 4, 5, // row 1 + 6, 7, 8, // row 2 }}; const osg::Vec2i cellPosition(0, 0); const int cellSize = 1000; @@ -493,11 +493,7 @@ namespace expected.mLength = size; expected.mMinHeight = minHeight; expected.mMaxHeight = maxHeight; - expected.mHeights = { - 0, 1, 2, - 3, 4, 5, - 6, 7, 8, - }; + expected.mHeights.assign(heights.begin(), heights.end()); expected.mOriginalSize = 3; expected.mMinX = 0; expected.mMinY = 0; @@ -508,9 +504,9 @@ namespace { constexpr std::size_t size = 3; constexpr std::array heights {{ - 0, 1, 2, - 3, 4, 5, - 6, 7, 8, + 0, 1, 2, // row 0 + 3, 4, 5, // row 1 + 6, 7, 8, // row 2 }}; const osg::Vec2i cellPosition(1, 2); const int cellSize = 1000; @@ -525,11 +521,7 @@ namespace expected.mLength = size; expected.mMinHeight = minHeight; expected.mMaxHeight = maxHeight; - expected.mHeights = { - 0, 1, 2, - 3, 4, 5, - 6, 7, 8, - }; + expected.mHeights.assign(heights.begin(), heights.end()); expected.mOriginalSize = 3; expected.mMinX = 0; expected.mMinY = 0; @@ -540,9 +532,9 @@ namespace { constexpr std::size_t size = 3; constexpr std::array heights {{ - 0, 1, 2, - 3, 4, 5, - 6, 7, 8, + 0, 1, 2, // row 0 + 3, 4, 5, // row 1 + 6, 7, 8, // row 2 }}; const osg::Vec2i cellPosition(0, 0); const int cellSize = 1000; @@ -559,8 +551,8 @@ namespace expected.mMinHeight = 0; expected.mMaxHeight = 8; expected.mHeights = { - 4, 5, - 7, 8, + 4, 5, // row 0 + 7, 8, // row 1 }; expected.mOriginalSize = 3; expected.mMinX = 1;