impl ray casted render

This commit is contained in:
Shuo Feng 2024-02-19 01:47:35 -05:00
parent ed42a0f9ca
commit 29c5fe91d9
Signed by: sfeng
GPG key ID: 1E83AE6CD1C037B1
5 changed files with 44 additions and 5 deletions

View file

@ -1,6 +1,8 @@
#ifndef GEOMETRY_H_
#define GEOMETRY_H_
#include "Ray.h"
#include <Eigen/Core>
using Eigen::Matrix;
@ -13,7 +15,7 @@ public:
enum class Type { SPHERE, RECTANGLE };
virtual ~Geometry() = default;
virtual bool intersect() const = 0;
virtual bool intersect(const Ray &) const = 0;
protected:
Geometry(Type type, float ka, float kd, float ks, const Vector3f &ca,
@ -37,7 +39,7 @@ public:
: Geometry(Type::SPHERE, ka, kd, ks, ca, cd, cs, pc), radius(radius),
center(center) {}
bool intersect() const override;
bool intersect(const Ray &) const override;
private:
float radius;
@ -51,7 +53,7 @@ public:
: Geometry(Type::RECTANGLE, ka, kd, ks, ca, cd, cs, pc),
corners(corners) {}
bool intersect() const override;
bool intersect(const Ray &) const override;
private:
Matrix<float, 3, 4> corners;