Added some proper test scenes for chapter 11.
This commit is contained in:
@@ -55,7 +55,7 @@ Ray Camera::rayForPixel(uint32_t pixelX, uint32_t pixelY)
|
||||
return Ray(origin, direction);
|
||||
}
|
||||
|
||||
Canvas Camera::render(World world)
|
||||
Canvas Camera::render(World world, uint32_t depth)
|
||||
{
|
||||
uint32_t x, y;
|
||||
Canvas image = Canvas(this->horizontalSize, this->verticalSize);
|
||||
@@ -65,7 +65,7 @@ Canvas Camera::render(World world)
|
||||
for(x = 0; x < this->horizontalSize; x++)
|
||||
{
|
||||
Ray r = this->rayForPixel(x, y);
|
||||
Tuple colour = world.colourAt(r);
|
||||
Tuple colour = world.colourAt(r, depth);
|
||||
image.putPixel(x, y, colour);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
Camera(uint32_t hsize, uint32_t vsize, double fov);
|
||||
void setTransform(Matrix transform);
|
||||
Ray rayForPixel(uint32_t pixelX, uint32_t pixelY);
|
||||
Canvas render(World w);
|
||||
Canvas render(World w, uint32_t depth = 5);
|
||||
};
|
||||
|
||||
#endif /* DORAYME_CAMERA_H */
|
||||
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
bool isShadowed(Tuple point);
|
||||
|
||||
Colour reflectColour(Computation comps, uint32_t depthCount = 4);
|
||||
Colour refractedColour(Computation comps, uint32_t depthCount = 0);
|
||||
Colour refractedColour(Computation comps, uint32_t depthCount = 4);
|
||||
|
||||
Intersect intersect(Ray r);
|
||||
|
||||
|
||||
@@ -175,6 +175,5 @@ Colour World::refractedColour(Computation comps, uint32_t depthCount)
|
||||
|
||||
Tuple hitColour = this->colourAt(refractedRay, depthCount - 1) * comps.object->material.transparency;
|
||||
|
||||
|
||||
return Colour(hitColour.x, hitColour.y, hitColour.z);
|
||||
}
|
||||
Reference in New Issue
Block a user