Skip to content

Commit

Permalink
Fix UB when using -ffast-math
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisThrasher committed Jul 8, 2024
1 parent e51d00d commit 26fe6fc
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Checks: >
-*,
bugprone-*,
clang-analyzer-*,
concurrency-*,
Expand Down
2 changes: 1 addition & 1 deletion src/Raytracer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ namespace {
if (depth == 0)
return sf::Vector3f();

if (const auto maybe_hit = hit(scene, ray, 0.001f, std::numeric_limits<float>::infinity())) {
if (const auto maybe_hit = hit(scene, ray, 0.001f, std::numeric_limits<float>::max())) {
if (const auto result = scatter(*maybe_hit->material, ray, *maybe_hit)) {
const auto& [attenuation, scattered] = *result;
return attenuation.cwiseMul(trace_ray(scene, scattered, depth - 1));
Expand Down

0 comments on commit 26fe6fc

Please sign in to comment.