Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

progress indicator raytracer

for (int j = image_height-1; j >= 0; --j) {
        std::cerr << "
Scanlines remaining: " << j << ' ' << std::flush;
        for (int i = 0; i < image_width; ++i) {
            auto r = double(i) / (image_width-1);
            auto g = double(j) / (image_height-1);
            auto b = 0.25;

            int ir = static_cast<int>(255.999 * r);
            int ig = static_cast<int>(255.999 * g);
            int ib = static_cast<int>(255.999 * b);

            std::cout << ir << ' ' << ig << ' ' << ib << '
';
        }
    }

    std::cerr << "
Done.
";
Source by raytracing.github.io #
 
PREVIOUS NEXT
Tagged: #progress #indicator #raytracer
ADD COMMENT
Topic
Name
2+5 =