Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
LightProbe.hpp
1#pragma once
2
3#include "resources/ResourcesManager.hpp"
4#include "resources/Buffer.hpp"
5#include "system/Codable.hpp"
6#include "Common.hpp"
7
13
14public:
16 enum class Type : uint {
17 STATIC,
18 DYNAMIC
19 };
20
23 explicit LightProbe() = default;
24
51 bool decode(const KeyValues & params, Storage options);
52
56 KeyValues encode() const;
57
62 void registerEnvironment(const Texture * envmap, const std::shared_ptr<Buffer> & shCoeffs);
63
67 void updateSize(const BoundingBox& _bbox);
68
71 Type type() const {
72 return _type;
73 }
74
77 const glm::vec3 & position() const { return _position; }
78
81 const glm::vec3 & size() const { return _size; }
82
85 float fade() const { return _fade; }
86
89 const glm::vec3 & extent() const { return _extent; }
90
93 const glm::vec3 & center() const { return _center; }
94
97 const float & rotation() const { return _rotation; }
98
101 const glm::vec2 & rotationCosSin() const { return _rotCosSin; }
102
104 const Texture * map() const { return _envmap; }
105
107 const std::shared_ptr<Buffer> & shCoeffs() const { return _shCoeffs; }
108
109private:
110
111 const Texture * _envmap = nullptr;
112 std::shared_ptr<Buffer> _shCoeffs;
113
115 glm::vec3 _position = glm::vec3(0.0f);
116 glm::vec3 _size = glm::vec3(1e10f);
117 glm::vec3 _extent = glm::vec3(-1.0f);
118 glm::vec3 _center = glm::vec3(0.0f);
119 glm::vec2 _rotCosSin = glm::vec2(1.0f, 0.0f);
120 float _fade = 1e-8f;
121 float _rotation = 0.0f;
122};
Represent the smallest axis-aligne box containing a given object or region of space.
Definition: Bounds.hpp:28
Store environment lighting for reflections.
Definition: LightProbe.hpp:12
const Texture * _envmap
The environment map.
Definition: LightProbe.hpp:111
glm::vec3 _position
The probe location.
Definition: LightProbe.hpp:115
Type
Definition: LightProbe.hpp:16
@ DYNAMIC
Generated in engine.
@ STATIC
Loaded from disk, never updated.
bool decode(const KeyValues &params, Storage options)
Definition: LightProbe.cpp:4
const glm::vec3 & extent() const
Definition: LightProbe.hpp:89
const glm::vec2 & rotationCosSin() const
Definition: LightProbe.hpp:101
std::shared_ptr< Buffer > _shCoeffs
The irradiance representation.
Definition: LightProbe.hpp:112
Type _type
The type of probe.
Definition: LightProbe.hpp:114
glm::vec3 _center
The probe parallax proxy center.
Definition: LightProbe.hpp:118
LightProbe()=default
Type type() const
Definition: LightProbe.hpp:71
glm::vec2 _rotCosSin
Probe orientation trigonometric cached values.
Definition: LightProbe.hpp:119
glm::vec3 _extent
The probe parallax proxy extent.
Definition: LightProbe.hpp:117
const glm::vec3 & center() const
Definition: LightProbe.hpp:93
const float & rotation() const
Definition: LightProbe.hpp:97
void updateSize(const BoundingBox &_bbox)
Definition: LightProbe.cpp:108
const glm::vec3 & position() const
Definition: LightProbe.hpp:77
float fade() const
Definition: LightProbe.hpp:85
const std::shared_ptr< Buffer > & shCoeffs() const
Definition: LightProbe.hpp:107
const Texture * map() const
Definition: LightProbe.hpp:104
KeyValues encode() const
Definition: LightProbe.cpp:78
float _rotation
The probe orientation around a vertical axis,.
Definition: LightProbe.hpp:121
void registerEnvironment(const Texture *envmap, const std::shared_ptr< Buffer > &shCoeffs)
Definition: LightProbe.cpp:103
const glm::vec3 & size() const
Definition: LightProbe.hpp:81
float _fade
The probe effect fading margin around its area of effect.
Definition: LightProbe.hpp:120
glm::vec3 _size
The probe area of effect.
Definition: LightProbe.hpp:116
Represents a texture containing one or more images, stored on the CPU and/or GPU.
Definition: Texture.hpp:12
Storage
Storage and loading options.
Definition: ResourcesManager.hpp:14
Represent a key-values tuple.
Definition: Config.hpp:9