Fix code so raytrace test now passes.
This commit is contained in:
parent
80d0e1c336
commit
ff91bbbc71
4 changed files with 66 additions and 54 deletions
|
@ -28,7 +28,6 @@ TEST_CASE ("Check that 2D raytracing works", "[raytracing][geometry]") {
|
|||
using curry::for_each_voxel_under_segment;
|
||||
using curry::vec2us;
|
||||
using curry::vec2f;
|
||||
using curry::WorldTileProperty;
|
||||
|
||||
curry::WorldGrid world(vec2us(64));
|
||||
world.set_layers(vec2us(10, 10), std::vector<std::vector<curry::TileIndex>>( {{
|
||||
|
@ -49,27 +48,27 @@ TEST_CASE ("Check that 2D raytracing works", "[raytracing][geometry]") {
|
|||
REQUIRE(world.layer_count() == 1);
|
||||
|
||||
{
|
||||
std::vector<WorldTileProperty> diagonal;
|
||||
std::vector<vec2us> diagonal;
|
||||
for_each_voxel_under_segment (
|
||||
vec2f(0.0f, 0.0f), //from
|
||||
vec2f(640.0f, 640.0f), //to
|
||||
vec2f(639.0f, 639.0f), //to
|
||||
vec2us(1, 1), //objsize
|
||||
world, //world
|
||||
[diagonal](const WorldTileProperty& wtp) mutable {diagonal.push_back(wtp); return true;}
|
||||
[&diagonal](vec2us wtp) mutable {diagonal.push_back(wtp); return true;}
|
||||
);
|
||||
|
||||
const auto* tile_prop = &world.tile_property(world.tile(vec2us(0)));
|
||||
std::vector<WorldTileProperty> expected {
|
||||
WorldTileProperty{vec2us(0, 0), tile_prop},
|
||||
WorldTileProperty{vec2us(1, 1), tile_prop},
|
||||
WorldTileProperty{vec2us(2, 2), tile_prop},
|
||||
WorldTileProperty{vec2us(3, 3), tile_prop},
|
||||
WorldTileProperty{vec2us(4, 4), tile_prop},
|
||||
WorldTileProperty{vec2us(5, 5), tile_prop},
|
||||
WorldTileProperty{vec2us(6, 6), tile_prop},
|
||||
WorldTileProperty{vec2us(7, 7), tile_prop},
|
||||
WorldTileProperty{vec2us(8, 8), tile_prop},
|
||||
WorldTileProperty{vec2us(9, 9), tile_prop}
|
||||
std::vector<vec2us> expected {
|
||||
vec2us(0, 0), vec2us(0, 1),
|
||||
vec2us(1, 1), vec2us(1, 2),
|
||||
vec2us(2, 2), vec2us(2, 3),
|
||||
vec2us(3, 3), vec2us(3, 4),
|
||||
vec2us(4, 4), vec2us(4, 5),
|
||||
vec2us(5, 5), vec2us(5, 6),
|
||||
vec2us(6, 6), vec2us(6, 7),
|
||||
vec2us(7, 7), vec2us(7, 8),
|
||||
vec2us(8, 8), vec2us(8, 9),
|
||||
vec2us(9, 9)
|
||||
};
|
||||
CHECK(expected == diagonal);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue