Search
 
SCRIPT & CODE EXAMPLE
 

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.
";
Comment

PREVIOUS NEXT
Code Example
Cpp :: Maximum Pairwise Modular Sum codechef solution in c++ 
Cpp :: error C2011 
Cpp :: Common elements gfg in c++ 
Cpp :: Array declaration by specifying the size and initializing elements in C++ 
Cpp :: in built function to find MSB in cpp 
Cpp :: the amount of input is unknown 
Cpp :: The five most significant revisions of the C++ standard are C++98 (1998), C++03 (2003) and C++11 (2011), C++14 (2014) and C++17 (2017) 
Cpp :: curl upload folder and subfolders 
Cpp :: Bit Tricks for Competitive Programming c ++ 
Cpp :: ejemplo 
Cpp :: arithmetic progression c++ 
Cpp :: c++ take n number from the user and store them in array and get the max, min number of them and also find the average/summation of these numbers 
Cpp :: forkortelse for intet 
Cpp :: get range sum 
Cpp :: find substring after character 
Cpp :: KL/wweiok#L['.[- 
Cpp :: second smallest element in array using one loop 
Cpp :: c++ check if cin got the wrong type 
Cpp :: cout two dimension array c++ 
Cpp :: contains in c++ map 
Cpp :: C++ Converting Celsius to Kelvin 
Cpp :: dfs in tree using adjacency list 
Cpp :: C++ References 
Cpp :: c++ watch a variable 
Cpp :: copying a file to an array and sorting 
Cpp :: convert c program to c++ online 
Cpp :: c++ program to convert kelvin to celsius 
Cpp :: how to take continuous input in c++ until any value. Like for example(taking input until giving q) 
Cpp :: catalan numbers c++ 
Cpp :: inbuilt function for bin to dec in c++ 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =