This page has been translated automatically.
Видеоуроки
Интерфейс
Основы
Продвинутый уровень
Подсказки и советы
Основы
Программирование на C#
Рендеринг
Профессиональный уровень (SIM)
Принципы работы
Свойства (properties)
Компонентная Система
Рендер
Режимы вывода изображения
Физика
Браузер SDK 2
Лицензирование и типы лицензий
Дополнения (Add-Ons)
Демонстрационные проекты
API Samples
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Контроль версий
Настройки и предпочтения
Работа с проектами
Настройка параметров ноды
Setting Up Materials
Настройка свойств
Освещение
Sandworm
Использование инструментов редактора для конкретных задач
Расширение функционала редактора
Встроенные объекты
Ноды (Nodes)
Объекты (Objects)
Эффекты
Декали
Источники света
Geodetics
World-ноды
Звуковые объекты
Объекты поиска пути
Player-ноды
Программирование
Основы
Настройка среды разработки
Примеры использования
C++
C#
UnigineScript
Унифицированный язык шейдеров UUSL (Unified UNIGINE Shader Language)
Плагины
Форматы файлов
Материалы и шейдеры
Rebuilding the Engine Tools
Интерфейс пользователя (GUI)
Двойная точность координат
API
Animations-Related Classes
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
VR-Related Classes
Работа с контентом
Оптимизация контента
Материалы
Визуальный редактор материалов
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Учебные материалы

Unigine::LightProj Class

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

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

Example#

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

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

/* .. */

// creating a projected light source and setting its color to white, attenuation distance to 10 units and FOV angle to 60 degrees
LightProjPtr projector = LightProj::create(Math::vec4(1.0f, 1.0f, 0.5f, 1.0f), 10.0f, 60.0f, "");

// setting position of the light source
projector->setWorldPosition(Math::Vec3(2.5f, 2.5f, 3.0f));

// setting the name of the light source
projector->setName("projector");

// setting rotation of the light source
projector->setNodeRotation(Math::quat(-45.0f, 45.0f, 0.0f));

// setting penumbra factor
projector->setPenumbra(0.425f);

// setting a texture named "mytexture.tga" for light modulation
projector->setTextureFilePath("mytexture.tga");

// setting light intensity
projector->setIntensity(1.0f);

See Also#

  • A set of UnigineScript API samples located in the <UnigineSDK>/data/samples/lights/ folder:
    • proj_00
    • proj_03

LightProj Class

Members


static LightProjPtr create ( 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.

int setTextureImage ( const Ptr<Image> & image, bool 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.
  • bool 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.

int getTextureImage ( const Ptr<Image> & image ) const#

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.

static int type ( ) #

Returns the type of the node.

Return value

Light type identifier.

void setNearAttenuationDistance ( float distance ) #

Arguments

  • float distance

float getNearAttenuationDistance ( ) const#

void setNearAttenuationGradientLength ( float length ) #

Arguments

  • float length

float getNearAttenuationGradientLength ( ) const#

void setShadowNearClippingDistance ( float distance ) #

Arguments

  • float distance

float getShadowNearClippingDistance ( ) const#

Math::mat4 getShadowProjection ( ) const#

Last update: 06.11.2024
Build: ()