Add function to calculate sphere normal vector on given point on the sphere.

This commit is contained in:
Godzil
2020-02-17 15:39:14 +00:00
parent 656ff52204
commit a8194169c5
5 changed files with 92 additions and 0 deletions

View File

@@ -27,6 +27,8 @@ public:
Object();
virtual Intersect intersect(Ray r);
virtual Tuple normalAt(Tuple point);
void setTransform(Matrix transform);
Ray transform(Ray r) { return Ray(this->transformMatrix * r.origin, this->transformMatrix * r.direction); };
Ray invTransform(Ray r) { return Ray(this->inverseTransform * r.origin, this->inverseTransform * r.direction); };

View File

@@ -18,6 +18,7 @@ class Sphere : public Object
public:
/* All sphere are at (0, 0, 0) and radius 1 in the object space */
virtual Intersect intersect(Ray r);
virtual Tuple normalAt(Tuple point);
};
#endif //DORAYME_SPHERE_H