6#ifndef MATERIALX_LIGHTHANDLER_H
7#define MATERIALX_LIGHTHANDLER_H
26using LightIdMap = std::unordered_map<string, unsigned int>;
43 void addLightSource(
NodePtr node);
54 for (
NodePtr light : _lightSources)
56 if (light->getCategory() == category)
67 return _lightIdentifierMap;
73 _lightSources = lights;
79 _envRadianceMap = map;
85 return _envRadianceMap;
91 _envIrradianceMap = map;
97 return _envIrradianceMap;
103 _albedoTable = table;
114 LightIdMap computeLightIdMap(
const vector<NodePtr>& nodes);
119 void findLights(
DocumentPtr doc, vector<NodePtr>& lights);
128 vector<NodePtr> _lightSources;
129 std::unordered_map<string, unsigned int> _lightIdentifierMap;
The top-level Document class.
shared_ptr< Document > DocumentPtr
A shared pointer to a Document.
Definition: Document.h:23
shared_ptr< Image > ImagePtr
A shared pointer to an image.
Definition: Image.h:24
std::shared_ptr< class LightHandler > LightHandlerPtr
Shared pointer to a LightHandler.
Definition: LightHandler.h:23
std::unordered_map< string, unsigned int > LightIdMap
An unordered map from light names to light indices.
Definition: LightHandler.h:26
Macros for declaring imported and exported symbols.
shared_ptr< Node > NodePtr
A shared pointer to a Node.
Definition: Node.h:25
A context class for shader generation.
Definition: GenContext.h:27
Utility light handler for creating and providing light data for shader binding.
Definition: LightHandler.h:32
void setEnvIrradianceMap(ImagePtr map)
Set the environment irradiance map.
Definition: LightHandler.h:89
NodePtr getFirstLightOfCategory(const string &category)
Return the first active light source, if any, of the given category.
Definition: LightHandler.h:52
const std::unordered_map< string, unsigned int > & getLightIdentifierMap() const
Get a list of identifiers associated with a given light nodedef.
Definition: LightHandler.h:65
const vector< NodePtr > & getLightSources() const
Return the vector of active light sources.
Definition: LightHandler.h:46
static LightHandlerPtr create()
Create a new light handler.
Definition: LightHandler.h:40
void setLightSources(const vector< NodePtr > &lights)
Set the list of light sources.
Definition: LightHandler.h:71
void setAlbedoTable(ImagePtr table)
Set the directional albedo table.
Definition: LightHandler.h:101
ImagePtr getEnvRadianceMap() const
Return the environment radiance map.
Definition: LightHandler.h:83
ImagePtr getEnvIrradianceMap() const
Return the environment irradiance map.
Definition: LightHandler.h:95
ImagePtr getAlbedoTable() const
Return the directional albedo table.
Definition: LightHandler.h:107
void setEnvRadianceMap(ImagePtr map)
Set the environment radiance map.
Definition: LightHandler.h:77