snoopy/src/main.cpp

28 lines
576 B
C++
Raw Normal View History

2020-06-01 02:49:50 +02:00
#include "colour.h"
#include "vec3.h"
2020-06-01 00:52:34 +02:00
#include <iostream>
const int WIDTH = 256;
const int HEIGHT = 256;
int main()
{
std::cout << "P3" << std::endl;
std::cout << WIDTH << ' ' << HEIGHT << "\n255\n";
for (int y = HEIGHT - 1; y >= 0; --y)
{
std::cerr << "\rScanlines remaining: " << y << ' ' << std::flush;
for (int x = 0; x < WIDTH; ++x)
{
2020-06-01 02:49:50 +02:00
colour pixelColour(double(x)/(WIDTH-1), double(y)/(HEIGHT-1), 0.25);
writeColour(std::cout, pixelColour);
2020-06-01 00:52:34 +02:00
}
}
std::cerr << "\nDone." << std::endl;
}