6 #ifndef MATERIALX_LIGHTHANDLER_H
7 #define MATERIALX_LIGHTHANDLER_H
28 using LightIdMap = std::unordered_map<string, unsigned int>;
38 _directLighting(true),
39 _indirectLighting(true),
40 _usePrefilteredMap(false),
41 _envLightIntensity(1.0
f),
43 _refractionTwoSided(false)
57 _lightTransform = mat;
63 return _lightTransform;
69 _directLighting = enable;
75 return _directLighting;
81 _indirectLighting = enable;
87 return _indirectLighting;
97 _envRadianceMap = map;
103 return _envRadianceMap;
109 _envPrefilteredMap = map;
115 return _envPrefilteredMap;
121 _usePrefilteredMap =
val;
127 return _usePrefilteredMap;
133 _envIrradianceMap = map;
139 return _envIrradianceMap;
145 _envSampleCount =
count;
151 return _envSampleCount;
157 _envLightIntensity = intensity;
163 return _envLightIntensity;
169 _refractionTwoSided = enable;
175 return _refractionTwoSided;
185 _albedoTable =
table;
199 void addLightSource(
NodePtr node);
204 _lightSources = lights;
210 return _lightSources;
216 for (
NodePtr light : _lightSources)
218 if (light->getCategory() == category)
238 LightIdMap computeLightIdMap(
const vector<NodePtr>& nodes);
243 void findLights(
DocumentPtr doc, vector<NodePtr>& lights);
bool getUsePrefilteredMap()
Return whether to use the prefiltered environment lighting model.
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
int getRefractionTwoSided() const
Return the two-sided refraction property.
vector< NodePtr > _lightSources
void setRefractionTwoSided(bool enable)
Set the two-sided refraction property.
void setLightSources(const vector< NodePtr > &lights)
Set the vector of light sources.
const vector< NodePtr > & getLightSources() const
Return the vector of light sources.
ImagePtr _envPrefilteredMap
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
void setEnvPrefilteredMap(ImagePtr map)
Set the environment radiance map for the prefiltered environment lighting model.
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.
void setUsePrefilteredMap(bool val)
Set whether to use the prefiltered environment lighting model.
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.
GLenum GLenum GLsizei void * table
ImagePtr getEnvPrefilteredMap() const
Return the environment radiance map for the prefiltered environment lighting model.
void setEnvLightIntensity(const float intensity)
Set the environment light intensity.
void setIndirectLighting(bool enable)
Set whether indirect lighting is enabled.
float getEnvLightIntensity()
Return the environment light intensity.
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.
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.