This page has been translated automatically.
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
Programming
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
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.

IG::ISkyMap Class

Header: #include <plugins/IGInterface.h>

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

Notice
IG plugin must be loaded.

ISkyMap 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, CallbackBase * callback )

Adds a callback on changing global meteo conditions.
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);
	}			
}

// ...
// somwhere 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.
  • 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: 2020-01-14
Build: ()