[ADD] Add skeleton form normal test
This commit is contained in:
@@ -33,8 +33,6 @@ using namespace Raytracer;
|
|||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
SCENARIO("Creating and querying a ray", "[features/rays.feature]")
|
SCENARIO("Creating and querying a ray", "[features/rays.feature]")
|
||||||
{
|
{
|
||||||
GIVEN("origin <- point(1, 2, 3)")
|
GIVEN("origin <- point(1, 2, 3)")
|
||||||
|
|||||||
107
tests/06_light_shading.cpp
Normal file
107
tests/06_light_shading.cpp
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
/*!
|
||||||
|
* 06_light_shading.cpp
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015-2024, NADAL Jean-Baptiste. All rights reserved.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @Author: NADAL Jean-Baptiste
|
||||||
|
* @Date: 14/02/2024
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include <catch.hpp>
|
||||||
|
|
||||||
|
#include "raytracing.h"
|
||||||
|
|
||||||
|
using namespace Raytracer;
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
SCENARIO("The normal on a sphere at point a on the x axis", "[features/spheres.feature]")
|
||||||
|
{
|
||||||
|
GIVEN("s <- sphere()")
|
||||||
|
{
|
||||||
|
WHEN("n <- normal_at(s, point(1,0,0))")
|
||||||
|
{
|
||||||
|
THEN("n = vector(1,0,0)")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
SCENARIO("The normal on a sphere at point a on the y axis", "[features/spheres.feature]")
|
||||||
|
{
|
||||||
|
GIVEN("s <- sphere()")
|
||||||
|
{
|
||||||
|
WHEN("n <- normal_at(s, point(0,1,0))")
|
||||||
|
{
|
||||||
|
THEN("n = vector(0,1,0)")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
SCENARIO("The normal on a sphere at point a on the z axis", "[features/spheres.feature]")
|
||||||
|
{
|
||||||
|
GIVEN("s <- sphere()")
|
||||||
|
{
|
||||||
|
WHEN("n <- normal_at(s, point(0,0,1))")
|
||||||
|
{
|
||||||
|
THEN("n = vector(0,0,1)")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
SCENARIO("The normal on a sphere at a nonaxial point", "[features/spheres.feature]")
|
||||||
|
{
|
||||||
|
GIVEN("s <- sphere()")
|
||||||
|
{
|
||||||
|
WHEN("n <- normal_at(s, point(sqrt(3)/3,sqrt(3)/3,sqrt(3)/3))")
|
||||||
|
{
|
||||||
|
THEN("n = vector(sqrt(3)/3,sqrt(3)/3,sqrt(3)/3)")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
SCENARIO("The normal is a normalized vector", "[features/spheres.feature]")
|
||||||
|
{
|
||||||
|
GIVEN("s <- sphere()")
|
||||||
|
{
|
||||||
|
WHEN("n <- normal_at(s, point(sqrt(3)/3,sqrt(3)/3,sqrt(3)/3))")
|
||||||
|
{
|
||||||
|
THEN("n = normalize(n)")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,6 +16,7 @@ add_executable(raytracing_test
|
|||||||
03_matrix.cpp
|
03_matrix.cpp
|
||||||
04_transformations.cpp
|
04_transformations.cpp
|
||||||
05_rays.cpp
|
05_rays.cpp
|
||||||
|
06_light_shading.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
include_directories("${CMAKE_SOURCE_DIR}/tests")
|
include_directories("${CMAKE_SOURCE_DIR}/tests")
|
||||||
|
|||||||
Reference in New Issue
Block a user