Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | List of all members
LightProbe Class Reference

Store environment lighting for reflections. More...

#include <LightProbe.hpp>

Public Types

enum class  Type : uint { STATIC , DYNAMIC }
 

Public Member Functions

 LightProbe ()=default
 
bool decode (const KeyValues &params, Storage options)
 
KeyValues encode () const
 
void registerEnvironment (const Texture *envmap, const std::shared_ptr< Buffer > &shCoeffs)
 
void updateSize (const BoundingBox &_bbox)
 
Type type () const
 
const glm::vec3 & position () const
 
const glm::vec3 & size () const
 
float fade () const
 
const glm::vec3 & extent () const
 
const glm::vec3 & center () const
 
const float & rotation () const
 
const glm::vec2 & rotationCosSin () const
 
const Texturemap () const
 
const std::shared_ptr< Buffer > & shCoeffs () const
 

Private Attributes

const Texture_envmap = nullptr
 The environment map.
 
std::shared_ptr< Buffer_shCoeffs
 The irradiance representation.
 
Type _type = Type::DYNAMIC
 The type of probe.
 
glm::vec3 _position = glm::vec3(0.0f)
 The probe location.
 
glm::vec3 _size = glm::vec3(1e10f)
 The probe area of effect.
 
glm::vec3 _extent = glm::vec3(-1.0f)
 The probe parallax proxy extent.
 
glm::vec3 _center = glm::vec3(0.0f)
 The probe parallax proxy center.
 
glm::vec2 _rotCosSin = glm::vec2(1.0f, 0.0f)
 Probe orientation trigonometric cached values.
 
float _fade = 1e-8f
 The probe effect fading margin around its area of effect.
 
float _rotation = 0.0f
 The probe orientation around a vertical axis,.
 

Detailed Description

Store environment lighting for reflections.

Member Enumeration Documentation

◆ Type

enum class LightProbe::Type : uint
strong

The type of probe.

Enumerator
STATIC 

Loaded from disk, never updated.

DYNAMIC 

Generated in engine.

Constructor & Destructor Documentation

◆ LightProbe()

LightProbe::LightProbe ( )
explicitdefault

Constructor.

Member Function Documentation

◆ center()

const glm::vec3 & LightProbe::center ( ) const
inline
Returns
the probe parallax proxy center

◆ decode()

bool LightProbe::decode ( const KeyValues params,
Storage  options 
)

Setup the probe parameters from a list of key-value tuples. The following representations are possible: either:

* probe:
   radiance: texturetype: ...
   irradiance: shcoeffs_filename

for a static environment map or

* probe:
   position: X,Y,Z
   size: W,H,D
   fade: distance
   center: X,Y,Z
   extent: W,H,D
   rotation: angle

for a probe renderered on the fly at the given location. center, extent and rotation are used to define an oriented box used as a local scene proxy. If extent is negative, the environment is assumed to be at infinity. position, size, fade and rotation are used to define a box-shaped area of effect with soft edges. Both size and extent are half-sizes.

Parameters
paramsthe parameters tuple
optionsdata loading and storage options
Returns
decoding status

◆ encode()

KeyValues LightProbe::encode ( ) const

Generate a key-values representation of the probe. See decode for the keywords and layout.

Returns
a tuple representing the probe.

◆ extent()

const glm::vec3 & LightProbe::extent ( ) const
inline
Returns
the probe parallax proxy extent half size (or -1 for probes at infinity)

◆ fade()

float LightProbe::fade ( ) const
inline
Returns
the probe fading band width, at the edges of its area of effect

◆ map()

const Texture * LightProbe::map ( ) const
inline
Returns
the environment map

◆ position()

const glm::vec3 & LightProbe::position ( ) const
inline
Returns
the probe position (or the origin for static probes)

◆ registerEnvironment()

void LightProbe::registerEnvironment ( const Texture envmap,
const std::shared_ptr< Buffer > &  shCoeffs 
)

Register an environment, potentially updated on the fly.

Parameters
envmapthe new map to use
shCoeffsthe new irradiance coefficients

◆ rotation()

const float & LightProbe::rotation ( ) const
inline
Returns
the probe orientation.

◆ rotationCosSin()

const glm::vec2 & LightProbe::rotationCosSin ( ) const
inline
Returns
the probe precomputed orientation (cos(angleY), sin(angleY)).

◆ shCoeffs()

const std::shared_ptr< Buffer > & LightProbe::shCoeffs ( ) const
inline
Returns
the irradiance coefficients buffer

◆ size()

const glm::vec3 & LightProbe::size ( ) const
inline
Returns
the half size of the probe area of effect

◆ type()

Type LightProbe::type ( ) const
inline
Returns
the type of probe

◆ updateSize()

void LightProbe::updateSize ( const BoundingBox _bbox)

Update the area of effect of the probe to ensure it's not bigger than the specified bounding box

Parameters
_bboxthe maximum size of the probe box

The documentation for this class was generated from the following files: