Created
February 2, 2020 08:08
-
-
Save LiamHz/32cbda095b36f773bfa8f4b98dcfc495 to your computer and use it in GitHub Desktop.
Store the intermediate of a ppm file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Store a backup ppm after rendering every 100 rows | |
if (j % 100 == 0) { | |
ofs.close(); | |
temp_filename = "./out_" + std::to_string(ny-j) + ".ppm"; | |
std::ifstream src("out.ppm", std::ios::binary); | |
std::ofstream dst(temp_filename, std::ios::binary); | |
dst << src.rdbuf(); | |
std::ofstream temp_ofs; | |
temp_ofs.open(temp_filename, std::ios_base::app); | |
for (int z = j+1; z>=0; z--) { | |
for (int i = 0; i < nx; i++) { | |
temp_ofs << "0 0 0\n"; | |
} | |
} | |
temp_ofs.close(); | |
ofs.open("./out.ppm", std::ios_base::app); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment