Cesium for Unreal 2.12.0
Loading...
Searching...
No Matches
ACesiumSunSky Class Reference

A globe-aware sun sky actor. More...

#include <CesiumSunSky.h>

Inheritance diagram for ACesiumSunSky:

Public Member Functions

 ACesiumSunSky ()
 
void UpdateSun ()
 
void UpdateSun_Implementation ()
 
void UpdateAtmosphereRadius ()
 
bool IsDST (bool DSTEnable, int32 InDSTStartMonth, int32 InDSTStartDay, int32 InDSTEndMonth, int32 InDSTEndDay, int32 InDSTSwitchHour) const
 Check whether the current time and date (based on this class instance's properties) falls within Daylight Savings Time.
 
virtual void OnConstruction (const FTransform &Transform) override
 Gets called when the actor is first created, and when properties are changed at edit-time.
 

Static Public Member Functions

static void GetHMSFromSolarTime (double InSolarTime, int32 &Hour, int32 &Minute, int32 &Second)
 Convert solar time to Hours:Minutes:Seconds.
 

Public Attributes

USceneComponent * Scene
 
USkyLightComponent * SkyLight
 
UDirectionalLightComponent * DirectionalLight
 
USkyAtmosphereComponent * SkyAtmosphere
 
UCesiumGlobeAnchorComponentGlobeAnchor
 The Globe Anchor Component that precisely ties this Actor to the Globe.
 
double TimeZone = -5.0
 Gets the time zone, represented as hours offset from GMT.
 
double SolarTime = 13.0
 The current solar time represented as hours from midnight.
 
int32 Day = 21
 The day of the month.
 
int32 Month = 9
 The month of the year, where 1 is January and 12 is December.
 
int32 Year = 2019
 The year.
 
double NorthOffset = -90.0
 Offset in the sun's position.
 
bool UseDaylightSavingTime = true
 Enables adjustment of the Solar Time for Daylight Saving Time (DST).
 

Protected Member Functions

ACesiumGeoreferenceGetGeoreference () const
 Gets the Georeference Actor associated with this instance.
 
void SetSkyAtmosphereGroundRadius (USkyAtmosphereComponent *Sky, double Radius)
 Modifies the sky atmosphere's ground radius, which represents the Earth's radius in the SkyAtmosphere rendering model.
 
void UpdateSkySphere ()
 Update MobileSkySphere by calling its RefreshMaterial function.
 
virtual void BeginPlay () override
 
virtual void EndPlay (const EEndPlayReason::Type EndPlayReason) override
 
virtual void Serialize (FArchive &Ar) override
 
virtual void Tick (float DeltaSeconds) override
 
virtual void PostLoad () override
 
virtual bool ShouldTickIfViewportsOnly () const override
 

Protected Attributes

ACesiumGeoreferenceGeoreference_DEPRECATED
 THIS PROPERTY IS DEPRECATED.
 
 meta
 
bool UpdateAtmosphereAtRuntime = true
 Updates the atmosphere automatically given current player pawn's longitude, latitude, and height.
 
 Category
 
float AtmosphereHeight = 60.0f
 The height of the atmosphere layer above the ground, in kilometers.
 
float AerialPerspectiveViewDistanceScale = 1.0f
 Makes the aerial perspective look thicker by scaling distances from view to surfaces (opaque and translucent).
 
float RayleighExponentialDistribution = 8.0f
 The altitude in kilometers at which Rayleigh scattering effect is reduced to 40%.
 
float MieExponentialDistribution = 1.2f
 The altitude in kilometers at which Mie effects are reduced to 40%.
 
bool UseLevelDirectionalLight = false
 False: Use Directional Light component inside CesiumSunSky.
 
ADirectionalLight * LevelDirectionalLight
 Reference to a manually assigned Directional Light in the level.
 
double Elevation = 0.f
 The current sun elevation in degrees above the horizontal, as viewed from the Georeference origin.
 
double CorrectedElevation = 0.f
 The current sun elevation, corrected for atmospheric diffraction, in degrees above the horizontal, as viewed from the Georeference origin.
 
double Azimuth = 0.f
 The current sun azimuth in degrees clockwise from North toward East, as viewed from the Georeference origin.
 
bool UseMobileRendering
 A switch to toggle between desktop and mobile rendering code paths.
 
TSubclassOf< AActor > SkySphereClass
 Mobile platforms currently do not support the SkyAtmosphereComponent.
 
AActor * SkySphereActor
 Reference to BP_Sky_Sphere or similar actor (mobile only)
 
double MobileDirectionalLightIntensity = 6.f
 Default intensity of directional light that's spawned for mobile rendering.
 

Detailed Description

A globe-aware sun sky actor.

If the georeference is set to CartographicOrigin (aka Longitude/Latitude/Height) mode, then this actor will automatically sync its longitude and latitude properties with the georeference's, and recalculate the sun position whenever those properties change.

Note: because we use Planet Center at Component Transform for the SkyAtmosphere transform mode, this actor's location will be forced to the Earth's center if the georeference is set to CartographicOrigin.

Definition at line 29 of file CesiumSunSky.h.

Constructor & Destructor Documentation

◆ ACesiumSunSky()

ACesiumSunSky::ACesiumSunSky ( )

Member Function Documentation

◆ BeginPlay()

virtual void ACesiumSunSky::BeginPlay ( )
overrideprotectedvirtual

◆ EndPlay()

virtual void ACesiumSunSky::EndPlay ( const EEndPlayReason::Type EndPlayReason)
overrideprotectedvirtual

◆ GetGeoreference()

ACesiumGeoreference * ACesiumSunSky::GetGeoreference ( ) const
protected

Gets the Georeference Actor associated with this instance.

It is obtained from the Globe Anchor Component.

◆ GetHMSFromSolarTime()

static void ACesiumSunSky::GetHMSFromSolarTime ( double InSolarTime,
int32 & Hour,
int32 & Minute,
int32 & Second )
static

Convert solar time to Hours:Minutes:Seconds.

Copied the implementation from the engine SunSkyBP class.

◆ IsDST()

bool ACesiumSunSky::IsDST ( bool DSTEnable,
int32 InDSTStartMonth,
int32 InDSTStartDay,
int32 InDSTEndMonth,
int32 InDSTEndDay,
int32 InDSTSwitchHour ) const

Check whether the current time and date (based on this class instance's properties) falls within Daylight Savings Time.

Copied the implementation from the engine SunSkyBP class.

◆ OnConstruction()

virtual void ACesiumSunSky::OnConstruction ( const FTransform & Transform)
overridevirtual

Gets called when the actor is first created, and when properties are changed at edit-time.

Refreshes the actor's position w/r/t the georeference and handles mobile-specific setup if needed.

◆ PostLoad()

virtual void ACesiumSunSky::PostLoad ( )
overrideprotectedvirtual

◆ Serialize()

virtual void ACesiumSunSky::Serialize ( FArchive & Ar)
overrideprotectedvirtual

◆ SetSkyAtmosphereGroundRadius()

void ACesiumSunSky::SetSkyAtmosphereGroundRadius ( USkyAtmosphereComponent * Sky,
double Radius )
protected

Modifies the sky atmosphere's ground radius, which represents the Earth's radius in the SkyAtmosphere rendering model.

Only changes if there's a >0.1 difference, to reduce redraws.

Parameters
SkyA pointer to the SkyAtmosphereComponent
RadiusThe radius in kilometers.

◆ ShouldTickIfViewportsOnly()

virtual bool ACesiumSunSky::ShouldTickIfViewportsOnly ( ) const
overrideprotectedvirtual

◆ Tick()

virtual void ACesiumSunSky::Tick ( float DeltaSeconds)
overrideprotectedvirtual

◆ UpdateAtmosphereRadius()

void ACesiumSunSky::UpdateAtmosphereRadius ( )

◆ UpdateSkySphere()

void ACesiumSunSky::UpdateSkySphere ( )
protected

Update MobileSkySphere by calling its RefreshMaterial function.

◆ UpdateSun()

void ACesiumSunSky::UpdateSun ( )

◆ UpdateSun_Implementation()

void ACesiumSunSky::UpdateSun_Implementation ( )

Member Data Documentation

◆ AerialPerspectiveViewDistanceScale

float ACesiumSunSky::AerialPerspectiveViewDistanceScale = 1.0f
protected

Makes the aerial perspective look thicker by scaling distances from view to surfaces (opaque and translucent).

This value is automatically scaled according to the CesiumGeoreference Scale and the Actor scale.

Definition at line 344 of file CesiumSunSky.h.

◆ AtmosphereHeight

float ACesiumSunSky::AtmosphereHeight = 60.0f
protected

The height of the atmosphere layer above the ground, in kilometers.

This value is automatically scaled according to the CesiumGeoreference Scale and the Actor scale. However, Unreal Engine's SkyAtmosphere has a hard-coded minimum effective value of 0.1, so the atmosphere will look too thick when the globe is scaled down drastically.

Definition at line 326 of file CesiumSunSky.h.

◆ Azimuth

double ACesiumSunSky::Azimuth = 0.f
protected

The current sun azimuth in degrees clockwise from North toward East, as viewed from the Georeference origin.

Definition at line 406 of file CesiumSunSky.h.

◆ Category

ACesiumSunSky::Category
protected
Initial value:
= "Cesium|Atmosphere")
double InscribedGroundThreshold = 30.0

Definition at line 268 of file CesiumSunSky.h.

◆ CorrectedElevation

double ACesiumSunSky::CorrectedElevation = 0.f
protected

The current sun elevation, corrected for atmospheric diffraction, in degrees above the horizontal, as viewed from the Georeference origin.

Definition at line 399 of file CesiumSunSky.h.

◆ Day

int32 ACesiumSunSky::Day = 21

The day of the month.

After changing this value from Blueprints or C++, you must call UpdateSun for it to take effect.

Definition at line 91 of file CesiumSunSky.h.

◆ DirectionalLight

UDirectionalLightComponent* ACesiumSunSky::DirectionalLight

Definition at line 43 of file CesiumSunSky.h.

◆ Elevation

double ACesiumSunSky::Elevation = 0.f
protected

The current sun elevation in degrees above the horizontal, as viewed from the Georeference origin.

Definition at line 392 of file CesiumSunSky.h.

◆ Georeference_DEPRECATED

ACesiumGeoreference* ACesiumSunSky::Georeference_DEPRECATED
protected

THIS PROPERTY IS DEPRECATED.

Get the Georeference instance from the Globe Anchor Component instead.

Definition at line 158 of file CesiumSunSky.h.

◆ GlobeAnchor

UCesiumGlobeAnchorComponent* ACesiumSunSky::GlobeAnchor

The Globe Anchor Component that precisely ties this Actor to the Globe.

Definition at line 52 of file CesiumSunSky.h.

◆ LevelDirectionalLight

ADirectionalLight* ACesiumSunSky::LevelDirectionalLight
protected

Reference to a manually assigned Directional Light in the level.

Definition at line 385 of file CesiumSunSky.h.

◆ meta

ACesiumSunSky::meta
protected
Initial value:
= (EditCondition = "UseDaylightSavingTime"))
int32 DSTStartMonth = 3

Definition at line 178 of file CesiumSunSky.h.

◆ MieExponentialDistribution

float ACesiumSunSky::MieExponentialDistribution = 1.2f
protected

The altitude in kilometers at which Mie effects are reduced to 40%.

This value is automatically scaled according to the CesiumGeoreference Scale and the Actor scale.

Definition at line 372 of file CesiumSunSky.h.

◆ MobileDirectionalLightIntensity

double ACesiumSunSky::MobileDirectionalLightIntensity = 6.f
protected

Default intensity of directional light that's spawned for mobile rendering.

Definition at line 433 of file CesiumSunSky.h.

◆ Month

int32 ACesiumSunSky::Month = 9

The month of the year, where 1 is January and 12 is December.

After changing this value from Blueprints or C++, you must call UpdateSun for it to take effect.

Definition at line 104 of file CesiumSunSky.h.

◆ NorthOffset

double ACesiumSunSky::NorthOffset = -90.0

Offset in the sun's position.

Should be set to -90 for the sun's position to be accurate in the Unreal reference frame.

After changing this value from Blueprints or C++, you must call UpdateSun for it to take effect.

Definition at line 130 of file CesiumSunSky.h.

◆ RayleighExponentialDistribution

float ACesiumSunSky::RayleighExponentialDistribution = 8.0f
protected

The altitude in kilometers at which Rayleigh scattering effect is reduced to 40%.

This value is automatically scaled according to the CesiumGeoreference Scale and the Actor scale.

Definition at line 358 of file CesiumSunSky.h.

◆ Scene

USceneComponent* ACesiumSunSky::Scene

Definition at line 37 of file CesiumSunSky.h.

◆ SkyAtmosphere

USkyAtmosphereComponent* ACesiumSunSky::SkyAtmosphere

Definition at line 46 of file CesiumSunSky.h.

◆ SkyLight

USkyLightComponent* ACesiumSunSky::SkyLight

Definition at line 40 of file CesiumSunSky.h.

◆ SkySphereActor

AActor* ACesiumSunSky::SkySphereActor
protected

Reference to BP_Sky_Sphere or similar actor (mobile only)

Definition at line 427 of file CesiumSunSky.h.

◆ SkySphereClass

TSubclassOf<AActor> ACesiumSunSky::SkySphereClass
protected

Mobile platforms currently do not support the SkyAtmosphereComponent.

In lieu of that, use the engine BP_Sky_Sphere class, or a derived class.

Definition at line 421 of file CesiumSunSky.h.

◆ SolarTime

double ACesiumSunSky::SolarTime = 13.0

The current solar time represented as hours from midnight.

After changing this value from Blueprints or C++, you must call UpdateSun for it to take effect.

Definition at line 78 of file CesiumSunSky.h.

◆ TimeZone

double ACesiumSunSky::TimeZone = -5.0

Gets the time zone, represented as hours offset from GMT.

After changing this value from Blueprints or C++, you must call UpdateSun for it to take effect.

Definition at line 65 of file CesiumSunSky.h.

◆ UpdateAtmosphereAtRuntime

bool ACesiumSunSky::UpdateAtmosphereAtRuntime = true
protected

Updates the atmosphere automatically given current player pawn's longitude, latitude, and height.

Fixes artifacts seen with the atmosphere rendering when flying high above the surface, or low to the ground in high latitudes.

Definition at line 243 of file CesiumSunSky.h.

◆ UseDaylightSavingTime

bool ACesiumSunSky::UseDaylightSavingTime = true

Enables adjustment of the Solar Time for Daylight Saving Time (DST).

After changing this value from Blueprints or C++, you must call UpdateSun for it to take effect.

Definition at line 142 of file CesiumSunSky.h.

◆ UseLevelDirectionalLight

bool ACesiumSunSky::UseLevelDirectionalLight = false
protected

False: Use Directional Light component inside CesiumSunSky.

True: Use the assigned Directional Light in the level.

Definition at line 379 of file CesiumSunSky.h.

◆ UseMobileRendering

bool ACesiumSunSky::UseMobileRendering
protected

A switch to toggle between desktop and mobile rendering code paths.

This will NOT be automatically set when running on mobile, so make sure to check this setting before building on mobile platforms.

Definition at line 414 of file CesiumSunSky.h.

◆ Year

int32 ACesiumSunSky::Year = 2019

The year.

After changing this value from Blueprints or C++, you must call UpdateSun for it to take effect.

Definition at line 117 of file CesiumSunSky.h.


The documentation for this class was generated from the following file: