Skip to content
Snippets Groups Projects
Commit 00fd747b authored by Lukas Werner's avatar Lukas Werner
Browse files

Changed t_max calculation for tbuffer

parent ed5edd92
Branches
Tags
No related merge requests found
...@@ -145,9 +145,9 @@ void Raytracer::writeTBufferToFile(const std::vector<real_t>& tBuffer, const std ...@@ -145,9 +145,9 @@ void Raytracer::writeTBufferToFile(const std::vector<real_t>& tBuffer, const std
for (size_t y = 0; y < pixelsVertical_; y++) { for (size_t y = 0; y < pixelsVertical_; y++) {
size_t i = coordinateToArrayIndex(x, y); size_t i = coordinateToArrayIndex(x, y);
real_t t = tBuffer[i]; real_t t = tBuffer[i];
if (t > t_max && !realIsIdentical(t, inf)) { //if (t > t_max && !realIsIdentical(t, inf)) {
t_max = t; // t_max = t;
} //}
if (t < t_min) { if (t < t_min) {
t_min = t; t_min = t;
} }
...@@ -155,6 +155,8 @@ void Raytracer::writeTBufferToFile(const std::vector<real_t>& tBuffer, const std ...@@ -155,6 +155,8 @@ void Raytracer::writeTBufferToFile(const std::vector<real_t>& tBuffer, const std
} }
if (realIsIdentical(t_min, inf)) t_min = 0; if (realIsIdentical(t_min, inf)) t_min = 0;
t_max = forest_->getDomain().maxDistance(cameraPosition_);
fs::path dir (getTBufferOutputDirectory()); fs::path dir (getTBufferOutputDirectory());
fs::path file (fileName); fs::path file (fileName);
fs::path fullPath = dir / file; fs::path fullPath = dir / file;
...@@ -169,7 +171,7 @@ void Raytracer::writeTBufferToFile(const std::vector<real_t>& tBuffer, const std ...@@ -169,7 +171,7 @@ void Raytracer::writeTBufferToFile(const std::vector<real_t>& tBuffer, const std
if (realIsIdentical(t, inf)) { if (realIsIdentical(t, inf)) {
r = g = b = (char)0; r = g = b = (char)0;
} else { } else {
r = g = b = (char)(240 * (1-(t-t_min)/(t_max-t_min))); r = g = b = (char)(255 * (1-(t-t_min)/(t_max-t_min)));
} }
ofs << r << g << b; ofs << r << g << b;
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment