diff --git a/books/RayTracingInOneWeekend.html b/books/RayTracingInOneWeekend.html
index 90a5eba4..3c21e054 100644
--- a/books/RayTracingInOneWeekend.html
+++ b/books/RayTracingInOneWeekend.html
@@ -122,9 +122,9 @@
auto g = double(j) / (image_height-1);
auto b = 0;
- int ir = static_cast(255.999 * r);
- int ig = static_cast(255.999 * g);
- int ib = static_cast(255.999 * b);
+ int ir = int(255.999 * r);
+ int ig = int(255.999 * g);
+ int ib = int(255.999 * b);
std::cout << ir << ' ' << ig << ' ' << ib << '\n';
}
@@ -240,9 +240,9 @@
auto g = double(j) / (image_height-1);
auto b = 0;
- int ir = static_cast(255.999 * r);
- int ig = static_cast(255.999 * g);
- int ib = static_cast(255.999 * b);
+ int ir = int(255.999 * r);
+ int ig = int(255.999 * g);
+ int ib = int(255.999 * b);
std::cout << ir << ' ' << ig << ' ' << ib << '\n';
}
@@ -405,9 +405,9 @@
void write_color(std::ostream &out, color pixel_color) {
// Write the translated [0,255] value of each color component.
- out << static_cast(255.999 * pixel_color.x()) << ' '
- << static_cast(255.999 * pixel_color.y()) << ' '
- << static_cast(255.999 * pixel_color.z()) << '\n';
+ out << int(255.999 * pixel_color.x()) << ' '
+ << int(255.999 * pixel_color.y()) << ' '
+ << int(255.999 * pixel_color.z()) << '\n';
}
#endif
@@ -548,12 +548,12 @@
int image_width = 400;
// Calculate the image height, and ensure that it's at least 1.
- int image_height = static_cast(image_width / aspect_ratio);
+ int image_height = int(image_width / aspect_ratio);
image_height = (image_height < 1) ? 1 : image_height;
// Viewport widths less than one are ok since they are real valued.
auto viewport_height = 2.0;
- auto viewport_width = viewport_height * (static_cast(image_width)/image_height);
+ auto viewport_width = viewport_height * (double(image_width)/image_height);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[Listing [image-setup]: Rendered image setup]
@@ -634,14 +634,14 @@
int image_width = 400;
// Calculate the image height, and ensure that it's at least 1.
- int image_height = static_cast(image_width / aspect_ratio);
+ int image_height = int(image_width / aspect_ratio);
image_height = (image_height < 1) ? 1 : image_height;
// Camera
auto focal_length = 1.0;
auto viewport_height = 2.0;
- auto viewport_width = viewport_height * (static_cast(image_width)/image_height);
+ auto viewport_width = viewport_height * (double(image_width)/image_height);
auto camera_center = point3(0, 0, 0);
// Calculate the vectors across the horizontal and down the vertical viewport edges.
@@ -1426,7 +1426,7 @@
int image_width = 400;
// Calculate the image height, and ensure that it's at least 1.
- int image_height = static_cast(image_width / aspect_ratio);
+ int image_height = int(image_width / aspect_ratio);
image_height = (image_height < 1) ? 1 : image_height;
@@ -1443,7 +1443,7 @@
auto focal_length = 1.0;
auto viewport_height = 2.0;
- auto viewport_width = viewport_height * (static_cast(image_width)/image_height);
+ auto viewport_width = viewport_height * (double(image_width)/image_height);
auto camera_center = point3(0, 0, 0);
// Calculate the vectors across the horizontal and down the vertical viewport edges.
@@ -1781,7 +1781,7 @@
vec3 pixel_delta_v; // Offset to pixel below
void initialize() {
- image_height = static_cast(image_width / aspect_ratio);
+ image_height = int(image_width / aspect_ratio);
image_height = (image_height < 1) ? 1 : image_height;
center = point3(0, 0, 0);
@@ -1789,7 +1789,7 @@
// Determine viewport dimensions.
auto focal_length = 1.0;
auto viewport_height = 2.0;
- auto viewport_width = viewport_height * (static_cast(image_width)/image_height);
+ auto viewport_width = viewport_height * (double(image_width)/image_height);
// Calculate the vectors across the horizontal and down the vertical viewport edges.
auto viewport_u = vec3(viewport_width, 0, 0);
@@ -1986,9 +1986,9 @@
// Write the translated [0,255] value of each color component.
static const interval intensity(0.000, 0.999);
- out << static_cast(256 * intensity.clamp(r)) << ' '
- << static_cast(256 * intensity.clamp(g)) << ' '
- << static_cast(256 * intensity.clamp(b)) << '\n';
+ out << int(256 * intensity.clamp(r)) << ' '
+ << int(256 * intensity.clamp(g)) << ' '
+ << int(256 * intensity.clamp(b)) << '\n';
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[Listing [write-color-clamped]: [color.h] The multi-sample write_color() function]
@@ -2632,9 +2632,9 @@
// Write the translated [0,255] value of each color component.
static const interval intensity(0.000, 0.999);
- out << static_cast(256 * intensity.clamp(r)) << ' '
- << static_cast(256 * intensity.clamp(g)) << ' '
- << static_cast(256 * intensity.clamp(b)) << '\n';
+ out << int(256 * intensity.clamp(r)) << ' '
+ << int(256 * intensity.clamp(g)) << ' '
+ << int(256 * intensity.clamp(b)) << '\n';
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[Listing [write-color-gamma]: [color.h] write_color(), with gamma correction]
@@ -3484,7 +3484,7 @@
...
void initialize() {
- image_height = static_cast(image_width / aspect_ratio);
+ image_height = int(image_width / aspect_ratio);
image_height = (image_height < 1) ? 1 : image_height;
center = point3(0, 0, 0);
@@ -3496,7 +3496,7 @@
auto h = tan(theta/2);
auto viewport_height = 2 * h * focal_length;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
- auto viewport_width = viewport_height * (static_cast(image_width)/image_height);
+ auto viewport_width = viewport_height * (double(image_width)/image_height);
// Calculate the vectors across the horizontal and down the vertical viewport edges.
auto viewport_u = vec3(viewport_width, 0, 0);
@@ -3621,7 +3621,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
void initialize() {
- image_height = static_cast(image_width / aspect_ratio);
+ image_height = int(image_width / aspect_ratio);
image_height = (image_height < 1) ? 1 : image_height;
@@ -3636,7 +3636,7 @@
auto theta = degrees_to_radians(vfov);
auto h = tan(theta/2);
auto viewport_height = 2 * h * focal_length;
- auto viewport_width = viewport_height * (static_cast(image_width)/image_height);
+ auto viewport_width = viewport_height * (double(image_width)/image_height);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
@@ -3866,7 +3866,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
void initialize() {
- image_height = static_cast(image_width / aspect_ratio);
+ image_height = int(image_width / aspect_ratio);
image_height = (image_height < 1) ? 1 : image_height;
center = lookfrom;
@@ -3880,7 +3880,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
auto viewport_height = 2 * h * focus_dist;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
- auto viewport_width = viewport_height * (static_cast(image_width)/image_height);
+ auto viewport_width = viewport_height * (double(image_width)/image_height);
// Calculate the u,v,w unit basis vectors for the camera coordinate frame.
w = unit_vector(lookfrom - lookat);
diff --git a/books/RayTracingTheNextWeek.html b/books/RayTracingTheNextWeek.html
index a9d4981f..35d671ff 100644
--- a/books/RayTracingTheNextWeek.html
+++ b/books/RayTracingTheNextWeek.html
@@ -969,7 +969,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
inline int random_int(int min, int max) {
// Returns a random integer in [min,max].
- return static_cast(random_double(min, max+1));
+ return int(random_double(min, max+1));
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[Listing [random-int]: [rtweekend.h] A function to return random integers in a range]
@@ -1271,9 +1271,9 @@
{}
color value(double u, double v, const point3& p) const override {
- auto xInteger = static_cast(std::floor(inv_scale * p.x()));
- auto yInteger = static_cast(std::floor(inv_scale * p.y()));
- auto zInteger = static_cast(std::floor(inv_scale * p.z()));
+ auto xInteger = int(std::floor(inv_scale * p.x()));
+ auto yInteger = int(std::floor(inv_scale * p.y()));
+ auto zInteger = int(std::floor(inv_scale * p.z()));
bool isEven = (xInteger + yInteger + zInteger) % 2 == 0;
@@ -1739,8 +1739,8 @@
u = interval(0,1).clamp(u);
v = 1.0 - interval(0,1).clamp(v); // Flip V to image coordinates
- auto i = static_cast(u * image.width());
- auto j = static_cast(v * image.height());
+ auto i = int(u * image.width());
+ auto j = int(v * image.height());
auto pixel = image.pixel_data(i,j);
auto color_scale = 1.0 / 255.0;
@@ -1877,9 +1877,9 @@
}
double noise(const point3& p) const {
- auto i = static_cast(4*p.x()) & 255;
- auto j = static_cast(4*p.y()) & 255;
- auto k = static_cast(4*p.z()) & 255;
+ auto i = int(4*p.x()) & 255;
+ auto j = int(4*p.y()) & 255;
+ auto k = int(4*p.z()) & 255;
return ranfloat[perm_x[i] ^ perm_y[j] ^ perm_z[k]];
}
@@ -2010,9 +2010,9 @@
auto v = p.y() - floor(p.y());
auto w = p.z() - floor(p.z());
- auto i = static_cast(floor(p.x()));
- auto j = static_cast(floor(p.y()));
- auto k = static_cast(floor(p.z()));
+ auto i = int(floor(p.x()));
+ auto j = int(floor(p.y()));
+ auto k = int(floor(p.z()));
double c[2][2][2];
for (int di=0; di < 2; di++)
@@ -2078,9 +2078,9 @@
w = w*w*(3-2*w);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
- auto i = static_cast(floor(p.x()));
- auto j = static_cast(floor(p.y()));
- auto k = static_cast(floor(p.z()));
+ auto i = int(floor(p.x()));
+ auto j = int(floor(p.y()));
+ auto k = int(floor(p.z()));
...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[Listing [perlin-smoothed]: [perlin.h] Perlin smoothed]
@@ -2214,9 +2214,9 @@
auto v = p.y() - floor(p.y());
auto w = p.z() - floor(p.z());
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
- auto i = static_cast(floor(p.x()));
- auto j = static_cast(floor(p.y()));
- auto k = static_cast(floor(p.z()));
+ auto i = int(floor(p.x()));
+ auto j = int(floor(p.y()));
+ auto k = int(floor(p.z()));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
vec3 c[2][2][2];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
diff --git a/books/RayTracingTheRestOfYourLife.html b/books/RayTracingTheRestOfYourLife.html
index b6c6b899..25d28d48 100644
--- a/books/RayTracingTheRestOfYourLife.html
+++ b/books/RayTracingTheRestOfYourLife.html
@@ -3597,7 +3597,7 @@
}
vec3 random(const vec3& o) const override {
- auto int_size = static_cast(objects.size());
+ auto int_size = int(objects.size());
return objects[random_int(0, int_size-1)]->random(o);
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
@@ -3681,9 +3681,9 @@
// Write the translated [0,255] value of each color component.
static const interval intensity(0.000, 0.999);
- out << static_cast(256 * intensity.clamp(r)) << ' '
- << static_cast(256 * intensity.clamp(g)) << ' '
- << static_cast(256 * intensity.clamp(b)) << '\n';
+ out << int(256 * intensity.clamp(r)) << ' '
+ << int(256 * intensity.clamp(g)) << ' '
+ << int(256 * intensity.clamp(b)) << '\n';
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[Listing [write-color-nan]: [color.h] NaN-tolerant write_color function]
diff --git a/src/InOneWeekend/camera.h b/src/InOneWeekend/camera.h
index 21fc1b87..6b9fb684 100644
--- a/src/InOneWeekend/camera.h
+++ b/src/InOneWeekend/camera.h
@@ -66,7 +66,7 @@ class camera {
vec3 defocus_disk_v; // Defocus disk vertical radius
void initialize() {
- image_height = static_cast(image_width / aspect_ratio);
+ image_height = int(image_width / aspect_ratio);
image_height = (image_height < 1) ? 1 : image_height;
center = lookfrom;
@@ -75,7 +75,7 @@ class camera {
auto theta = degrees_to_radians(vfov);
auto h = tan(theta/2);
auto viewport_height = 2 * h * focus_dist;
- auto viewport_width = viewport_height * (static_cast(image_width)/image_height);
+ auto viewport_width = viewport_height * (double(image_width)/image_height);
// Calculate the u,v,w unit basis vectors for the camera coordinate frame.
w = unit_vector(lookfrom - lookat);
diff --git a/src/InOneWeekend/color.h b/src/InOneWeekend/color.h
index 9abe1f62..7310eff3 100644
--- a/src/InOneWeekend/color.h
+++ b/src/InOneWeekend/color.h
@@ -43,9 +43,9 @@ void write_color(std::ostream &out, color pixel_color, int samples_per_pixel) {
// Write the translated [0,255] value of each color component.
static const interval intensity(0.000, 0.999);
- out << static_cast(256 * intensity.clamp(r)) << ' '
- << static_cast(256 * intensity.clamp(g)) << ' '
- << static_cast(256 * intensity.clamp(b)) << '\n';
+ out << int(256 * intensity.clamp(r)) << ' '
+ << int(256 * intensity.clamp(g)) << ' '
+ << int(256 * intensity.clamp(b)) << '\n';
}
diff --git a/src/TheNextWeek/camera.h b/src/TheNextWeek/camera.h
index b5d4763b..e1da604a 100644
--- a/src/TheNextWeek/camera.h
+++ b/src/TheNextWeek/camera.h
@@ -67,7 +67,7 @@ class camera {
vec3 defocus_disk_v; // Defocus disk vertical radius
void initialize() {
- image_height = static_cast(image_width / aspect_ratio);
+ image_height = int(image_width / aspect_ratio);
image_height = (image_height < 1) ? 1 : image_height;
center = lookfrom;
@@ -76,7 +76,7 @@ class camera {
auto theta = degrees_to_radians(vfov);
auto h = tan(theta/2);
auto viewport_height = 2 * h * focus_dist;
- auto viewport_width = viewport_height * (static_cast(image_width)/image_height);
+ auto viewport_width = viewport_height * (double(image_width)/image_height);
// Calculate the u,v,w unit basis vectors for the camera coordinate frame.
w = unit_vector(lookfrom - lookat);
diff --git a/src/TheNextWeek/color.h b/src/TheNextWeek/color.h
index 2611fa6b..bfe08c63 100644
--- a/src/TheNextWeek/color.h
+++ b/src/TheNextWeek/color.h
@@ -43,9 +43,9 @@ void write_color(std::ostream &out, color pixel_color, int samples_per_pixel) {
// Write the translated [0,255] value of each color component.
static const interval intensity(0.000, 0.999);
- out << static_cast(256 * intensity.clamp(r)) << ' '
- << static_cast(256 * intensity.clamp(g)) << ' '
- << static_cast(256 * intensity.clamp(b)) << '\n';
+ out << int(256 * intensity.clamp(r)) << ' '
+ << int(256 * intensity.clamp(g)) << ' '
+ << int(256 * intensity.clamp(b)) << '\n';
}
diff --git a/src/TheNextWeek/perlin.h b/src/TheNextWeek/perlin.h
index f531d78d..be812ab1 100644
--- a/src/TheNextWeek/perlin.h
+++ b/src/TheNextWeek/perlin.h
@@ -38,9 +38,9 @@ class perlin {
auto u = p.x() - floor(p.x());
auto v = p.y() - floor(p.y());
auto w = p.z() - floor(p.z());
- auto i = static_cast(floor(p.x()));
- auto j = static_cast(floor(p.y()));
- auto k = static_cast(floor(p.z()));
+ auto i = int(floor(p.x()));
+ auto j = int(floor(p.y()));
+ auto k = int(floor(p.z()));
vec3 c[2][2][2];
for (int di=0; di < 2; di++)
diff --git a/src/TheNextWeek/rtweekend.h b/src/TheNextWeek/rtweekend.h
index 2b821d92..1269c358 100644
--- a/src/TheNextWeek/rtweekend.h
+++ b/src/TheNextWeek/rtweekend.h
@@ -44,7 +44,7 @@ inline double random_double(double min, double max) {
inline int random_int(int min, int max) {
// Returns a random integer in [min,max].
- return static_cast(random_double(min, max+1));
+ return int(random_double(min, max+1));
}
// Common Headers
diff --git a/src/TheNextWeek/texture.h b/src/TheNextWeek/texture.h
index 4b3c31ce..f194ba5f 100644
--- a/src/TheNextWeek/texture.h
+++ b/src/TheNextWeek/texture.h
@@ -53,9 +53,9 @@ class checker_texture : public texture {
{}
color value(double u, double v, const point3& p) const override {
- auto xInteger = static_cast(std::floor(inv_scale * p.x()));
- auto yInteger = static_cast(std::floor(inv_scale * p.y()));
- auto zInteger = static_cast(std::floor(inv_scale * p.z()));
+ auto xInteger = int(std::floor(inv_scale * p.x()));
+ auto yInteger = int(std::floor(inv_scale * p.y()));
+ auto zInteger = int(std::floor(inv_scale * p.z()));
bool isEven = (xInteger + yInteger + zInteger) % 2 == 0;
@@ -98,8 +98,8 @@ class image_texture : public texture {
u = interval(0,1).clamp(u);
v = 1.0 - interval(0,1).clamp(v); // Flip V to image coordinates
- auto i = static_cast(u * image.width());
- auto j = static_cast(v * image.height());
+ auto i = int(u * image.width());
+ auto j = int(v * image.height());
auto pixel = image.pixel_data(i,j);
auto color_scale = 1.0 / 255.0;
diff --git a/src/TheRestOfYourLife/camera.h b/src/TheRestOfYourLife/camera.h
index 2216e68c..6c76fc00 100644
--- a/src/TheRestOfYourLife/camera.h
+++ b/src/TheRestOfYourLife/camera.h
@@ -71,7 +71,7 @@ class camera {
vec3 defocus_disk_v; // Defocus disk vertical radius
void initialize() {
- image_height = static_cast(image_width / aspect_ratio);
+ image_height = int(image_width / aspect_ratio);
image_height = (image_height < 1) ? 1 : image_height;
center = lookfrom;
@@ -80,9 +80,9 @@ class camera {
auto theta = degrees_to_radians(vfov);
auto h = tan(theta/2);
auto viewport_height = 2 * h * focus_dist;
- auto viewport_width = viewport_height * (static_cast(image_width)/image_height);
+ auto viewport_width = viewport_height * (double(image_width)/image_height);
- sqrt_spp = static_cast(sqrt(samples_per_pixel));
+ sqrt_spp = int(sqrt(samples_per_pixel));
recip_sqrt_spp = 1.0 / sqrt_spp;
// Calculate the u,v,w unit basis vectors for the camera coordinate frame.
diff --git a/src/TheRestOfYourLife/color.h b/src/TheRestOfYourLife/color.h
index 5b32abc7..70845eac 100644
--- a/src/TheRestOfYourLife/color.h
+++ b/src/TheRestOfYourLife/color.h
@@ -48,9 +48,9 @@ void write_color(std::ostream &out, color pixel_color, int samples_per_pixel) {
// Write the translated [0,255] value of each color component.
static const interval intensity(0.000, 0.999);
- out << static_cast(256 * intensity.clamp(r)) << ' '
- << static_cast(256 * intensity.clamp(g)) << ' '
- << static_cast(256 * intensity.clamp(b)) << '\n';
+ out << int(256 * intensity.clamp(r)) << ' '
+ << int(256 * intensity.clamp(g)) << ' '
+ << int(256 * intensity.clamp(b)) << '\n';
}
diff --git a/src/TheRestOfYourLife/hittable_list.h b/src/TheRestOfYourLife/hittable_list.h
index 99c97c07..4fe04898 100644
--- a/src/TheRestOfYourLife/hittable_list.h
+++ b/src/TheRestOfYourLife/hittable_list.h
@@ -63,7 +63,7 @@ class hittable_list : public hittable {
}
vec3 random(const vec3 &o) const override {
- auto int_size = static_cast(objects.size());
+ auto int_size = int(objects.size());
return objects[random_int(0, int_size-1)]->random(o);
}
diff --git a/src/TheRestOfYourLife/perlin.h b/src/TheRestOfYourLife/perlin.h
index f531d78d..be812ab1 100644
--- a/src/TheRestOfYourLife/perlin.h
+++ b/src/TheRestOfYourLife/perlin.h
@@ -38,9 +38,9 @@ class perlin {
auto u = p.x() - floor(p.x());
auto v = p.y() - floor(p.y());
auto w = p.z() - floor(p.z());
- auto i = static_cast(floor(p.x()));
- auto j = static_cast(floor(p.y()));
- auto k = static_cast(floor(p.z()));
+ auto i = int(floor(p.x()));
+ auto j = int(floor(p.y()));
+ auto k = int(floor(p.z()));
vec3 c[2][2][2];
for (int di=0; di < 2; di++)
diff --git a/src/TheRestOfYourLife/rtweekend.h b/src/TheRestOfYourLife/rtweekend.h
index 2b821d92..1269c358 100644
--- a/src/TheRestOfYourLife/rtweekend.h
+++ b/src/TheRestOfYourLife/rtweekend.h
@@ -44,7 +44,7 @@ inline double random_double(double min, double max) {
inline int random_int(int min, int max) {
// Returns a random integer in [min,max].
- return static_cast(random_double(min, max+1));
+ return int(random_double(min, max+1));
}
// Common Headers
diff --git a/src/TheRestOfYourLife/texture.h b/src/TheRestOfYourLife/texture.h
index 4b3c31ce..f194ba5f 100644
--- a/src/TheRestOfYourLife/texture.h
+++ b/src/TheRestOfYourLife/texture.h
@@ -53,9 +53,9 @@ class checker_texture : public texture {
{}
color value(double u, double v, const point3& p) const override {
- auto xInteger = static_cast(std::floor(inv_scale * p.x()));
- auto yInteger = static_cast(std::floor(inv_scale * p.y()));
- auto zInteger = static_cast(std::floor(inv_scale * p.z()));
+ auto xInteger = int(std::floor(inv_scale * p.x()));
+ auto yInteger = int(std::floor(inv_scale * p.y()));
+ auto zInteger = int(std::floor(inv_scale * p.z()));
bool isEven = (xInteger + yInteger + zInteger) % 2 == 0;
@@ -98,8 +98,8 @@ class image_texture : public texture {
u = interval(0,1).clamp(u);
v = 1.0 - interval(0,1).clamp(v); // Flip V to image coordinates
- auto i = static_cast(u * image.width());
- auto j = static_cast(v * image.height());
+ auto i = int(u * image.width());
+ auto j = int(v * image.height());
auto pixel = image.pixel_data(i,j);
auto color_scale = 1.0 / 255.0;