MaterialX 1.39.1
Loading...
Searching...
No Matches
LightHandler Class Reference

Utility light handler for creating and providing light data for shader binding. More...

#include <LightHandler.h>

Public Member Functions

Global State
void setLightTransform (const Matrix44 &mat)
 Set the light transform.
 
Matrix44 getLightTransform () const
 Return the light transform.
 
void setDirectLighting (bool enable)
 Set whether direct lighting is enabled.
 
bool getDirectLighting () const
 Return whether direct lighting is enabled.
 
void setIndirectLighting (bool enable)
 Set whether indirect lighting is enabled.
 
bool getIndirectLighting () const
 Return whether indirect lighting is enabled.
 
Environment Lighting
void setEnvRadianceMap (ImagePtr map)
 Set the environment radiance map.
 
ImagePtr getEnvRadianceMap () const
 Return the environment radiance map.
 
void setEnvPrefilteredMap (ImagePtr map)
 Set the environment radiance map for the prefiltered environment lighting model.
 
ImagePtr getEnvPrefilteredMap () const
 Return the environment radiance map for the prefiltered environment lighting model.
 
void setUsePrefilteredMap (bool val)
 Set whether to use the prefiltered environment lighting model.
 
bool getUsePrefilteredMap ()
 Return whether to use the prefiltered environment lighting model.
 
void setEnvIrradianceMap (ImagePtr map)
 Set the environment irradiance map.
 
ImagePtr getEnvIrradianceMap () const
 Return the environment irradiance map.
 
void setEnvSampleCount (int count)
 Set the environment lighting sample count.
 
int getEnvSampleCount () const
 Return the environment lighting sample count.
 
void setEnvLightIntensity (const float intensity)
 Set the environment light intensity.
 
float getEnvLightIntensity ()
 Return the environment light intensity.
 
void setRefractionTwoSided (bool enable)
 Set the two-sided refraction property.
 
int getRefractionTwoSided () const
 Return the two-sided refraction property.
 
Albedo Table
void setAlbedoTable (ImagePtr table)
 Set the directional albedo table.
 
ImagePtr getAlbedoTable () const
 Return the directional albedo table.
 
Light Sources
void addLightSource (NodePtr node)
 Add a light source.
 
void setLightSources (const vector< NodePtr > &lights)
 Set the vector of light sources.
 
const vector< NodePtr > & getLightSources () const
 Return the vector of light sources.
 
NodePtr getFirstLightOfCategory (const string &category)
 Return the first light source, if any, of the given category.
 
Light IDs
const std::unordered_map< string, unsigned int > & getLightIdMap () const
 Get a list of identifiers associated with a given light nodedef.
 
LightIdMap computeLightIdMap (const vector< NodePtr > &nodes)
 From a set of nodes, create a mapping of corresponding nodedef identifiers to numbers.
 
void findLights (DocumentPtr doc, vector< NodePtr > &lights)
 Find lights to use based on an input document. More...
 
void registerLights (DocumentPtr doc, const vector< NodePtr > &lights, GenContext &context)
 Register light node definitions and light count with a given generation context. More...
 

Static Public Member Functions

static LightHandlerPtr create ()
 Create a new light handler.
 

Protected Attributes

Matrix44 _lightTransform
 
bool _directLighting
 
bool _indirectLighting
 
bool _usePrefilteredMap
 
ImagePtr _envRadianceMap
 
ImagePtr _envPrefilteredMap
 
ImagePtr _envIrradianceMap
 
float _envLightIntensity
 
int _envSampleCount
 
bool _refractionTwoSided
 
ImagePtr _albedoTable
 
vector< NodePtr_lightSources
 
std::unordered_map< string, unsigned int > _lightIdMap
 

Detailed Description

Utility light handler for creating and providing light data for shader binding.

Member Function Documentation

◆ findLights()

void findLights ( DocumentPtr  doc,
vector< NodePtr > &  lights 
)

Find lights to use based on an input document.

Parameters
docDocument to scan for lights
lightsList of lights found in document

◆ registerLights()

void registerLights ( DocumentPtr  doc,
const vector< NodePtr > &  lights,
GenContext context 
)

Register light node definitions and light count with a given generation context.

Parameters
docDocument containing light nodes and definitions
lightsLights to register
contextContext to update

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