This page has been translated automatically.
Видеоуроки
Interface
Essentials
Advanced
Полезные советы
Программирование на C#
Принципы работы
Свойства (properties)
Компонентная Система
Рендер
Физика
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Настройки и предпочтения
Работа с проектами
Настройка параметров узла
Setting Up Materials
Setting Up Properties
Освещение
Landscape Tool
Sandworm (Experimental)
Использование инструментов редактора для конкретных задач
Extending Editor Functionality
Встроенные объекты
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Objects
Sound Objects
Pathfinding 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.

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 ( int hour, int min, int sec ) #

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

Arguments

  • int hour - An integer between 0 (midnight) and 23 (11 p.m.) local time to be set as hours value.
  • int min - An integer between 0 and 59 to be set as minutes value.
  • int sec - An integer between 0 and 59 to be set as seconds value.

void setDateTime ( time_t time ) #

Sets the time of the simulation.

Arguments

  • time_t time - Time of the simulation to be set, number of seconds since January 1, 1970

void setDateTime ( int sec, int min, int hour, int day, int month, int year ) #

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.

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.

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.

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: 24.11.2020
Build: ()