[ADD] add a skeleton of the group and refactor some test datas.
This commit is contained in:
114
tests/common_data.h
Normal file
114
tests/common_data.h
Normal file
@@ -0,0 +1,114 @@
|
||||
/*!
|
||||
* sphere.h
|
||||
*
|
||||
* Copyright (c) 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: 22/03/2024
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _RAYTRACER_COMMON_DATA_H
|
||||
#define _RAYTRACER_COMMON_DATA_H
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#include <core/tuple.h>
|
||||
#include <patterns/pattern.h>
|
||||
#include <shapes/shape.h>
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
namespace Raytracer
|
||||
{
|
||||
class TestShape : public Shape
|
||||
{
|
||||
public:
|
||||
TestShape(void) = default;
|
||||
|
||||
Intersections local_intersect(const Ray &a_ray) override;
|
||||
|
||||
Tuple local_normal_at(const Tuple &a_local_point) const override;
|
||||
|
||||
Ray saved_ray;
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
class TestPattern : public Pattern
|
||||
{
|
||||
public:
|
||||
TestPattern(void) = default;
|
||||
|
||||
const Color pattern_at(const Tuple &a_point) const override;
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
class DataOrigDirT1T2
|
||||
{
|
||||
public:
|
||||
Tuple origin;
|
||||
Tuple direction;
|
||||
double t1;
|
||||
double t2;
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
class DataOrigDirT0T1
|
||||
{
|
||||
public:
|
||||
Tuple origin;
|
||||
Tuple direction;
|
||||
double t0 = -1;
|
||||
double t1 = -1;
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
class DataPointNormal
|
||||
{
|
||||
public:
|
||||
Tuple point;
|
||||
Tuple normal;
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
class DataPointDirCount
|
||||
{
|
||||
public:
|
||||
Tuple point;
|
||||
Tuple direction;
|
||||
uint16_t count;
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
class DataOrigDirCount
|
||||
{
|
||||
public:
|
||||
Tuple origin;
|
||||
Tuple direction;
|
||||
uint16_t count;
|
||||
};
|
||||
|
||||
} // namespace Raytracer
|
||||
|
||||
#endif // _RAYTRACER_COMMON_DATA_H
|
||||
Reference in New Issue
Block a user