Skip to content

Commit e6eaee4

Browse files
committed
Update blue-to-white gradient image
- resolution changed from 200x100 to 768x432 (16:9) - compute image height based on width + aspect-ratio - compute lower-left viewport corner - update blue-to-white gradient image
1 parent 81c5d5c commit e6eaee4

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

books/RayTracingInOneWeekend.html

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -440,16 +440,17 @@
440440
}
441441

442442
int main() {
443-
const int image_width = 200;
444-
const int image_height = 100;
443+
const int image_width = 768;
444+
const auto aspect_ratio = 9.0 / 16.0;
445+
const int image_height = static_cast<int>(aspect_ratio * image_width);
445446

446447
std::cout << "P3\n" << image_width << " " << image_height << "\n255\n";
447448

448449
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
449-
vec3 lower_left_corner(-2.0, -1.0, -1.0);
450-
vec3 horizontal(4.0, 0.0, 0.0);
451-
vec3 vertical(0.0, 2.0, 0.0);
452450
vec3 origin(0.0, 0.0, 0.0);
451+
vec3 horizontal(4.0, 0.0, 0.0);
452+
vec3 vertical(0.0, 2.25, 0.0);
453+
vec3 lower_left_corner = origin - horizontal/2 - vertical/2 - vec3(0,0,1);
453454
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
454455
for (int j = image_height-1; j >= 0; --j) {
455456
std::cerr << "\rScanlines remaining: " << j << ' ' << std::flush;
@@ -957,6 +958,7 @@
957958
#define HITTABLE_LIST_H
958959

959960
#include "hittable.h"
961+
960962
#include <memory>
961963
#include <vector>
962964

images/img.blue-to-white.png

10.1 KB
Loading

0 commit comments

Comments
 (0)