Added experimental mirrorshader
This commit is contained in:
parent
29f4d0fe3c
commit
48e027c45d
1 changed files with 5 additions and 5 deletions
|
@ -4,9 +4,9 @@
|
|||
MirrorShader::MirrorShader() {}
|
||||
|
||||
Color MirrorShader::shade(Scene const &scene, Ray const &ray) const {
|
||||
// IMPLEMENT ME
|
||||
// Calculate the reflection vector
|
||||
// Create a new reflection ray
|
||||
// Send the new ray out into the scene and return the result
|
||||
return Color(0, 0, 1);
|
||||
Vector3d newDirection = ray.direction - 2 * dotProduct(ray.normal, ray.direction) * ray.normal;
|
||||
|
||||
//TODO: should we reset the ray or use a new ray? Regarding the count of bounces
|
||||
Ray mirroredRay = Ray(ray.origin + ray.length * ray.direction, newDirection);
|
||||
return scene.traceRay(mirroredRay);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue