Compare commits
2 Commits
bee5aa0e8f
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
babc1f99f5 | ||
|
|
a47dff77f7 |
@@ -98,6 +98,20 @@ FetchContent_Declare(
|
||||
|
||||
FetchContent_MakeAvailable(flecs doctest glm nlohmann_json glfw imgui imnodes FastNoiseLite)
|
||||
|
||||
# ---- OpenCL (GPU compute backend) -------------------------------------------
|
||||
|
||||
find_package(OpenCL REQUIRED)
|
||||
|
||||
# opencl-clhpp: official Khronos C++ bindings (header-only)
|
||||
FetchContent_Declare(
|
||||
opencl_clhpp
|
||||
GIT_REPOSITORY https://github.com/KhronosGroup/OpenCL-CLHPP.git
|
||||
GIT_TAG v2024.10.24
|
||||
GIT_SHALLOW TRUE
|
||||
)
|
||||
|
||||
FetchContent_MakeAvailable(opencl_clhpp)
|
||||
|
||||
# ---- Core library ------------------------------------------------------------
|
||||
|
||||
set(SOURCES
|
||||
|
||||
@@ -270,38 +270,6 @@ TEST_SUITE("WorldGraph::QueryNodes") {
|
||||
EvalContext ctx2 = g.MakeEvalContext(1, 0, 0);
|
||||
CHECK(above.Evaluate(ctx2, {}).AsInt() == 1); // only y=4 is air
|
||||
}
|
||||
|
||||
TEST_CASE("QueryDistanceNode: finds adjacent tile at distance 1") {
|
||||
TileGrid g(0, 0, 5, 5);
|
||||
g.Set(2, 3, 1); // STONE one tile above current cell (1,3) → actually (2,3) is to the right of (1,3)
|
||||
// Place STONE directly above (1,1) at (1,2)
|
||||
g.Set(1, 2, 1);
|
||||
EvalContext ctx = g.MakeEvalContext(1, 1, 0); // current = (1,1)
|
||||
QueryDistanceNode qd(1, 4);
|
||||
CHECK(qd.Evaluate(ctx, {}).AsInt() == 1); // (1,2) is Chebyshev distance 1
|
||||
}
|
||||
|
||||
TEST_CASE("QueryDistanceNode: not found returns maxDistance+1") {
|
||||
TileGrid g(0, 0, 5, 5); // all AIR
|
||||
EvalContext ctx = g.MakeEvalContext(2, 2, 0);
|
||||
QueryDistanceNode qd(1 /*STONE*/, 3);
|
||||
CHECK(qd.Evaluate(ctx, {}).AsInt() == 4); // maxDistance+1
|
||||
}
|
||||
|
||||
TEST_CASE("QueryDistanceNode: no previous pass returns maxDistance+1") {
|
||||
EvalContext ctx; ctx.worldX = 0; ctx.worldY = 0;
|
||||
QueryDistanceNode qd(1, 4);
|
||||
CHECK(qd.Evaluate(ctx, {}).AsInt() == 5);
|
||||
}
|
||||
|
||||
TEST_CASE("QueryDistanceNode: ignores current cell") {
|
||||
TileGrid g(0, 0, 3, 3);
|
||||
g.Set(1, 1, 1); // STONE at current cell
|
||||
EvalContext ctx = g.MakeEvalContext(1, 1, 0);
|
||||
QueryDistanceNode qd(1, 2); // looking for STONE
|
||||
// (1,1) is self, must be skipped; no other STONE tiles → maxDistance+1
|
||||
CHECK(qd.Evaluate(ctx, {}).AsInt() == 3);
|
||||
}
|
||||
}
|
||||
|
||||
// ─────────────────────────────── GenerateRegion ──────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user