PC Stable Documentation
 
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Loading...
Searching...
No Matches
EntityLightSource Class Reference

Private Member Functions

void ScriptedLightBase ()
 Constructor. Everything here is executed before the constructor of all children.
 
void ~ScriptedLightBase ()
 
override void EOnInit (IEntity other, int extra)
 
override bool IsScriptedLight ()
 
void UpdateMode ()
 
private void UpdateLightMode (string slotName)
 
private void DeleteLightWithDelay ()
 Correct way of deleting light from memory. It is necesarry to have this delay due to hierarchy.
 
private void DeleteLightNow ()
 
void AttachOnObject (Object parent, vector local_pos="0 0 0", vector local_ori="0 0 0")
 Attaches this light on the parent entity, with optional position and orientation offset.
 
Object GetAttachmentParent ()
 Returns attachment parent.
 
void AttachOnMemoryPoint (Object parent, string memory_point_start, string memory_point_target="")
 Attaches this light on the parent entity's memory point, with optional direction target memory point.
 
void DetachFromParent ()
 Detaches this light from its parent entity.
 
void SetBrightnessTo (float value)
 Sets the brightness of the light.
 
void CorrectLightPulseDuringDaylight ()
 Call this after using SetBrightness(...) to fix light's intensity during daytime.
 
void FadeBrightnessTo (float value, float time_in_s)
 Fades the brightness of the light to the given value.
 
void SetRadiusTo (float value)
 Sets the radius of the light.
 
void FadeRadiusTo (float value, float time_in_s)
 Fades the radius of the light to the given value.
 
void Destroy ()
 Switches off the light and deletes it from memory.
 
void SetLifetime (float life_in_s)
 Makes the light destroy itself after the given time in seconds. The light will fade out if it's set to do so with SetFadeOutTime(...)
 
void SetFadeOutTime (float time_in_s)
 Sets the fade out time in seconds. Fade out begins automatically as the light nears the end of its life time, or when method FadeOut() is called.
 
void FadeOut (float time_in_s=-1)
 Starts the fade out process and destroys the light when its done. Optional parameter allows you to set time of this fade out in seconds. If not set, then default value (from SetFadeOutTime(...)) is used.
 
void FadeIn (float time_in_s)
 Makes the light fade into existence. Works only at the moment the light is created. Consider using FadeBrightnessTo(...) and FadeRadiusTo(...) at anytime later during lifetime.
 
void AddLifetime (float life_in_s)
 Prolongs the lifetime of the light in seconds. Use negative number to shorten its lifetime.
 
void OnFrameLightSource (IEntity other, float timeSlice)
 Override this for custom functionality.
 
override void EOnFrame (IEntity other, float timeSlice)
 On frame event. If you want to control your light within your own rules then override the event OnFrameLightSource and put your code there.
 
void SetDancingShadowsAmplitude (float max_deviation_in_meters)
 Sets the maximum range of the point light within the dancing shadows effect.
 
void SetDancingShadowsMovementSpeed (float speed_in_meters_per_frame)
 Sets the maximum speed of the point light within the dancing shadows effect.
 
float GetDancingShadowsAmplitude ()
 Returns max movement range of pointlight within the dancing shadow effect.
 
float GetDancingShadowsMovementSpeed ()
 Returns max movement speed of pointlight within the dancing shadow effect.
 
void SetSelectionID (int id)
 
void UpdateLightSourceMaterial (string path)
 
void EnableDebug (bool state)
 Enables some debug functionality of this light.
 
void HandleDancingShadows (float time, float timeSlice)
 
void HandleFlickering (float time, float timeSlice)
 
void SetFlickerSpeed (float speed)
 Sets speed of light flickering (random brightness coefficient change per second)
 
void SetFlickerAmplitude (float coef)
 Sets the change coefficient of flickering light. (0.0 - 1.0 values, result of greater values are period time of light off )
 
void SetFlickerAmplitudeMax (float coef)
 
void SetFlickerAmplitudeMin (float coef)
 
float GetFlickerSpeed ()
 Returns flicker speed.
 
float GetFlickerAmplitudeCoefMax ()
 Returns flicker amplitude maximum.
 
float GetFlickerAmplitudeCoefMin ()
 Returns flicker amplitude minimum.
 
void TryShadowOptimization ()
 Optimizes shadows by disabling them on this light source while it's within the given radius around the camera.
 
void SetDisableShadowsWithinRadius (float radius_in_m)
 When the light source gets within this radius (radius_in_m) around the camera, then it's shadows are disabled.
 
float GetDisableShadowsWithinRadius ()
 Returns the range you put inside SetDisableShadowsWithinRadius(...)
 
void CheckIfParentIsInCargo ()
 
private bool CheckLifetime (int current_time)
 
private void CheckFadeOut (int current_time)
 
private void HandleBrightnessFadeing (float timeSlice)
 
private void HandleRadiusFadeing (float timeSlice)
 
void SetBlinkingSpeed (float _speed)
 Sets blinking speed (no blinking if speed <= 0)
 
float GetBlinkingSpeed ()
 Returns the speed of blinks.
 
private void HandleBlinking (float time)
 
void EnableDimming (float baseBrightness, DimmingConfig dimCfg)
 
LightDimming GetDimming ()
 
void StopDimming ()
 

Static Private Member Functions

static ScriptedLightBase CreateLightAtObjMemoryPoint (typename name, notnull Object target, string memory_point_start, string memory_point_target="", vector global_pos="0 0 0", float fade_in_time_in_s=0)
 
static ScriptedLightBase CreateLight (typename name, vector global_pos="0 0 0", float fade_in_time_in_s=0)
 Creates an instance of light on the given position. Optionally, use fade_in_time_in_s parameter to make the light fade into existence.
 

Private Attributes

float m_LifetimeStart
 
float m_LifetimeEnd = -1
 
float m_FadeOutTime = -1
 
float m_FadeInTime = -1
 
float m_Radius
 
float m_RadiusTarget
 
float m_Brightness
 
float m_BrightnessPulse
 
float m_BrightnessPulseSpeed
 
float m_BrightnessPulseAmplitudeMax
 
float m_BrightnessPulseAmplitudeMin
 
float m_BrightnessTarget
 
float m_BrightnessSpeedOfChange = 1
 
float m_RadiusSpeedOfChange = 1
 
float m_OptimizeShadowsRadius = 0
 
float m_DancingShadowsAmplitude
 
float m_DancingShadowsSpeed
 
float m_BlinkingSpeed
 
protected int m_HiddenSelectionID
 
bool m_IsDebugEnabled = false
 
Object m_Parent
 
vector m_LocalPos
 
vector m_LocalOri
 
vector m_DancingShadowsLocalPos
 
ref Timer m_DeleteTimer
 
protected ref LightDimming m_LightDimming
 

Static Private Attributes

static ref set< ScriptedLightBasem_NightTimeOnlyLights = new set<ScriptedLightBase>()
 

Constructor & Destructor Documentation

◆ ~ScriptedLightBase()

void ~ScriptedLightBase ( )
inlineprivate

Member Function Documentation

◆ AddLifetime()

void AddLifetime ( float  life_in_s)
inlineprivate

Prolongs the lifetime of the light in seconds. Use negative number to shorten its lifetime.

◆ AttachOnMemoryPoint()

void AttachOnMemoryPoint ( Object  parent,
string  memory_point_start,
string  memory_point_target = "" 
)
inlineprivate

Attaches this light on the parent entity's memory point, with optional direction target memory point.

References vector::Direction(), ErrorEx, m_LocalPos, and vector::VectorToAngles().

◆ AttachOnObject()

void AttachOnObject ( Object  parent,
vector  local_pos = "0 0 0",
vector  local_ori = "0 0 0" 
)
inlineprivate

Attaches this light on the parent entity, with optional position and orientation offset.

References m_LocalOri, m_LocalPos, m_Parent, and SetPosition().

◆ CheckFadeOut()

private void CheckFadeOut ( int  current_time)
inlineprivate

◆ CheckIfParentIsInCargo()

void CheckIfParentIsInCargo ( )
inlineprivate

◆ CheckLifetime()

private bool CheckLifetime ( int  current_time)
inlineprivate

References Destroy().

◆ CorrectLightPulseDuringDaylight()

void CorrectLightPulseDuringDaylight ( )
inlineprivate

Call this after using SetBrightness(...) to fix light's intensity during daytime.

◆ CreateLight()

static ScriptedLightBase CreateLight ( typename name  ,
vector  global_pos = "0 0 0",
float  fade_in_time_in_s = 0 
)
inlinestaticprivate

Creates an instance of light on the given position. Optionally, use fade_in_time_in_s parameter to make the light fade into existence.

References Error(), GetGame(), and name.

◆ CreateLightAtObjMemoryPoint()

static ScriptedLightBase CreateLightAtObjMemoryPoint ( typename name  ,
notnull Object  target,
string  memory_point_start,
string  memory_point_target = "",
vector  global_pos = "0 0 0",
float  fade_in_time_in_s = 0 
)
inlinestaticprivate

References CreateLight(), and name.

◆ DeleteLightNow()

private void DeleteLightNow ( )
inlineprivate

References GetGame(), and CGame::ObjectDelete().

◆ DeleteLightWithDelay()

private void DeleteLightWithDelay ( )
inlineprivate

Correct way of deleting light from memory. It is necesarry to have this delay due to hierarchy.

References CALL_CATEGORY_SYSTEM, GetGame(), and m_DeleteTimer.

◆ Destroy()

void Destroy ( )
inlineprivate

Switches off the light and deletes it from memory.

References m_Parent, and SetEnabled().

◆ DetachFromParent()

void DetachFromParent ( )
inlineprivate

Detaches this light from its parent entity.

References GetParent(), m_LocalOri, m_LocalPos, m_Parent, and Vector().

◆ EnableDebug()

void EnableDebug ( bool  state)
inlineprivate

Enables some debug functionality of this light.

◆ EnableDimming()

void EnableDimming ( float  baseBrightness,
DimmingConfig  dimCfg 
)
inlineprivate

References LightDimming().

◆ EOnFrame()

override void EOnFrame ( IEntity  other,
float  timeSlice 
)
inlineprivate

On frame event. If you want to control your light within your own rules then override the event OnFrameLightSource and put your code there.

References GetGame(), CGame::GetTime(), m_Radius, and SetRadius().

◆ EOnInit()

override void EOnInit ( IEntity  other,
int  extra 
)
inlineprivate

References GetGame(), and GetPlayer().

◆ FadeBrightnessTo()

void FadeBrightnessTo ( float  value,
float  time_in_s 
)
inlineprivate

Fades the brightness of the light to the given value.

References Math::AbsFloat().

◆ FadeIn()

void FadeIn ( float  time_in_s)
inlineprivate

Makes the light fade into existence. Works only at the moment the light is created. Consider using FadeBrightnessTo(...) and FadeRadiusTo(...) at anytime later during lifetime.

◆ FadeOut()

void FadeOut ( float  time_in_s = -1)
inlineprivate

Starts the fade out process and destroys the light when its done. Optional parameter allows you to set time of this fade out in seconds. If not set, then default value (from SetFadeOutTime(...)) is used.

◆ FadeRadiusTo()

void FadeRadiusTo ( float  value,
float  time_in_s 
)
inlineprivate

Fades the radius of the light to the given value.

References Math::AbsFloat(), and m_Radius.

◆ GetAttachmentParent()

Object GetAttachmentParent ( )
inlineprivate

Returns attachment parent.

References m_Parent.

◆ GetBlinkingSpeed()

float GetBlinkingSpeed ( )
inlineprivate

Returns the speed of blinks.

◆ GetDancingShadowsAmplitude()

float GetDancingShadowsAmplitude ( )
inlineprivate

Returns max movement range of pointlight within the dancing shadow effect.

◆ GetDancingShadowsMovementSpeed()

float GetDancingShadowsMovementSpeed ( )
inlineprivate

Returns max movement speed of pointlight within the dancing shadow effect.

◆ GetDimming()

LightDimming GetDimming ( )
inlineprivate

◆ GetDisableShadowsWithinRadius()

float GetDisableShadowsWithinRadius ( )
inlineprivate

Returns the range you put inside SetDisableShadowsWithinRadius(...)

◆ GetFlickerAmplitudeCoefMax()

float GetFlickerAmplitudeCoefMax ( )
inlineprivate

Returns flicker amplitude maximum.

◆ GetFlickerAmplitudeCoefMin()

float GetFlickerAmplitudeCoefMin ( )
inlineprivate

Returns flicker amplitude minimum.

◆ GetFlickerSpeed()

float GetFlickerSpeed ( )
inlineprivate

Returns flicker speed.

◆ HandleBlinking()

private void HandleBlinking ( float  time)
inlineprivate

References Math::Round(), and Math::Sin().

◆ HandleBrightnessFadeing()

private void HandleBrightnessFadeing ( float  timeSlice)
inlineprivate

References Destroy().

◆ HandleDancingShadows()

void HandleDancingShadows ( float  time,
float  timeSlice 
)
inlineprivate

◆ HandleFlickering()

void HandleFlickering ( float  time,
float  timeSlice 
)
inlineprivate

References Math::RandomFloat().

◆ HandleRadiusFadeing()

private void HandleRadiusFadeing ( float  timeSlice)
inlineprivate

References Destroy(), m_Radius, and SetRadius().

◆ IsScriptedLight()

override bool IsScriptedLight ( )
inlineprivate

◆ OnFrameLightSource()

void OnFrameLightSource ( IEntity  other,
float  timeSlice 
)
inlineprivate

Override this for custom functionality.

◆ ScriptedLightBase()

void ScriptedLightBase ( )
inlineprivate

Constructor. Everything here is executed before the constructor of all children.

References GetGame(), CGame::GetTime(), and SetEnabled().

◆ SetBlinkingSpeed()

void SetBlinkingSpeed ( float  _speed)
inlineprivate

Sets blinking speed (no blinking if speed <= 0)

◆ SetBrightnessTo()

void SetBrightnessTo ( float  value)
inlineprivate

Sets the brightness of the light.

◆ SetDancingShadowsAmplitude()

void SetDancingShadowsAmplitude ( float  max_deviation_in_meters)
inlineprivate

Sets the maximum range of the point light within the dancing shadows effect.

References Math::AbsFloat().

◆ SetDancingShadowsMovementSpeed()

void SetDancingShadowsMovementSpeed ( float  speed_in_meters_per_frame)
inlineprivate

Sets the maximum speed of the point light within the dancing shadows effect.

References Math::AbsFloat().

◆ SetDisableShadowsWithinRadius()

void SetDisableShadowsWithinRadius ( float  radius_in_m)
inlineprivate

When the light source gets within this radius (radius_in_m) around the camera, then it's shadows are disabled.

◆ SetFadeOutTime()

void SetFadeOutTime ( float  time_in_s)
inlineprivate

Sets the fade out time in seconds. Fade out begins automatically as the light nears the end of its life time, or when method FadeOut() is called.

◆ SetFlickerAmplitude()

void SetFlickerAmplitude ( float  coef)
inlineprivate

Sets the change coefficient of flickering light. (0.0 - 1.0 values, result of greater values are period time of light off )

References Math::AbsFloat().

◆ SetFlickerAmplitudeMax()

void SetFlickerAmplitudeMax ( float  coef)
inlineprivate

◆ SetFlickerAmplitudeMin()

void SetFlickerAmplitudeMin ( float  coef)
inlineprivate

◆ SetFlickerSpeed()

void SetFlickerSpeed ( float  speed)
inlineprivate

Sets speed of light flickering (random brightness coefficient change per second)

◆ SetLifetime()

void SetLifetime ( float  life_in_s)
inlineprivate

Makes the light destroy itself after the given time in seconds. The light will fade out if it's set to do so with SetFadeOutTime(...)

References GetGame(), and CGame::GetTime().

◆ SetRadiusTo()

void SetRadiusTo ( float  value)
inlineprivate

Sets the radius of the light.

References m_Radius, and SetRadius().

◆ SetSelectionID()

void SetSelectionID ( int  id)
inlineprivate

◆ StopDimming()

void StopDimming ( )
inlineprivate

◆ TryShadowOptimization()

void TryShadowOptimization ( )
inlineprivate

Optimizes shadows by disabling them on this light source while it's within the given radius around the camera.

References vector::Distance(), GetGame(), and GetPosition.

◆ UpdateLightMode()

private void UpdateLightMode ( string  slotName)
private

◆ UpdateLightSourceMaterial()

void UpdateLightSourceMaterial ( string  path)
inlineprivate

References m_Parent, and path.

◆ UpdateMode()

Field Documentation

◆ m_BlinkingSpeed

float m_BlinkingSpeed
private

◆ m_Brightness

float m_Brightness
private

◆ m_BrightnessPulse

float m_BrightnessPulse
private

◆ m_BrightnessPulseAmplitudeMax

float m_BrightnessPulseAmplitudeMax
private

◆ m_BrightnessPulseAmplitudeMin

float m_BrightnessPulseAmplitudeMin
private

◆ m_BrightnessPulseSpeed

float m_BrightnessPulseSpeed
private

◆ m_BrightnessSpeedOfChange

float m_BrightnessSpeedOfChange = 1
private

◆ m_BrightnessTarget

float m_BrightnessTarget
private

◆ m_DancingShadowsAmplitude

float m_DancingShadowsAmplitude
private

◆ m_DancingShadowsLocalPos

vector m_DancingShadowsLocalPos
private

◆ m_DancingShadowsSpeed

float m_DancingShadowsSpeed
private

◆ m_DeleteTimer

ref Timer m_DeleteTimer
private

◆ m_FadeInTime

float m_FadeInTime = -1
private

◆ m_FadeOutTime

float m_FadeOutTime = -1
private

◆ m_HiddenSelectionID

protected int m_HiddenSelectionID
private

◆ m_IsDebugEnabled

bool m_IsDebugEnabled = false
private

◆ m_LifetimeEnd

float m_LifetimeEnd = -1
private

◆ m_LifetimeStart

float m_LifetimeStart
private

◆ m_LightDimming

protected ref LightDimming m_LightDimming
private

◆ m_LocalOri

vector m_LocalOri
private

◆ m_LocalPos

vector m_LocalPos
private

◆ m_NightTimeOnlyLights

ref set<ScriptedLightBase> m_NightTimeOnlyLights = new set<ScriptedLightBase>()
staticprivate

◆ m_OptimizeShadowsRadius

float m_OptimizeShadowsRadius = 0
private

◆ m_Parent

Object m_Parent
private

◆ m_Radius

float m_Radius
private

◆ m_RadiusSpeedOfChange

float m_RadiusSpeedOfChange = 1
private

◆ m_RadiusTarget

float m_RadiusTarget
private

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