diff --git a/src/interface/commandline/tests.cpp b/src/interface/commandline/tests.cpp index 2fa7ee3..e3aba56 100644 --- a/src/interface/commandline/tests.cpp +++ b/src/interface/commandline/tests.cpp @@ -38,6 +38,7 @@ #include "Zone.h" #include "MaterialNode.h" #include "TerrainRayWalker.h" +#include "Logs.h" #include #include @@ -633,16 +634,19 @@ static void testTerrainRayMarching() { // Draw ray marcher hits TerrainRayWalker walker(&renderer); - walker.setQuality(1.0, 0.1, 5.0, 1.0, to_double(height), 0.1); + walker.setQuality(1.0, 0.1, 5.0, 1.0, to_double(height) * 2.0, 0.1); walker.update(); for (int x = 0; x < width * multisample; x++) { TerrainRayWalker::TerrainHitResult hit; double max_height = terrain->getHeightInfo().max_height; - walker.startWalking(Vector3(to_double(x) / to_double(multisample) - to_double(max_height) * offset, to_double(max_height), 0.0), direction, 0.0, hit); - int hx = round_to_int(hit.hit_location.x); - int hy = height / 2 + round_to_int(hit.hit_location.y); - if (hx >= 0 && hx < width && hy >= 0 && hy < height) { - result.setPixel(hx, hy, COLOR_RED); + if (walker.startWalking(Vector3(to_double(x) / to_double(multisample) - to_double(max_height) * offset, to_double(max_height), 0.0), direction, 0.0, hit)) { + int hx = round_to_int(hit.hit_location.x); + int hy = height / 2 + round_to_int(hit.hit_location.y); + if (hx >= 0 && hx < width && hy >= 0 && hy < height) { + result.setPixel(hx, hy, COLOR_RED); + } + } else { + Logs::debug("terrain_ray_marching") << "No hit for " << i << " at " << x << std::endl; } } diff --git a/src/render/software/TerrainRayWalker.cpp b/src/render/software/TerrainRayWalker.cpp index ebed170..2340193 100644 --- a/src/render/software/TerrainRayWalker.cpp +++ b/src/render/software/TerrainRayWalker.cpp @@ -88,12 +88,6 @@ bool TerrainRayWalker::startWalking(const Vector3 &start, Vector3 direction, dou } if (hit) { - // TODO Refine the hit with dichotomy at high quality - /*if (renderer->render_quality > 7) - { - cursor = refineHit(previous_cursor, cursor, step_length); - }*/ - // Shift ray to escape terrain if (escape_angle != 0.0) { result.escape_angle += shift_step;