HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LightHandler Class Reference

#include <LightHandler.h>

Public Member Functions

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

Static Public Member Functions

static LightHandlerPtr create ()
 Create a new light handler. More...
 

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.

Definition at line 33 of file LightHandler.h.

Constructor & Destructor Documentation

LightHandler::LightHandler ( )
inline

Definition at line 36 of file LightHandler.h.

virtual LightHandler::~LightHandler ( )
inlinevirtual

Definition at line 46 of file LightHandler.h.

Member Function Documentation

void LightHandler::addLightSource ( NodePtr  node)

Add a light source.

LightIdMap LightHandler::computeLightIdMap ( const vector< NodePtr > &  nodes)

From a set of nodes, create a mapping of corresponding nodedef identifiers to numbers

static LightHandlerPtr LightHandler::create ( )
inlinestatic

Create a new light handler.

Definition at line 49 of file LightHandler.h.

void LightHandler::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
ImagePtr LightHandler::getAlbedoTable ( ) const
inline

Return the directional albedo table.

Definition at line 189 of file LightHandler.h.

bool LightHandler::getDirectLighting ( ) const
inline

Return whether direct lighting is enabled.

Definition at line 73 of file LightHandler.h.

ImagePtr LightHandler::getEnvIrradianceMap ( ) const
inline

Return the environment irradiance map.

Definition at line 137 of file LightHandler.h.

float LightHandler::getEnvLightIntensity ( )
inline

Return the environment light intensity.

Definition at line 161 of file LightHandler.h.

ImagePtr LightHandler::getEnvPrefilteredMap ( ) const
inline

Return the environment radiance map for the prefiltered environment lighting model.

Definition at line 113 of file LightHandler.h.

ImagePtr LightHandler::getEnvRadianceMap ( ) const
inline

Return the environment radiance map.

Definition at line 101 of file LightHandler.h.

int LightHandler::getEnvSampleCount ( ) const
inline

Return the environment lighting sample count.

Definition at line 149 of file LightHandler.h.

NodePtr LightHandler::getFirstLightOfCategory ( const string category)
inline

Return the first light source, if any, of the given category.

Definition at line 214 of file LightHandler.h.

bool LightHandler::getIndirectLighting ( ) const
inline

Return whether indirect lighting is enabled.

Definition at line 85 of file LightHandler.h.

const std::unordered_map<string, unsigned int>& LightHandler::getLightIdMap ( ) const
inline

Get a list of identifiers associated with a given light nodedef.

Definition at line 231 of file LightHandler.h.

const vector<NodePtr>& LightHandler::getLightSources ( ) const
inline

Return the vector of light sources.

Definition at line 208 of file LightHandler.h.

Matrix44 LightHandler::getLightTransform ( ) const
inline

Return the light transform.

Definition at line 61 of file LightHandler.h.

int LightHandler::getRefractionTwoSided ( ) const
inline

Return the two-sided refraction property.

Definition at line 173 of file LightHandler.h.

bool LightHandler::getUsePrefilteredMap ( )
inline

Return whether to use the prefiltered environment lighting model.

Definition at line 125 of file LightHandler.h.

void LightHandler::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
void LightHandler::setAlbedoTable ( ImagePtr  table)
inline

Set the directional albedo table.

Definition at line 183 of file LightHandler.h.

void LightHandler::setDirectLighting ( bool  enable)
inline

Set whether direct lighting is enabled.

Definition at line 67 of file LightHandler.h.

void LightHandler::setEnvIrradianceMap ( ImagePtr  map)
inline

Set the environment irradiance map.

Definition at line 131 of file LightHandler.h.

void LightHandler::setEnvLightIntensity ( const float  intensity)
inline

Set the environment light intensity.

Definition at line 155 of file LightHandler.h.

void LightHandler::setEnvPrefilteredMap ( ImagePtr  map)
inline

Set the environment radiance map for the prefiltered environment lighting model.

Definition at line 107 of file LightHandler.h.

void LightHandler::setEnvRadianceMap ( ImagePtr  map)
inline

Set the environment radiance map.

Definition at line 95 of file LightHandler.h.

void LightHandler::setEnvSampleCount ( int  count)
inline

Set the environment lighting sample count.

Definition at line 143 of file LightHandler.h.

void LightHandler::setIndirectLighting ( bool  enable)
inline

Set whether indirect lighting is enabled.

Definition at line 79 of file LightHandler.h.

void LightHandler::setLightSources ( const vector< NodePtr > &  lights)
inline

Set the vector of light sources.

Definition at line 202 of file LightHandler.h.

void LightHandler::setLightTransform ( const Matrix44 mat)
inline

Set the light transform.

Definition at line 55 of file LightHandler.h.

void LightHandler::setRefractionTwoSided ( bool  enable)
inline

Set the two-sided refraction property.

Definition at line 167 of file LightHandler.h.

void LightHandler::setUsePrefilteredMap ( bool  val)
inline

Set whether to use the prefiltered environment lighting model.

Definition at line 119 of file LightHandler.h.

Member Data Documentation

ImagePtr LightHandler::_albedoTable
protected

Definition at line 267 of file LightHandler.h.

bool LightHandler::_directLighting
protected

Definition at line 255 of file LightHandler.h.

ImagePtr LightHandler::_envIrradianceMap
protected

Definition at line 261 of file LightHandler.h.

float LightHandler::_envLightIntensity
protected

Definition at line 262 of file LightHandler.h.

ImagePtr LightHandler::_envPrefilteredMap
protected

Definition at line 260 of file LightHandler.h.

ImagePtr LightHandler::_envRadianceMap
protected

Definition at line 259 of file LightHandler.h.

int LightHandler::_envSampleCount
protected

Definition at line 263 of file LightHandler.h.

bool LightHandler::_indirectLighting
protected

Definition at line 256 of file LightHandler.h.

std::unordered_map<string, unsigned int> LightHandler::_lightIdMap
protected

Definition at line 270 of file LightHandler.h.

vector<NodePtr> LightHandler::_lightSources
protected

Definition at line 269 of file LightHandler.h.

Matrix44 LightHandler::_lightTransform
protected

Definition at line 254 of file LightHandler.h.

bool LightHandler::_refractionTwoSided
protected

Definition at line 265 of file LightHandler.h.

bool LightHandler::_usePrefilteredMap
protected

Definition at line 257 of file LightHandler.h.


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