This page has been translated automatically.
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Migration
Migrating to UNIGINE 2.0
C++ API Migration
Migrating from UNIGINE 2.0 to UNIGINE 2.1
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

LightProj Class

This class is used to create projected light sources that emit light from a signle point and cast a cone of light. It is possible to modulate the light from these light sources with a texture.

LightProj Class

This class inherits from Light

Members


LightProj (vec4 color, float radius, float fov, string texture = 0)

Constructor. Creates a new projected light source with texture modulation based on given parameters.

Arguments

  • vec4 color - Color of the new light source.
  • float radius - Radius of the new light source.
  • float fov - Field of view of the new light source.
  • string texture - Path to a texture of the new light source.

float getFov ()

Returns the current field of view of the projected light source.

Return value

Field of view in degrees.

int getImageTextureImage (Image image)

Reads the light image texture into an Image instance.

Arguments

  • Image image - Image, into which the texture is read.

Return value

Returns 1 if the texture is read successfully; otherwise, 0.

string getImageTextureName ()

Returns the name (path) of the texture used with this light source.

Return value

Name of the texture.

mat4 getProjection ()

Returns the projection matrix used with this light source.

Return value

Projection matrix.

float getRadius ()

Returns the current radius of the projected light source.

Return value

Radius of the light source.

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 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].

int setImageTextureImage (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

  • 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.

void setImageTextureName (string texture)

Updates the texture used with this light source.

Arguments

  • string texture - Name (path) of the new texture.

void setRadius (float radius)

Updates the radius of the projected light source.

Arguments

  • float radius - New radius of the light source. If a negative value is provided, 0 will be used instead.

void setZNear (float distance)

Updates the distance to the near clipping plane of the projected light source.

Arguments

  • float distance - New distance to the near clipping plane in units. If a negative value is provided, 0 will be used instead.
Last update: 2017-07-03
Build: ()