summaryrefslogtreecommitdiff
path: root/material_diffusive.cpp
diff options
context:
space:
mode:
authorKeuin <[email protected]>2022-04-15 14:49:53 +0800
committerKeuin <[email protected]>2022-04-15 14:49:53 +0800
commit36689dfeb8e2e9dcd29c7820dabd5ccaa971a337 (patch)
treeb8c90ab75d09bcedc9e4e9da6eab7af1b71f00d7 /material_diffusive.cpp
parent1ed823c4fc7ad137b88019a2fa9f17ae3d10215d (diff)
Bugfix: wrong assertion.
Diffstat (limited to 'material_diffusive.cpp')
-rw-r--r--material_diffusive.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/material_diffusive.cpp b/material_diffusive.cpp
index 74f58f7..b3f0207 100644
--- a/material_diffusive.cpp
+++ b/material_diffusive.cpp
@@ -20,8 +20,12 @@ bool material_diffuse_lambertian::scatter(ray3d &r, const object &hit_obj, doubl
}
material_diffuse_lambertian::material_diffuse_lambertian(vec3d albedo) : albedo(albedo) {
- assert(albedo.mod2() >= 0);
- assert(albedo.mod2() <= 1);
+ assert(albedo.x >= 0);
+ assert(albedo.y >= 0);
+ assert(albedo.z >= 0);
+ assert(albedo.x <= 1);
+ assert(albedo.y <= 1);
+ assert(albedo.z <= 1);
}
material_diffuse_lambertian::material_diffuse_lambertian(double albedo) : albedo{albedo, albedo, albedo} {
@@ -30,8 +34,12 @@ material_diffuse_lambertian::material_diffuse_lambertian(double albedo) : albedo
}
material_diffuse_simple::material_diffuse_simple(vec3d albedo) : albedo(albedo) {
- assert(albedo.mod2() >= 0);
- assert(albedo.mod2() <= 1);
+ assert(albedo.x >= 0);
+ assert(albedo.y >= 0);
+ assert(albedo.z >= 0);
+ assert(albedo.x <= 1);
+ assert(albedo.y <= 1);
+ assert(albedo.z <= 1);
}
bool material_diffuse_simple::scatter(ray3d &r, const object &hit_obj, double hit_t, random_uv_gen_3d &ruvg) const {
@@ -53,8 +61,12 @@ material_diffuse_simple::material_diffuse_simple(double albedo) : albedo{albedo,
}
material_diffuse_hemispherical::material_diffuse_hemispherical(vec3d albedo) : albedo(albedo) {
- assert(albedo.mod2() >= 0);
- assert(albedo.mod2() <= 1);
+ assert(albedo.x >= 0);
+ assert(albedo.y >= 0);
+ assert(albedo.z >= 0);
+ assert(albedo.x <= 1);
+ assert(albedo.y <= 1);
+ assert(albedo.z <= 1);
}
bool