mirror of
https://github.com/vonhyou/ray-tracer-comp371.git
synced 2025-06-08 15:31:59 +00:00
add implementations for geometry methods
This commit is contained in:
parent
e652b957f0
commit
5524343a6e
2 changed files with 13 additions and 0 deletions
9
src/Geometry.cc
Normal file
9
src/Geometry.cc
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
#include "Geometry.h"
|
||||||
|
|
||||||
|
void Geometry::setTransform(const Matrix4f &transform) {
|
||||||
|
this->transform = transform;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Sphere::intersect() const { return false; }
|
||||||
|
|
||||||
|
bool Rectangle::intersect() const { return false; }
|
|
@ -37,6 +37,8 @@ public:
|
||||||
: Geometry(Type::SPHERE, ka, kd, ks, ca, cd, cs, pc), radius(radius),
|
: Geometry(Type::SPHERE, ka, kd, ks, ca, cd, cs, pc), radius(radius),
|
||||||
center(center) {}
|
center(center) {}
|
||||||
|
|
||||||
|
bool intersect() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
float radius;
|
float radius;
|
||||||
Vector3f center;
|
Vector3f center;
|
||||||
|
@ -49,6 +51,8 @@ public:
|
||||||
: Geometry(Type::RECTANGLE, ka, kd, ks, ca, cd, cs, pc),
|
: Geometry(Type::RECTANGLE, ka, kd, ks, ca, cd, cs, pc),
|
||||||
corners(corners) {}
|
corners(corners) {}
|
||||||
|
|
||||||
|
bool intersect() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Matrix<float, 3, 4> corners;
|
Matrix<float, 3, 4> corners;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue