6 #ifndef MATERIALX_LIGHTHANDLER_H
7 #define MATERIALX_LIGHTHANDLER_H
27 using LightIdMap = std::unordered_map<string, unsigned int>;
37 _directLighting(true),
38 _indirectLighting(true),
53 _lightTransform = mat;
59 return _lightTransform;
71 return _directLighting;
77 _indirectLighting =
enable;
83 return _indirectLighting;
93 _envRadianceMap = map;
99 return _envRadianceMap;
105 _envIrradianceMap = map;
111 return _envIrradianceMap;
117 _albedoTable =
table;
129 _envSampleCount =
count;
135 return _envSampleCount;
143 void addLightSource(
NodePtr node);
148 _lightSources = lights;
154 return _lightSources;
160 for (
NodePtr light : _lightSources)
162 if (light->getCategory() == category)
182 LightIdMap computeLightIdMap(
const vector<NodePtr>& nodes);
187 void findLights(
DocumentPtr doc, vector<NodePtr>& lights);
ImagePtr getEnvRadianceMap() const
Return the environment radiance map.
void setLightTransform(const Matrix44 &mat)
Set the light transform.
#define MATERIALX_NAMESPACE_BEGIN
std::unordered_map< string, unsigned int > _lightIdMap
vector< NodePtr > _lightSources
void setLightSources(const vector< NodePtr > &lights)
Set the vector of light sources.
const vector< NodePtr > & getLightSources() const
Return the vector of light sources.
void setDirectLighting(bool enable)
Set whether direct lighting is enabled.
std::shared_ptr< class LightHandler > LightHandlerPtr
Shared pointer to a LightHandler.
Matrix44 getLightTransform() const
Return the light transform.
bool getDirectLighting() const
Return whether direct lighting is enabled.
void setEnvSampleCount(int count)
Set the environment lighting sample count.
ImagePtr getAlbedoTable() const
Return the directional albedo table.
bool getIndirectLighting() const
Return whether indirect lighting is enabled.
MATERIALX_NAMESPACE_BEGIN MX_RENDER_API const int DEFAULT_ENV_SAMPLE_COUNT
const std::unordered_map< string, unsigned int > & getLightIdMap() const
Get a list of identifiers associated with a given light nodedef.
std::unordered_map< string, unsigned int > LightIdMap
An unordered map from light names to light indices.
static LightHandlerPtr create()
Create a new light handler.
int getEnvSampleCount() const
Return the environment lighting sample count.
void setEnvIrradianceMap(ImagePtr map)
Set the environment irradiance map.
ImagePtr _envIrradianceMap
shared_ptr< Document > DocumentPtr
A shared pointer to a Document.
void setIndirectLighting(bool enable)
Set whether indirect lighting is enabled.
void setAlbedoTable(ImagePtr table)
Set the directional albedo table.
ImagePtr getEnvIrradianceMap() const
Return the environment irradiance map.
void setEnvRadianceMap(ImagePtr map)
Set the environment radiance map.
#define MATERIALX_NAMESPACE_END
shared_ptr< Image > ImagePtr
A shared pointer to an image.
GLenum GLsizei GLenum GLenum const void * table
shared_ptr< Node > NodePtr
A shared pointer to a Node.
NodePtr getFirstLightOfCategory(const string &category)
Return the first light source, if any, of the given category.