MLightParameterInformation Class Reference

This reference page is linked to from the following overview topics: Extension for Autodesk Maya 2013, Autodesk Maya 2013, 4.2 Lighting Interfaces.



Detailed Description

A class for providing lighting information that may be used with Viewport 2.0.

This class allows for access to various per-light information accessible via the MDrawContext class in Viewport 2.0.

Examples:

hwPhongShader.cpp.

#include <MDrawContext.h>

List of all members.

Public Types

enum  ParameterType {
  kInvalid, kBoolean, kInteger, kFloat,
  kFloat2, kFloat3, kFloat4, kFloat4x4Row,
  kFloat4x4Col, kTexture2, kSampler
}
 

Specifies light parameter data types.

More...
enum  StockParameterSemantic {
  kNoSemantic, kLightEnabled, kWorldPosition, kWorldDirection,
  kIntensity, kColor, kEmitsDiffuse, kEmitsSpecular,
  kDecayRate, kDropoff, kCosConeAngle, kStartShadowParameters ,
  kShadowMap, kShadowSamp, kShadowBias, kShadowMapSize,
  kShadowViewProj, kShadowColor, kGlobalShadowOn, kShadowOn
}
 

Specifies semantic meanings for predefined names for common or "stock" light parameters.

More...

Public Member Functions

void parameterList (MStringArray &list) const
 Get the names of all light parameters that are accessible.
ParameterType parameterType (const MString &parameterName) const
 Get the type of the named parameter, returns kInvalid if parameter is not found.
StockParameterSemantic parameterSemantic (const MString &parameterName) const
 Get the stock semantic for a named parameter.
void parameterNames (StockParameterSemantic semantic, MStringArray &list) const
 Get the name of all parameters on the light which are tagged with the stock semantic.
unsigned int arrayParameterCount (const MString &parameterName) const
 Return the array size of a parameter.
MStatus getParameter (const MString &parameterName, MIntArray &value)
 Get a named boolean or integer parameter.
MStatus getParameter (const MString &parameterName, MFloatArray &value)
 Get a named float parameter.
MStatus getParameter (const MString &parameterName, MMatrix &value)
 Get a named matrix parameter.
MStatus getParameter (const MString &parameterName, MSamplerStateDesc &samplerDesc)
 Get a description of a sampler parameter.
void * getParameterTextureHandle (const MString &parameterName)
 Get a resource handle for a texture parameter.
MStatus getParameter (const MString &parameterName, MTextureAssignment &value)
 Get a named texture parameter.
MStatus getParameter (StockParameterSemantic semantic, MIntArray &value)
 Get a boolean or integer parameter by semantic.
MStatus getParameter (StockParameterSemantic semantic, MFloatArray &value)
 Get a float parameter by semantic.
MStatus getParameter (StockParameterSemantic semantic, MMatrix &value)
 Get a matrix parameter by semantic.
MStatus getParameter (StockParameterSemantic semantic, MSamplerStateDesc &samplerDesc)
 Get a sampler parameter by semantic.
void * getParameterTextureHandle (StockParameterSemantic semantic)
 Get a resource handle for a texture parameter by semantic.
MStatus getParameter (StockParameterSemantic semantic, MTextureAssignment &value)
 Get a texture parameter by semantic.
MString lightType () const
 Get the classification of the light node.
MDagPath lightPath (MStatus *ReturnStatus=NULL) const
 Returns the DagPath to the scene light.

Protected Member Functions

 ~MLightParameterInformation ()
 Destructor.

Member Enumeration Documentation

Specifies light parameter data types.

Enumerator:
kInvalid 

Invalid element type (default value)

kBoolean 

Boolean.

kInteger 

Signed 32-bit integer.

kFloat 

IEEE single precision floating point.

kFloat2 

IEEE single precision floating point (x2)

kFloat3 

IEEE single precision floating point (x3)

kFloat4 

IEEE single precision floating point (x4)

kFloat4x4Row 

IEEE single precision floating point row-major matrix (4x4)

kFloat4x4Col 

IEEE single precision floating point column-major matrix (4x4)

kTexture2 

2D texture

kSampler 

Sampler.

Specifies semantic meanings for predefined names for common or "stock" light parameters.

The semantic is provided to aid in the determination of the appropriate mapping of parameter values to programmable shader or fixed function lighting inputs.

Note that not all parameters exist on all lights so there may be no match for a given stock name. For example a directional light will have no position parameter.

Enumerator:
kNoSemantic 

No semantic.

kLightEnabled 

Light is enabled.

kWorldPosition 

World space position.

kWorldDirection 

World space direction.

kIntensity 

Intensity.

kColor 

Color.

kEmitsDiffuse 

Emits diffuse lighting.

kEmitsSpecular 

Emits specular lighting.

kDecayRate 

Decay rate (0=No Decay, 1=Linear, 2=Quadratic, 3=Cubic)

kDropoff 

Dropoff.

kCosConeAngle 

Cosine of the cone angle.

kStartShadowParameters 

Incoming irradiance. Also marks the beginning of enums for shadowing.

kShadowMap 

Shadow map.

kShadowSamp 

Shadow map sampler.

kShadowBias 

Shadow map bias.

kShadowMapSize 

Shadow map size.

kShadowViewProj 

Shadow map view projection matrix.

kShadowColor 

Shadow color.

kGlobalShadowOn 

Global toggle for whether shadows are enabled or not.

kShadowOn 

Local toggle per light for whether shadows are enabled or not.


Member Function Documentation

void parameterList ( MStringArray list) const

Get the names of all light parameters that are accessible.

Parameters:
[out]listThe list to populate parameter names
Examples:
hwPhongShader.cpp.
MLightParameterInformation::ParameterType parameterType ( const MString parameterName) const

Get the type of the named parameter, returns kInvalid if parameter is not found.

Parameters:
[in]parameterNameName of the parameter to query
Returns:
The type of the named parameter
Examples:
hwPhongShader.cpp.
MLightParameterInformation::StockParameterSemantic parameterSemantic ( const MString parameterName) const

Get the stock semantic for a named parameter.

Parameters:
[in]parameterNameName of the parameter to query
Returns:
The semantic of the named parameter
Examples:
hwPhongShader.cpp.
void parameterNames ( MLightParameterInformation::StockParameterSemantic  semantic,
MStringArray list 
) const

Get the name of all parameters on the light which are tagged with the stock semantic.

Parameters:
[in]semanticThe semantic to query
[out]listThe list to populate with parameter names, will be empty if light has no parameters matching semantic.
unsigned int arrayParameterCount ( const MString parameterName) const

Return the array size of a parameter.

If the parameter is not an array then a value of 0 is returned.

Parameters:
[in]parameterNameName of the parameter to query
Returns:
Array size of a parameter.
MStatus getParameter ( const MString parameterName,
MIntArray value 
)

Get a named boolean or integer parameter.

Parameters:
[in]parameterNameName of the parameter to retrieve
[out]valueValue of the parameter
Returns:
Status code
Status Codes:
Examples:
hwPhongShader.cpp.
MStatus getParameter ( const MString parameterName,
MFloatArray value 
)

Get a named float parameter.

Parameters:
[in]parameterNameName of the parameter to retrieve
[out]valueValue of the parameter
Returns:
Status code
Status Codes:
MStatus getParameter ( const MString parameterName,
MMatrix value 
)

Get a named matrix parameter.

Parameters:
[in]parameterNameName of the parameter to retrieve
[out]valueValue of the parameter
Returns:
Status code
Status Codes:
MStatus getParameter ( const MString parameterName,
MSamplerStateDesc samplerDesc 
)

Get a description of a sampler parameter.

Parameters:
[in]parameterNameName of the parameter to retrieve
[out]samplerDescSampler state description retrieved
Returns:
Status code
Status Codes:
void * getParameterTextureHandle ( const MString parameterName)

Get a resource handle for a texture parameter.

Parameters:
[in]parameterNameName of the parameter to query
Returns:
Resource handle for a texture parameter
Examples:
hwPhongShader.cpp.
MStatus getParameter ( const MString parameterName,
MHWRender::MTextureAssignment value 
)

Get a named texture parameter.

Parameters:
[in]parameterNameName of the parameter to query
[out]valueValue of the parameter
Returns:
Status code
Status Codes:
MStatus getParameter ( MLightParameterInformation::StockParameterSemantic  semantic,
MIntArray value 
)

Get a boolean or integer parameter by semantic.

If more than one parameter matches the semantic, the value of the first matching boolean or integer parameter found will be returned.

Parameters:
[in]semanticSemantic of the parameter to retrieve
[out]valueValue of the parameter
Returns:
Status code
Status Codes:

Get a float parameter by semantic.

If more than one parameter matches the semantic, the value of the first matching float parameter found will be returned.

Parameters:
[in]semanticSemantic of the parameter to retrieve
[out]valueValue of the parameter
Returns:
Status code
Status Codes:
MStatus getParameter ( MLightParameterInformation::StockParameterSemantic  semantic,
MMatrix value 
)

Get a matrix parameter by semantic.

If more than one parameter matches the semantic, the value of the first matching matrix parameter found will be returned.

Parameters:
[in]semanticSemantic of the parameter to retrieve
[out]valueValue of the parameter
Returns:
Status code
Status Codes:
MStatus getParameter ( MLightParameterInformation::StockParameterSemantic  semantic,
MSamplerStateDesc samplerDesc 
)

Get a sampler parameter by semantic.

If more than one parameter matches the semantic, the value of the first matching sampler parameter found will be returned.

Parameters:
[in]semanticSemantic of the parameter to retrieve
[out]samplerDescValue of the parameter
Returns:
Status code
Status Codes:
void * getParameterTextureHandle ( MLightParameterInformation::StockParameterSemantic  semantic)

Get a resource handle for a texture parameter by semantic.

Parameters:
[in]semanticSemantic of the parameter to retrieve
Returns:
Resource handle for a texture parameter

Get a texture parameter by semantic.

If more than one parameter matches the semantic, the value of the first matching texture parameter found will be returned.

Parameters:
[in]semanticSemantic of the parameter to retrieve
[out]valueValue of the parameter
Returns:
Status code
Status Codes:
MString lightType ( ) const

Get the classification of the light node.

Returns:
Classification
  • ambientLight Ambient Light
  • areaLight Area Light
  • directionalLight Directional Light
  • pointLight Point Light
  • spotLight Spot Light
  • volumeLight Volume Light
MDagPath lightPath ( MStatus ReturnStatus = NULL) const

Returns the DagPath to the scene light.

Will return an unitialized DagPath for default lights.

Parameters:
[out]ReturnStatusStatus code.
Returns:
An MDagPath that references the object to which the Function Set is attached. If the function set is not attached to a dag path an uninitialized MDagPath will be returned.
Status Codes:

MLightParameterInformation MLightParameterInformation MLightParameterInformation MLightParameterInformation MLightParameterInformation MLightParameterInformation MLightParameterInformation MLightParameterInformation MLightParameterInformation MLightParameterInformation
MLightParameterInformation MLightParameterInformation MLightParameterInformation MLightParameterInformation MLightParameterInformation MLightParameterInformation MLightParameterInformation MLightParameterInformation MLightParameterInformation MLightParameterInformation