Skip to content

Commit

Permalink
feat: limit debug output to Debug mode only
Browse files Browse the repository at this point in the history
This commit modifies the `Film::save` function to restrict debug output to Debug mode only.
This is achieved by wrapping the debug output code with `#ifdef _DEBUG` preprocessor directives.
  • Loading branch information
r1ckhu committed Jun 25, 2024
1 parent a2b1c03 commit f3278b7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/FunctionLayer/Film/Film.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,17 @@ void Film::deposit(const Point2i &p, const Spectrum &s) {

void Film::save(const std::string &path) {
// ! A temp implementation
#ifdef _DEBUG
std::ofstream ofs("render_result.txt");
#endif
for (int i = 0; i < resolution.y; i++) {
for (int j = 0; j < resolution.x; j++) {
int id = i * resolution.x + j;
Spectrum value = sumValues[id] / sumWeights[id];
image->setColorAt(Point2i(j, i), value);
// for debug
ofs << j << " " << i << " " << value[0] << " " << value[1] << " " << value[2] << " " << std::endl;
#ifdef _DEBUG
ofs << j << " " << i << " " << value[0] << " " << value[1] << " " << value[2] << " " << std::endl;
#endif
}
}
image->saveTo(path);
Expand Down

0 comments on commit f3278b7

Please sign in to comment.