Adding shadows!
This commit is contained in:
@@ -16,11 +16,13 @@ class Shape;
|
||||
|
||||
struct Computation
|
||||
{
|
||||
Computation(Shape *object, double t, Tuple point, Tuple eyev, Tuple normalv, bool inside) :
|
||||
object(object), t(t), hitPoint(point), eyeVector(eyev), normalVector(normalv), inside(inside) { };
|
||||
Computation(Shape *object, double t, Tuple point, Tuple eyev, Tuple normalv, Tuple overHitP, bool inside) :
|
||||
object(object), t(t), hitPoint(point), eyeVector(eyev), normalVector(normalv), inside(inside), overHitPoint(overHitP) { };
|
||||
|
||||
Shape *object;
|
||||
double t;
|
||||
Tuple hitPoint;
|
||||
Tuple overHitPoint;
|
||||
Tuple eyeVector;
|
||||
Tuple normalVector;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
public:
|
||||
Material() : colour(Colour(1, 1, 1)), ambient(0.1), diffuse(0.9), specular(0.9), shininess(200) {};
|
||||
|
||||
Colour lighting(Light light, Tuple point, Tuple eyeVector, Tuple normalVector);
|
||||
Colour lighting(Light light, Tuple point, Tuple eyeVector, Tuple normalVector, bool inShadow = false);
|
||||
|
||||
bool operator==(const Material &b) const { return double_equal(this->ambient, b.ambient) &&
|
||||
double_equal(this->diffuse, b.diffuse) &&
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <math.h>
|
||||
|
||||
void set_equal_precision(double v);
|
||||
double getEpsilon();
|
||||
bool double_equal(double a, double b);
|
||||
|
||||
double deg_to_rad(double deg);
|
||||
|
||||
@@ -43,6 +43,7 @@ public:
|
||||
|
||||
Tuple shadeHit(Computation comps);;
|
||||
Tuple colourAt(Ray r);
|
||||
bool isShadowed(Tuple point);
|
||||
|
||||
Intersect intersect(Ray r);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user