20 using Vec3 = Eigen::Vector3f;
46 u = up.cross(
dir).normalized();
57 void lookat(
const Vec3& position,
const Vec3& focus,
const Vec3& up)
61 u = up.cross(
dir).normalized();
80 Eigen::Vector3f
pos{ 0.0f, 0.0f, 0.0f };
85 Eigen::Vector3f
u{ 1.0f, 0.0f, 0.0f };
90 Eigen::Vector3f
v{ 0.0f, 1.0f, 0.0f };
95 Eigen::Vector3f
dir{ 0.0f, 0.0f, 1.0f };
105 float tfar = std::numeric_limits<float>::max();
108 inline Camera::~Camera() {}
115 alignas(32) Eigen::Matrix4f model_matrix;
120 alignas(32) Eigen::Matrix4f mvp;
126 alignas(32) Eigen::Matrix4f normal_matrix;
133 model_matrix.setIdentity();
135 normal_matrix.setIdentity();
142 const Eigen::Matrix4f& view,
143 const Eigen::Matrix4f& projection)
145 model_matrix = model;
146 mvp = projection * view * model;
147 normal_matrix = model.inverse().transpose();
159 alignas(16) Eigen::Array3f ambient;
164 alignas(16) Eigen::Array3f diffuse;
175 alignas(16) Eigen::Array3f position;
180 alignas(16) Eigen::Array3f color;
185 alignas(4)
float intensity;
Eigen::Vector3f u
Right vector.
Definition: RenderCore.h:85
float tnear
The near plane.
Definition: RenderCore.h:100
void lookat(const Vec3 &position, const Vec3 &focus, const Vec3 &up)
Pose the camera according to the parameteres.
Definition: RenderCore.h:57
Eigen::Vector3f pos
Position.
Definition: RenderCore.h:80
void set_range(float tnear, float tfar)
Set the range of the ray.
Definition: RenderCore.h:70
Eigen::Vector3f dir
Negative view vector.
Definition: RenderCore.h:95
float tfar
The far plane.
Definition: RenderCore.h:105
Camera()=default
Create a Camera with default paramters.
A simple Lambertian material model.
Definition: RenderCore.h:154
A basic positionable camera model.
Definition: RenderCore.h:17
Camera(const Vec3 &position, const Vec3 &focus, const Vec3 &up, float tnear, float tfar)
Create a Camera.
Definition: RenderCore.h:38
CGAL::Vector_3< Kernel > normalized(const CGAL::Vector_3< Kernel > &vec)
Return a normalized version of the input vector.
Definition: Vector.cpp:32
A simple point light model.
Definition: RenderCore.h:170
Eigen::Vector3f v
Up vector.
Definition: RenderCore.h:90