This page has been translated automatically.
Видеоуроки
Interface
Essentials
Advanced
Подсказки и советы
Основы
Программирование на C#
Рендеринг
Принципы работы
Свойства (properties)
Компонентная Система
Рендер
Физика
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Настройки и предпочтения
Работа с проектами
Настройка параметров узла
Setting Up Materials
Настройка свойств
Освещение
Landscape Tool
Sandworm
Использование инструментов редактора для конкретных задач
Extending Editor Functionality
Встроенные объекты
Ноды (Nodes)
Объекты (Objects)
Эффекты
Декали
Источники света
Geodetics
World Objects
Звуковые объекты
Объекты поиска пути
Players
Программирование
Основы
Настройка среды разработки
Примеры использования
UnigineScript
C++
C#
Унифицированный язык шейдеров UUSL
File Formats
Rebuilding the Engine Tools
GUI
Двойная точность координат
API
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
Работа с контентом
Оптимизация контента
Материалы
Art Samples
Tutorials
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

Unigine::Plugins::IG::SkyMap Class

Warning
The functionality described in this article is not available in the Community SDK edition.
You should upgrade to Sim SDK edition to use it.
Header: #include <plugins/UnigineIG.h>

This class is used to manage the Sun, the Moon, stars, day/night cycle for the IG.

Notice
IG plugin must be loaded.

The Celestial property is used to set the Sun and the Moon.

SkyMap Class

Members


void setTimezone ( float hour ) #

Sets the time zone to be used for the simulation in the UTC format. The image generator is configured to use Greenwhich time zone by default.

Arguments

  • float hour - UTC time zone value.

float getTimezone ( ) const#

Returns the time zone currently used for the simulation in the UTC format.

Return value

UTC time zone value.

void setDateTime ( time_t time_posix, bool UTC = false ) #

Sets the time of the simulation.

Arguments

  • time_t time_posix - Time of the simulation to be set, number of seconds since January 1, 1970
  • bool UTC - true to set this time as the Coordinated Universal Time (UTC +0), false — to set this time as the current local time.

void setDateTime ( int sec, int min, int hour, int day, int month, int year, bool UTC = false ) #

Sets the current date and time.

Arguments

  • int sec - An integer between 0 and 59 to be set as seconds value.
  • int min - An integer between 0 and 59 to be set as minutes value.
  • int hour - An integer between 0 (midnight) and 23 (11 p.m.) local time to be set as hours value.
  • int day - An integer between 1 and 31 to be set as day value.
  • int month - An integer between 1 and 12 to be set as month value.
  • int year - An integer to be set as year value.
  • bool UTC - true to set this time as the Coordinated Universal Time (UTC +0), false — to set this time as the current local time.

time_t getDateTime ( ) #

Returns the current time of the simulation.

Return value

Current time of the simulation, number of seconds since January 1, 1970

void setContinuousTime ( bool enable ) #

Enables or disables continuous time of day. When enabled the image generator will continuously update the time of day. Otherwise the time and date once set will remain unchanged.

Arguments

  • bool enable - true to enable continuous time of day; false - to use static time.

bool isContinuousTime ( ) #

Returns a value indicating if the time of day is continuously updated by the image generator ore remains static.

Return value

true if the time of day is continuously updated by the image generator; otherwise, false.

void setStarfieldIntensity ( float intensity ) #

Sets the intensity of the star field.

Arguments

  • float intensity - Star field intensity value to be set, within the [0.0f, 1.0f] range. The higher the value, the brighter the stars will be.

float getStarfieldIntensity ( ) #

Returns the current star field intensity value.

Return value

Current star field intensity value, within the [0.0f, 1.0f] range. The higher the value, the brighter the stars will be.

void setSunEnabled ( bool enable ) #

Sets a value indicating if the Sun is to be rendered or not.

Arguments

  • bool enable - true to enable rendering of the Sun; false - to disable it.

bool isSunEnabled ( ) #

Returns a value indicating if the Sun is rendered or not.

Return value

true if the Sun is rendered; otherwise, false.

void setSunIntensity ( float value ) #

Sets the intensity of the sun.

Arguments

  • float value - Sun intensity value within the [0.0f, 1.0f] range. The higher the value, the brighter the sun is.

float getSunIntensity ( ) const#

Returns the current sun intensity value.

Return value

Sun intensity value within the [0.0f, 1.0f] range. The higher the value, the brighter the sun is.

NodePtr getSunNode ( ) #

Returns a pointer to the node currently used to represent the Sun. Nodes for the Sun and the Moon can be assigned via the UnigineEditor.

Return value

Pointer to the node currently used to represent the Sun.

void setMoonEnabled ( bool enable ) #

Sets a value indicating if the Moon is to be rendered or not.

Arguments

  • bool enable - true to enable rendering of the Moon; false - to disable it.

bool isMoonEnabled ( ) #

Returns a value indicating if the Moon is rendered or not.

Return value

true if the Moon is rendered; otherwise, false.

void setMoonIntensity ( float value ) #

Sets the intensity of the moon.

Arguments

  • float value - Moon intensity value within the [0.0f, 1.0f] range. The higher the value, the brighter the moon is.

float getMoonIntensity ( ) const#

Returns the current moon intensity value.

Return value

Moon intensity value within the [0.0f, 1.0f] range. The higher the value, the brighter the moon is.

NodePtr getMoonNode ( ) #

Returns a pointer to the node currently used to represent the Moon. Nodes for the Sun and the Moon can be assigned via the UnigineEditor.

Return value

Pointer to the node currently used to represent the Moon.

void setStarfieldEnabled ( bool enable ) #

Sets a value indicating if the star field is to be rendered or not.

Arguments

  • bool enable - true to enable star field rendering; false - to disable it.

bool isStarfieldEnabled ( ) #

Returns a value indicating if the star field is rendered or not.

Return value

true if the star field is rendered; otherwise, false.

void refresh ( ) #

Refreshes the sky map according to its current settings. This method should be called after setting sky map's parameters to apply them. Sky map change callbacks are called on refresh.

void addCallbackRefresh ( void * subscriber, Unigine::CallbackBase * callback ) #

Adds a callback on changing sky map state.
Source code (C++)
/// callback function to be called when sky state changes
void SomeClass::my_callback()
{
	// pointer to your sun node (don't forget to initialize it)
	NodePtr sun;
	
	// calculating zenith angle to determine if it is night time or not
	float zenith = getAngle(vec3_up, sun->getDirection(AXIS_Z));
	bool night = zenith > sun_zenit_threshold;
	
	// switching lights
	for (auto & it : lights)
	{
		it.data.setEnable(night);
	}
	
	// switching the emission state for emissive materials
	for (auto & it : emissive_materials)
	{
		it->setState("emission",night);
	}			
}

// ...
// somewhere in code
void SomeClass::init()
{
	// adding "my_callback" to be called on changing sky state
	ig_manager->getSkyMap()->addCallbackRefresh(this, Unigine::MakeCallback(this, &SomeClass::my_callback ) );
}

Arguments

  • void * subscriber - Callback subscriber ID. This ID can be used to remove this callback when necessary.
  • Unigine::CallbackBase * callback - Callback pointer.

void removeCallbackRefresh ( void * subscriber ) #

Removes a callback on changing sky map state for the specified subscriber.

Arguments

  • void * subscriber - Callback subscriber ID specified when adding it.
Last update: 29.04.2021
Build: ()