diff --git a/doc/barrel.jpg b/doc/barrel.jpg new file mode 100644 index 0000000..f149b0f Binary files /dev/null and b/doc/barrel.jpg differ diff --git a/tinyraytracer.cpp b/tinyraytracer.cpp index 68bfd73..d64ca7c 100644 --- a/tinyraytracer.cpp +++ b/tinyraytracer.cpp @@ -127,8 +127,8 @@ Vec3f cast_ray(const Vec3f &orig, const Vec3f &dir, const std::vector &s void render(const std::vector &spheres, const std::vector &lights) { const float eyesep = 0.2; const int delta = 60; // focal distance 3 - const int width = 1024+delta; - const int height = 768; + const int width = 960+delta; + const int height = 1080; const float fov = M_PI/3.; std::vector framebuffer1(width*height); std::vector framebuffer2(width*height); @@ -144,16 +144,48 @@ void render(const std::vector &spheres, const std::vector &lights } } + if (0) { // draw the white grid + for (size_t j = 0; j pixmap((width-delta)*height*3*2); for (size_t j = 0; j=0 && xu=0 && yu1) c1 = c1*(1./max1); float max2 = std::max(c2[0], std::max(c2[1], c2[2])); if (max2>1) c2 = c2*(1./max2); + float max1 = std::max(c1[0], std::max(c1[1], c1[2])); + if (max1>1) c1 = c1*(1./max1); for (size_t d=0; d<3; d++) { pixmap[(j*(width-delta)*2 + i )*3+d] = 255*c1[d];