LightProj Class
LightProj Class
Members
LightProj (const Math::vec4 & color, float attenuation_distance, float fov, const char * name = 0)
Constructor. Creates a new projected light source with texture modulation based on given parameters.Arguments
- const Math::vec4 & color - Color of the new light source.
- float attenuation_distance - Distance from the light source shape, at which the light source doesn't illuminate anything.
- float fov - Field of view of the new light source.
- const char * name - Path to a texture of the new light source.
const char * getImageTextureName ()
Returns the name (path) of the texture used with this light source.Return value
Name of the texture.int getImageTextureImage (const Ptr<Image> & image)
Reads the light image texture into an Image instance.Arguments
- const Ptr<Image> & image - Image, into which the texture is read.
Return value
Returns 1 if the texture is read successfully; otherwise, 0.int setImageTextureImage (const Ptr<Image> & image, int dynamic = 0)
Sets a given Image instance as the light image texture. If you need to set a texture of all the lights in the scene, set dynamic flag to 1.Arguments
- const Ptr<Image> & image - Image.
- int dynamic - Dynamic texture flag.
- If set to 0, changing a texture of the light instance will also affect all the lights in the scene.
- If set to 1, an image will be successfully set only for the current light instance.
Return value
Returns 1 if the texture is set successfully; otherwise, 0.float getShapeLength ()
Returns a length of the capsule-shaped or rectangular light source.Return value
Length of the light source shape.void setFov (float fov)
Updates the current field of view of the projected light source. Remember that large fields of view may lead to shadow distortions.Arguments
- float fov - New field of view in degrees. This value will be saturated in range [1; 180].
void setAttenuationDistance (float distance)
Updates the distance from the light source shape, at which the light source doesn't illuminate anything.Arguments
- float distance - Distance from the light source shape, at which the light source doesn't illuminate anything.
void setShapeLength (float length)
Updates the length of the capsule-shaped or rectangular light source.Arguments
- float length - Length of the light source shape.
void setImageTexture (const Ptr<Texture> & texture)
Sets the light image texture smart pointer.Arguments
- const Ptr<Texture> & texture - Texture smart pointer.
float getAttenuationDistance ()
Returns the distance from the light source shape, at which the light source doesn't illuminate anything.Return value
Distance from the light source shape, at which the light source doesn't illuminate anything.Ptr<Texture> getImageTexture ()
Gets a light image texture smart pointer.Return value
Returns image texture smart pointer.Math::mat4 getProjection ()
Returns the projection matrix used with this light source.Return value
Projection matrix.float getShapeHeight ()
Returns the height of the rectangular light source.Return value
Height of the light source shape.float getFov ()
Returns the current field of view of the projected light source.Return value
Field of view in degrees.void setShapeType (int type)
Updates the shape of the light source.A light source of the rectangular shape produces the light and the speck in a form of a rounded rectangle.
Arguments
- int type - Shape of the light source (one of the SHAPE_* variables).
float getZNear ()
Returns the distance to the near clipping plane of the projected light source.Return value
Distance to the near clipping plane in units.void setImageTextureName (const char * name)
Updates the texture used with this light source.Arguments
- const char * name - Name (path) of the new texture.
int getShapeType ()
Returns the shape of the light source.
A light source of the rectangular shape produces the light and the speck in a form of a rounded rectangle.
Return value
Shape of the light source (one of the SHAPE_* variables).float getShapeRadius ()
Returns a radius of the spherical, capsule-shaped or rectangular light source.
In case of the rectangular shape, the corner radius will be returned.
Return value
Radius of the light source shape.void setShapeHeight (float height)
Updates the height of the rectangular light source.Arguments
- float height - Height of the light source shape.
void setZNear (float znear)
Updates the distance to the near clipping plane of the projected light source.Arguments
- float znear - New distance to the near clipping plane in units. If a negative value is provided, 0 will be used instead.
void setShapeRadius (float radius)
Updates the radius of the spherical, capsule-shaped or rectangular light source.In case of the rectangular shape, the corner radius is set.
Arguments
- float radius - Radius of the light source shape.
setPenumbra (float penumbra)
Arguments
- float penumbra
getPenumbra ()
Last update: 2017-07-03
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)