Raytracer
Loading...
Searching...
No Matches
Shapes.hpp
1#include <memory>
2#include "Common.hpp"
3#include "arguments/Kinds.hpp"
4#include "interfaces/IArguments.hpp"
5#include "interfaces/IMaterial.hpp"
6#include "interfaces/ITexture.hpp"
7#include "utils/VecN.hpp"
8
9#ifndef __ARG_SHAPES_HPP__
10 #define __ARG_SHAPES_HPP__
11
12namespace Raytracer::Arguments
13{
15 private:
16 double _radius;
17 double _height;
18 Utils::Point3 _center;
19 std::shared_ptr<Interfaces::IMaterial> _material = nullptr;
20
21 public:
22 Cone(Utils::Point3 &center, double radius, double height,
23 std::shared_ptr<Interfaces::IMaterial> material)
24 : _radius(radius), _height(height), _center(center),
25 _material(material)
26 {
27 }
28 GET_SET(Utils::Point3, center);
29 GET_SET(double, radius);
30 GET_SET(double, height);
31 GET_SET(std::shared_ptr<Interfaces::IMaterial>, material);
32 ARG_KIND(ArgumentKind::ARG_CONE);
33 };
34
36 private:
37 double _radius;
38 double _height;
39 Utils::Point3 _center;
40 std::shared_ptr<Interfaces::IMaterial> _material = nullptr;
41
42 public:
43 Cylinder(Utils::Point3 &center, double radius, double height,
44 std::shared_ptr<Interfaces::IMaterial> material)
45 : _radius(radius), _height(height), _center(center),
46 _material(material)
47 {
48 }
49 GET_SET(Utils::Point3, center);
50 GET_SET(double, radius);
51 GET_SET(double, height);
52 GET_SET(std::shared_ptr<Interfaces::IMaterial>, material);
53 ARG_KIND(ArgumentKind::ARG_CYLINDER);
54 };
55
57 private:
58 Utils::Point3 _point;
59 Utils::Vec3 _normal;
60 std::shared_ptr<Interfaces::IMaterial> _material = nullptr;
61
62 public:
63 Plane(Utils::Point3 &point, Utils::Vec3 &normal,
64 std::shared_ptr<Interfaces::IMaterial> material)
65 : _point(point), _normal(normal), _material(material)
66 {
67 }
68 GET_SET(Utils::Point3, point);
69 GET_SET(Utils::Vec3, normal);
70 GET_SET(std::shared_ptr<Interfaces::IMaterial>, material);
71 ARG_KIND(ArgumentKind::ARG_PLANE);
72 };
73
75 private:
79 std::shared_ptr<Interfaces::IMaterial> _material = nullptr;
80
81 public:
83 std::shared_ptr<Interfaces::IMaterial> material)
84 : _Q(Q), _u(u), _v(v), _material(material)
85 {
86 }
87 GET_SET(Utils::Point3, Q);
88 GET_SET(Utils::Point3, u);
89 GET_SET(Utils::Point3, v);
90 GET_SET(std::shared_ptr<Interfaces::IMaterial>, material);
91 ARG_KIND(ArgumentKind::ARG_QUAD);
92 };
93
95 private:
96 ArgumentKind _kind;
97 Utils::Point3 _center;
98 Utils::Point3 _centerTwo;
99 double _radius;
100 std::shared_ptr<Interfaces::IMaterial> _material = nullptr;
101
102 public:
103 Sphere(Utils::Point3 center, double radius,
104 std::shared_ptr<Interfaces::IMaterial> material)
105 : _center(center), _radius(radius), _material(material)
106 {
107 _kind = ArgumentKind::ARG_SPHERE;
108 }
109 Sphere(Utils::Point3 centerOne, Utils::Point3 centerTwo, double radius,
110 std::shared_ptr<Interfaces::IMaterial> material)
111 : _center(centerOne), _centerTwo(centerTwo), _radius(radius),
112 _material(material)
113 {
114 _kind = ArgumentKind::ARG_SPHERE_MOVING;
115 }
116 GET_SET(Utils::Point3, center);
117 GET_SET(Utils::Point3, centerTwo);
118 GET_SET(double, radius);
119 GET_SET(std::shared_ptr<Interfaces::IMaterial>, material);
120 ARG_KIND(_kind);
121 };
122
124 private:
125 Utils::Point3 _pointOne;
126 Utils::Point3 _pointTwo;
127 std::shared_ptr<Interfaces::IMaterial> _material = nullptr;
128
129 public:
130 Box(Utils::Point3 pointOne, Utils::Point3 pointTwo,
131 std::shared_ptr<Interfaces::IMaterial> material)
132 : _pointOne(pointOne), _pointTwo(pointTwo), _material(material)
133 {
134 }
135 GET_SET(Utils::Point3, pointOne);
136 GET_SET(Utils::Point3, pointTwo);
137 GET_SET(std::shared_ptr<Interfaces::IMaterial>, material);
138 ARG_KIND(ArgumentKind::ARG_BOX);
139 };
140} // namespace Raytracer::Arguments
141
142#endif /* __ARG_SHAPES_HPP__ */
Definition Shapes.hpp:123
Definition Shapes.hpp:14
Definition Shapes.hpp:35
Definition Shapes.hpp:56
Definition Shapes.hpp:74
Definition Shapes.hpp:94
Definition IArguments.hpp:8
Definition VecN.hpp:40