Skip to content

Commit 88bfa5e

Browse files
authored
scene: rename loop variable in pixel sampling loop (#1047)
* scene: rename loop variable in pixel sampling loop The old name 's' is easily confused with the image s/t coordinates. Fixes #1043 * Revert sample loop to increasing increment
1 parent 8911adc commit 88bfa5e

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

books/RayTracingInOneWeekend.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,7 +1595,7 @@
15951595
for (int i = 0; i < image_width; ++i) {
15961596
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
15971597
color pixel_color(0, 0, 0);
1598-
for (int s = 0; s < samples_per_pixel; ++s) {
1598+
for (int sample = 0; sample < samples_per_pixel; ++sample) {
15991599
auto u = (i + random_double()) / (image_width-1);
16001600
auto v = (j + random_double()) / (image_height-1);
16011601
ray r = cam.get_ray(u, v);
@@ -1773,7 +1773,7 @@
17731773
std::clog << "\rScanlines remaining: " << j << ' ' << std::flush;
17741774
for (int i = 0; i < image_width; ++i) {
17751775
color pixel_color(0, 0, 0);
1776-
for (int s = 0; s < samples_per_pixel; ++s) {
1776+
for (int sample = 0; sample < samples_per_pixel; ++sample) {
17771777
auto u = (i + random_double()) / (image_width-1);
17781778
auto v = (j + random_double()) / (image_height-1);
17791779
ray r = cam.get_ray(u, v);
@@ -2373,7 +2373,7 @@
23732373
std::clog << "\rScanlines remaining: " << j << ' ' << std::flush;
23742374
for (int i = 0; i < image_width; ++i) {
23752375
color pixel_color(0, 0, 0);
2376-
for (int s = 0; s < samples_per_pixel; ++s) {
2376+
for (int sample = 0; sample < samples_per_pixel; ++sample) {
23772377
auto u = (i + random_double()) / (image_width-1);
23782378
auto v = (j + random_double()) / (image_height-1);
23792379
ray r = cam.get_ray(u, v);
@@ -2832,7 +2832,7 @@
28322832
std::clog << "\rScanlines remaining: " << j << ' ' << std::flush;
28332833
for (int i = 0; i < image_width; ++i) {
28342834
color pixel_color(0,0,0);
2835-
for (int s = 0; s < samples_per_pixel; ++s) {
2835+
for (int sample = 0; sample < samples_per_pixel; ++sample) {
28362836
auto u = (i + random_double()) / (image_width-1);
28372837
auto v = (j + random_double()) / (image_height-1);
28382838
ray r = cam.get_ray(u, v);

src/InOneWeekend/scene.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class scene {
3030
std::clog << "\rScanlines remaining: " << j << ' ' << std::flush;
3131
for (int i = 0; i < image_width; ++i) {
3232
color pixel_color(0,0,0);
33-
for (int s = 0; s < samples_per_pixel; ++s) {
33+
for (int sample = 0; sample < samples_per_pixel; ++sample) {
3434
auto u = (i + random_double()) / (image_width-1);
3535
auto v = (j + random_double()) / (image_height-1);
3636
ray r = cam.get_ray(u, v);

src/TheNextWeek/scene.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class scene {
3030
std::clog << "\rScanlines remaining: " << j << ' ' << std::flush;
3131
for (int i = 0; i < image_width; ++i) {
3232
color pixel_color(0,0,0);
33-
for (int s = 0; s < samples_per_pixel; ++s) {
33+
for (int sample = 0; sample < samples_per_pixel; ++sample) {
3434
auto u = (i + random_double()) / (image_width-1);
3535
auto v = (j + random_double()) / (image_height-1);
3636
ray r = cam.get_ray(u, v);

src/TheRestOfYourLife/scene.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class scene {
2828
std::clog << "\rScanlines remaining: " << j << ' ' << std::flush;
2929
for (int i = 0; i < image_width; ++i) {
3030
color pixel_color(0,0,0);
31-
for (int s = 0; s < samples_per_pixel; ++s) {
31+
for (int sample = 0; sample < samples_per_pixel; ++sample) {
3232
auto u = (i + random_double()) / (image_width-1);
3333
auto v = (j + random_double()) / (image_height-1);
3434
ray r = cam.get_ray(u, v);

0 commit comments

Comments
 (0)