-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathpointlight.h
48 lines (37 loc) · 1.23 KB
/
pointlight.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
38
39
40
41
42
43
44
45
46
47
48
/**
* pointlight.h
*
* By Sebastian Raaphorst, 2018.
*/
#pragma once
#include <optional>
#include "vec.h"
namespace raytracer {
class PointLight final {
private:
Tuple position;
Colour intensity;
public:
template<typename T, typename S>
constexpr PointLight(T &&position, S &&intensity) noexcept: position{position}, intensity{intensity} {}
constexpr PointLight(const PointLight&) noexcept = default;
constexpr PointLight(PointLight&&) noexcept = default;
PointLight &operator=(const PointLight&) = default;
constexpr bool operator==(const std::optional<PointLight> &other) const noexcept {
return other.has_value() && (*this == other.value());
}
constexpr bool operator==(const PointLight &other) const noexcept {
return position == other.position && intensity == other.intensity;
}
template<typename T>
constexpr bool operator!=(T&& other) const noexcept {
return !(*this == other);
}
constexpr Tuple getPosition() const noexcept {
return position;
}
constexpr Colour getIntensity() const noexcept {
return intensity;
}
};
}