[FIX] Fix a warning in the hit test
This commit is contained in:
@@ -36,13 +36,14 @@ using namespace Raytracer;
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
Intersection::Intersection(void) : m_distance_t(0.0), m_object()
|
||||
Intersection::Intersection(void) : m_is_nothing(true), m_distance_t(0.0), m_object()
|
||||
{
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
Intersection::Intersection(double a_distance_t, const Object &an_object) :
|
||||
m_is_nothing(true),
|
||||
m_distance_t(a_distance_t),
|
||||
m_object(an_object)
|
||||
{
|
||||
@@ -51,6 +52,7 @@ Intersection::Intersection(double a_distance_t, const Object &an_object) :
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
Intersection::Intersection(Intersection &an_intersection) :
|
||||
m_is_nothing(an_intersection.m_is_nothing),
|
||||
m_distance_t(an_intersection.m_distance_t),
|
||||
m_object(an_intersection.m_object)
|
||||
{
|
||||
@@ -59,6 +61,7 @@ Intersection::Intersection(Intersection &an_intersection) :
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
Intersection::Intersection(const Intersection &an_intersection) :
|
||||
m_is_nothing(an_intersection.m_is_nothing),
|
||||
m_distance_t(an_intersection.m_distance_t),
|
||||
m_object(an_intersection.m_object)
|
||||
{
|
||||
@@ -73,6 +76,7 @@ const Intersection &Intersection::operator=(const Intersection &an_intersection)
|
||||
return *this;
|
||||
}
|
||||
|
||||
m_is_nothing = an_intersection.m_is_nothing;
|
||||
m_distance_t = an_intersection.m_distance_t;
|
||||
m_object = an_intersection.m_object;
|
||||
|
||||
@@ -141,3 +145,10 @@ const Object &Intersection::object(void) const
|
||||
{
|
||||
return m_object;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
bool Intersection::is_nothing(void)
|
||||
{
|
||||
return m_is_nothing;
|
||||
}
|
||||
|
||||
@@ -56,8 +56,10 @@ namespace Raytracer
|
||||
|
||||
double distance_t(void) const;
|
||||
const Object &object(void) const;
|
||||
bool is_nothing(void);
|
||||
|
||||
private:
|
||||
bool m_is_nothing;
|
||||
double m_distance_t;
|
||||
Object m_object;
|
||||
};
|
||||
|
||||
@@ -421,8 +421,7 @@ SCENARIO("The hit, when all intersections have negative t", "[features/intersect
|
||||
auto i = xs.hit();
|
||||
THEN("i is nothing")
|
||||
{
|
||||
#warning TODO
|
||||
// REQUIRE(i.has_value());
|
||||
REQUIRE(i.is_nothing());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
|
||||
project(main_test)
|
||||
project(raytracing_test)
|
||||
|
||||
enable_testing()
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
add_executable(main_test
|
||||
add_executable(raytracing_test
|
||||
main_test.cpp
|
||||
|
||||
01_tuples.cpp
|
||||
@@ -20,5 +20,4 @@ add_executable(main_test
|
||||
|
||||
include_directories("${CMAKE_SOURCE_DIR}/tests")
|
||||
|
||||
target_link_libraries(main_test
|
||||
PRIVATE raytracing)
|
||||
target_link_libraries(raytracing_test PRIVATE raytracing)
|
||||
|
||||
Reference in New Issue
Block a user