![]() |
Murl Engine Lua Addon API
Version 1.0 beta
|
The ILight graph node interface.
This interface represents a light source in world space. The light's position and direction cannot be specified directly; instead, a separate ILightTransform node must be used that references the ILight node it is supposed to move/rotate.
To enable colored light, the SetColor() method of the Graph::IColored base interface can be used.
By default, the light source's direction runs along the negative Z axis, i.e. parallel to the default camera viewing direction. The default position is (0/0/0). Depending on the actual type of this light source, either the light's position, direction, or both are used for lighting calculations:
See sceneGraphStatesSlotsUnits for an overview of state handling during scene graph traversal.
See Graph::ILightTransform for setting a light's position and orientation.
See Graph::ILightState for activating lights for rendering.
Murl.Graph.IColored
Murl.Graph.IStateUnit
Get the constant INode interface. This method returns a constant pointer to the node's INode interface, to be able to query common node properties such as active state, visibility or ID.
Murl.Graph.INode GetNodeInterface()
Get the constant ISubject interface. This method returns a constant pointer to the node's ISubject interface, to be able to query subject properties such as world transform, viewing matrix, projection matrix etc.
Murl.Graph.ISubject GetSubjectInterface()
Get the constant container holding the optional child lights. This method returns a constant pointer to the node's Graph::ILightNodeTarget sub container, which is used to store multiple sub-lights.
Murl.Graph.IGenericNodeTarget.GraphILight GetSubLightNodeTarget()
Get the constant Graph::ITextureNodeTarget container. This method returns a constant pointer to the node's Graph::ITextureNodeTarget container, which allows to query an optional texture to project onto the geometry affected by the light.
Murl.Graph.IGenericNodeTarget.GraphITexture GetTextureNodeTarget()
Set the light type. This method sets the type of light, either directional, point or spot light.
Boolean SetType(Murl.IEnums.LightType type)
type | The light type to set. |
Get the light type.
Murl.IEnums.LightType GetType()
Set the light shape. This method sets the shape of the light's projection. This is only useful when a projected light texture is used.
Boolean SetShape(Murl.IEnums.LightShape shape)
shape | The light shape to set. |
Get the light shape.
Murl.IEnums.LightShape GetShape()
Set the light intensity. The light intensity can be queried in a shader via the uLightSpotN.z uniform variable, with N being the light unit where the light is currently bound. By default, the intensity is set to 1.0.
Boolean SetIntensity(Number intensity)
intensity | The light intensity to set. |
Get the light intensity.
Number GetIntensity()
Set the light attenuation parameters. This method sets all three light attenuation parameters (constant, linear and quadratic), given as individual values.
Boolean SetAttenuation(Number constant, Number linear, Number quadratic)
constant | The constant light attenuation value. |
linear | The linear light attenuation value. |
quadratic | The quadratic light attenuation value. |
Set the light attenuation parameters. This method sets all three light attenuation parameters (constant, linear and quadratic), packed into a given vector's X, Y and Z components, respectively.
Boolean SetAttenuation(Murl.Math.Vector values)
values | A vector holding the light attenuation parameters. |
Set the constant light attenuation parameter.
Boolean SetConstantAttenuation(Number value)
value | The constant light attenuation value. |
Set the linear light attenuation parameter.
Boolean SetLinearAttenuation(Number value)
value | The linear light attenuation value. |
Set the quadratic light attenuation parameter.
Boolean SetQuadraticAttenuation(Number value)
value | The quadratic light attenuation value. |
Get the light attenuation parameters.
Murl.Math.Vector GetAttenuation()
Get the constant light attenuation parameter.
Number GetConstantAttenuation()
Get the linear light attenuation parameter.
Number GetLinearAttenuation()
Get the quadratic light attenuation parameter.
Number GetQuadraticAttenuation()
Set the spot exponent and cutoff angle value.
Boolean SetSpot(Number exponent, Number cutoffAngle)
exponent | The spot exponent value in the range [0, 128]. |
cutoffAngle | The spot cutoff angle in the range [0, PI/2] radians. |
Set the combined spot exponent and cutoff angle value.
Boolean SetSpot(Murl.Math.Vector values)
values | A vector containing the spot exponent value in the range [0, 128] in the X component, and the spot cutoff angle in the range [0, PI/2] radians in the Y component. |
Set the spot exponent value.
Boolean SetSpotExponent(Number exponent)
exponent | The spot exponent value in the range [0, 128]. |
Set the spot cutoff angle in degrees.
Boolean SetSpotCutoffAngle(Number cutoffAngle)
cutoffAngle | The spot cutoff angle in the range [0, PI/2]. |
Get the combined spot exponent and cutoff angle value.
Murl.Math.Vector GetSpot()
Get the spot exponent value.
Number GetSpotExponent()
Get the spot cutoff angle in radians.
Number GetSpotCutoffAngle()
Set the light's aspect ratio used for shadow maps. When using directional or point lights for rendering into a shadow map, this method (together with any of the SetFieldOfView methods below) can be used to define the actual volume considered for generating the shadow map.
Boolean SetAspectRatio(Number ratio)
ratio | The X:Y aspect ratio. |
Get the current aspect ratio.
Number GetAspectRatio()
Set the field of view at the minimum distance. This method sets both the horizontal and vertical field of view values. See SetAspectRatio().
Boolean SetFieldOfView(Number fovX, Number fovY)
fovX | The horizontal field of view. |
fovY | The vertical field of view. |
Set the horizontal field of view, at the minimum distance. See SetAspectRatio().
Boolean SetFieldOfViewX(Number fovX)
fovX | The horizontal field of view. |
Set the vertical field of view, at the minimum distance. See SetAspectRatio().
Boolean SetFieldOfViewY(Number fovY)
fovY | The vertical field of view. |
Get the horizontal field of view.
Number GetFieldOfViewX()
Get the vertical field of view.
Number GetFieldOfViewY()
Set the light's minimum influence radius. The given value only has effect when rendering a projected light texture. In this case, it represents the near plane distance of the light projection matrix.
Boolean SetMinDistance(Number distance)
distance | The minimum distance. |
Set the light's maximum influence radius. This method sets the radius of the light's bounding sphere, which is used to determine the nearest light source within a group, for every geometry object for which the respective group is active. For rendering projected light textures, this also represents the far plane of the light projection matrix.
Boolean SetMaxDistance(Number distance)
distance | The radius of the bounding sphere. |
Get the stage indices of the N nearest sub-lights.
Integer, Murl.Array.UInt32 GetNearestStages(Murl.Graph.IBoundingVolume boundingVolume, Murl.Array.UInt32 stageIndices, Integer maxStages)
boundingVolume | The bounding volume to check the sub-lights against. |
stageIndices | A reference to an array of stage indices to write to. |
maxStages | The size of the output array. |
Get the light's number of stages.
Integer GetNumberOfStages()
Get the light's bounding volume for a given stage.
Murl.Graph.IBoundingVolume GetBoundingVolume(Integer stage)
stage | The stage to query. |
Get the light's minimum influence distance for a given stage.
Number GetMinDistance(Integer stage)
stage | The stage to query. |
Get the light's maximum influence radius for a given stage.
Number GetMaxDistance(Integer stage)
stage | The stage to query. |