diff --git a/raytracing/src/core/intersection-data.cpp b/raytracing/src/core/intersection-data.cpp index e7954a5..fb3f958 100644 --- a/raytracing/src/core/intersection-data.cpp +++ b/raytracing/src/core/intersection-data.cpp @@ -55,6 +55,47 @@ IntersectionData::~IntersectionData(void) /* ------------------------------------------------------------------------- */ +IntersectionData::IntersectionData(const IntersectionData &a_copy) : + m_is_inside(a_copy.m_is_inside), + m_distance(a_copy.m_distance), + m_shape(a_copy.m_shape), + m_point(a_copy.m_point), + m_over_point(a_copy.m_over_point), + m_under_point(a_copy.m_under_point), + m_eyev(a_copy.m_eyev), + m_normalv(a_copy.m_normalv), + m_reflectv(a_copy.m_reflectv), + m_n1(a_copy.m_n1), + m_n2(a_copy.m_n2) +{ +} + +/* ------------------------------------------------------------------------- */ + +const IntersectionData &IntersectionData::operator=(const IntersectionData &an_other) +{ + if (this == &an_other) + { + return *this; + } + + m_is_inside = an_other.m_is_inside; + m_distance = an_other.m_distance; + m_shape = an_other.m_shape; + m_point = an_other.m_point; + m_over_point = an_other.m_over_point; + m_under_point = an_other.m_under_point; + m_eyev = an_other.m_eyev; + m_normalv = an_other.m_normalv; + m_reflectv = an_other.m_reflectv; + m_n1 = an_other.m_n1; + m_n2 = an_other.m_n2; + + return *this; +} + +/* ------------------------------------------------------------------------- */ + double IntersectionData::distance_t(void) const { return m_distance; diff --git a/raytracing/src/core/intersection-data.h b/raytracing/src/core/intersection-data.h index 576defd..ca18735 100644 --- a/raytracing/src/core/intersection-data.h +++ b/raytracing/src/core/intersection-data.h @@ -42,6 +42,9 @@ namespace Raytracer IntersectionData(void); ~IntersectionData(void); + IntersectionData(const IntersectionData &a_copy); + const IntersectionData &operator=(const IntersectionData &an_other); + double distance_t(void) const; void set_distance_t(double a_value);