-
Notifications
You must be signed in to change notification settings - Fork 0
/
Shape.h
37 lines (30 loc) · 855 Bytes
/
Shape.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once
#include <optional>
#include <glm/glm.hpp>
#include "Ray.h"
#include "ReflectionType.h"
struct Shape
{
virtual std::optional<float> Intersect(const Ray& ray) const = 0;
virtual glm::vec3 GetNormal(const glm::vec3& impactPoint) const = 0;
virtual ReflectionType GetReflectionType() const = 0;
};
template<typename T>
struct AnyShape : Shape
{
T obj;
AnyShape(T newObj) : obj(newObj) {};
// Hérité via Shape
virtual std::optional<float> Intersect(const Ray& ray) const override
{
return obj.Intersect(ray);
}
virtual glm::vec3 GetNormal(const glm::vec3& impactPoint) const override
{
return obj.GetNormal(impactPoint);
}
virtual ReflectionType GetReflectionType() const override
{
return obj.GetReflectionType();
}
};