Plasma Engine  2.0
Loading...
Searching...
No Matches
plReflectionProbeMapping Class Reference

This class creates a reflection probe atlas and controls the mapping of added probes to the available atlas indices. More...

#include <ReflectionProbeMapping.h>

Public Member Functions

 plReflectionProbeMapping (plUInt32 uiAtlasSize)
 Creates a reflection probe atlas and mapping of the given size.
 
Probe management
void AddProbe (plReflectionProbeId probe, plBitflags< plProbeFlags > flags)
 Adds a probe that will be considered for mapping into the atlas.
 
void UpdateProbe (plReflectionProbeId probe, plBitflags< plProbeFlags > flags)
 Marks previously added probe as dirty and potentially changes its flags.
 
void ProbeUpdateFinished (plReflectionProbeId probe)
 Should be called once a requested plReflectionProbeMappingEvent::Type::ProbeUpdateRequested event has been completed.
 
void RemoveProbe (plReflectionProbeId probe)
 Removes a probe. If the probe was mapped, plReflectionProbeMappingEvent::Type::ProbeUnmapped will be fired when calling this function.
 
Render helpers
plInt32 GetReflectionIndex (plReflectionProbeId probe, bool bForExtraction=false) const
 Returns the index at which a given probe is mapped.
 
plGALTextureHandle GetTexture () const
 Returns the atlas texture.
 
Compute atlas mapping
void PreExtraction ()
 Should be called in the PreExtraction phase. This will reset all probe weights.
 
void AddWeight (plReflectionProbeId probe, float fPriority)
 Adds weight to a probe. Should be called during extraction of the probe. The mapping will map the probes with the highest weights in the atlas over time. This can be called multiple times in a frame for a probe if it is visible in multiple views. The maximum weight is then taken.
 
void PostExtraction ()
 Should be called in the PostExtraction phase. This will compute the best probe mapping and potentially fire plReflectionProbeMappingEvent events to map / unmap or request updates of probes.
 

Public Attributes

plEvent< const plReflectionProbeMappingEvent & > m_Events
 

Detailed Description

This class creates a reflection probe atlas and controls the mapping of added probes to the available atlas indices.

Constructor & Destructor Documentation

◆ plReflectionProbeMapping()

plReflectionProbeMapping::plReflectionProbeMapping ( plUInt32 uiAtlasSize)

Creates a reflection probe atlas and mapping of the given size.

Parameters
uiAtlasSizeHow many probes the atlas can contain.

Member Function Documentation

◆ GetReflectionIndex()

plInt32 plReflectionProbeMapping::GetReflectionIndex ( plReflectionProbeId probe,
bool bForExtraction = false ) const

Returns the index at which a given probe is mapped.

Parameters
probeThe probe that is being queried.
bForExtractionIf set, returns whether the index can be used for using the probe during rendering. If the probe was just mapped but not updated yet, -1 will be returned for bForExtraction = true but a valid index for bForExtraction = false so that the index can be rendered into.
Returns
Returns the mapped index in the atlas or -1 of the probe is not mapped.

◆ GetTexture()

plGALTextureHandle plReflectionProbeMapping::GetTexture ( ) const
inline

Returns the atlas texture.

Returns
The texture handle of the cube map atlas.

◆ ProbeUpdateFinished()

void plReflectionProbeMapping::ProbeUpdateFinished ( plReflectionProbeId probe)

Should be called once a requested plReflectionProbeMappingEvent::Type::ProbeUpdateRequested event has been completed.

Parameters
probeThe probe that has finished its update.

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