We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 00d0ab0 + 5cb9a2c commit 9423527Copy full SHA for 9423527
books/RayTracingTheNextWeek.html
@@ -1093,9 +1093,11 @@
1093
auto u = p.x() - floor(p.x());
1094
auto v = p.y() - floor(p.y());
1095
auto w = p.z() - floor(p.z());
1096
- auto i = static_cast<int>(floor(p.x()));
1097
- auto j = static_cast<int>(floor(p.y()));
1098
- auto k = static_cast<int>(floor(p.z()));
+
+ auto i = static_cast<int>(4*p.x()) & 255;
+ auto j = static_cast<int>(4*p.y()) & 255;
1099
+ auto k = static_cast<int>(4*p.z()) & 255;
1100
1101
return ranfloat[perm_x[i] ^ perm_y[j] ^ perm_z[k]];
1102
}
1103
0 commit comments