Skip to content

Commit 5119568

Browse files
committed
Constant material working
1 parent 98d5b7e commit 5119568

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/302_raytracer/camera.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,10 @@ class Camera
316316
Ray scattered;
317317
Color attenuation;
318318

319+
if (Constant* c = dynamic_cast<Constant*>(rec.mat_ptr.get())) {
320+
return c->albedo;
321+
}
322+
319323
if (rec.mat_ptr->scatter(r, rec, attenuation, scattered))
320324
{
321325
// For constant materials, the scattered ray direction is zero, so we just return the attenuation

0 commit comments

Comments
 (0)