From bb7058027477f9c24e5022ba74c45a6ba4b698e1 Mon Sep 17 00:00:00 2001 From: vonhyou Date: Tue, 19 Mar 2024 23:59:11 -0400 Subject: [PATCH] add default constructors for Optional --- src/HitRecord.h | 2 ++ src/Ray.h | 1 + 2 files changed, 3 insertions(+) diff --git a/src/HitRecord.h b/src/HitRecord.h index 599db5a..7c13aa1 100644 --- a/src/HitRecord.h +++ b/src/HitRecord.h @@ -9,6 +9,8 @@ using Eigen::Vector3f; class HitRecord { public: + HitRecord() + : t(0), ray_(Ray()), normal_(Vector3f::Zero()), geometry_(nullptr) {} HitRecord(float t, const Ray &r, Geometry *g) : t(t), ray_(r), geometry_(g) {} bool operator<(const HitRecord &) const; diff --git a/src/Ray.h b/src/Ray.h index a344e5d..252952f 100644 --- a/src/Ray.h +++ b/src/Ray.h @@ -7,6 +7,7 @@ using Eigen::Vector3f; class Ray { public: + Ray() : origin_(Vector3f::Zero()), direction_(Vector3f::Zero()) {} Ray(const Vector3f &o, const Vector3f &d) : origin_(o), direction_(d) {} private: