UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
FAQ
Программирование
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
CIGI Client Plugin
Rendering-Related Classes

Unigine::LightWorld Class

Header:#include <UnigineLights.h>
Inherits:Light

This class is used to create world light sources. This type of lite sources imitates sunlight and uses parallel-split shadow mapping.

Example

The following code illustrates how to create a world light source and set its parameters.

Source code (UnigineScript)
#include <UnigineLights.h>
using namespace Unigine;

/* .. */

// creating a world light source and setting its color to white (1.0f, 1.0f, 1.0f, 1.0f)
LightWorldPtr thesun = LightWorld::create(Math::vec4(1.0f, 1.0f, 1.0f, 1.0f));

// setting the name of the world light
thesun->setName("Sun");
	
// setting disable angle of the world light
thesun->setDisableAngle(90.0f);

// setting light intensity
thesun->setIntensity(1.0f);
	
// setting scattering type to sun scattering
thesun->setScattering(LightWorld::SCATTERING_SUN);

LightWorld Class

Members


static LightWorldPtr create(const Math::vec4 & color)

Constructor. Creates a new world light source with a given color.

Arguments

  • const Math::vec4 & color - Color of the new light source.

Ptr<LightWorld> cast(const Ptr<Node> & node)

Casts a LightWorld out of the Node instance.

Arguments

  • const Ptr<Node> & node - Pointer to Node.

Return value

Pointer to LightWorld.

Ptr<LightWorld> cast(const Ptr<Light> & base)

Casts a LightWorld out of the Light instance.

Arguments

  • const Ptr<Light> & base - Pointer to Light.

Return value

Pointer to LightWorld.

void setMode(int mode)

Sets rendering mode for the light source. This option determines whether the light is to be rendered as a dynamic or static one.

Arguments

  • int mode - Light mode, one of the MODE_* variables. By default the mode is set to MODE_MIXED.

int getMode()

Returns the current rendering mode for the light source. This option determines whether the light is to be rendered as a dynamic or static one.

Return value

Light mode, one of the MODE_* variables. By default the mode is set to MODE_MIXED.

void setDisableAngle(float angle)

Sets an angle at which the light source is disabled (shadows and the diffuse component is disabled). However, the light source still affects scattering.

Arguments

  • float angle - Angle at which the light source is disabled.

float getDisableAngle()

Returns an angle at which the light source is disabled (shadows and the diffuse component is disabled). However, the light source still affects scattering.

Return value

Angle at at which the light source is disabled.

void setNumShadowCascades(int cascades)

Sets the number of shadow cascades with different shadow maps. All the shadow maps have the same resolution, but are applied to different cascades. Thus, close-range shadows are of higher quality and distant ones of lower.

Arguments

  • int cascades - Number of shadow cascades. Accepted values are from 1 to 4. The default is 4.

int getNumShadowCascades()

Returns the number of shadow cascades with different shadow maps. All the shadow maps have the same resolution, but are applied to different cascades. Thus, close-range shadows are of higher quality and distant ones of lower.

Return value

The number of shadow cascades. The minimum number of cascades is 1, the maximum is 4.

void setScattering(int scattering)

Sets a lighting type for the world light.

Arguments

int getScattering()

Returns a lighting type set for the world light.

Return value

One of the SCATTERING_* variables.

void setShadowCascadeBorder(int num, float r)

Calculates the distance to the border of the specified cascade.

Arguments

  • int num - The number of the cascade in range [0;num_cascades-1].
  • float r - A multiplier for the distance to the border of the cascade at which shadows are rendered in range [0;1].

float getShadowCascadeBorder(int num)

Returns the multiplier for the distance to the border of the specified cascade at which shadows are rendered.

Arguments

  • int num - The number of the cascade in range [0;num_cascades-1].

Return value

Multiplier for the distance to the border of the cascade.

void setShadowSharpness(float sharpness)

Sets the sharpness of the shadow edges.

Arguments

  • float sharpness - Sharpness of the shadow edges.

float getShadowSharpness()

Returns the sharpness of the shadow edges.

Return value

Sharpness of the shadow edges.

int type()

Returns the type of the node.

Return value

Light type identifier.

int SCATTERING_MOON

Description

Render the atmosphere in accordance with the Moon's lighting.

int SCATTERING_NONE

Description

Render the atmosphere with no influence of the global lights (sun and moon), i.e. the light gradient won't be changed in any direction.

int SCATTERING_SUN

Description

Render the atmosphere in accordance with the Sun's lighting.
Last update: 04.06.2018