Enfusion Script API
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
LightEntity Interface Reference

Use LightEntity::CreateLight instead of spawning LightEntity via Game::SpawnEntity for the creation of light in a script. More...

Inheritance diagram for LightEntity:
[legend]

Public Member Functions

proto external void SetEnabled (bool state)
 Set the enabled state of the light.
 
proto external bool IsEnabled ()
 Returns true if the light is enabled.
 
proto external int SetLightFlags (LightFlags flags)
 Set light flags.
 
proto external int ClearLightFlags (LightFlags flags)
 Clear light flags.
 
proto external bool IsLightFlagsSet (LightFlags flags)
 Returns true if the flags is set.
 
proto external bool IsDynamic ()
 Returns true if the light is dynamic, false otherwise.
 
proto external void SetCastShadow (bool enable)
 
proto external bool IsCastShadow ()
 Returns true if the light is casting shadows.
 
proto external void SetColor (Color color, float LV)
 Set light's new color.
 
proto external void SetRadius (float radius)
 Set light's new radius.
 
proto external float GetRadius ()
 Returns the current radius of the light in meters.
 
proto external void SetIntensityEVClip (float clipEV)
 Sets light intensity clip in EV.
 
proto external void SetConeAngle (float angle)
 Sets light cone angle in degrees (useful for LightType.SPOT only)
 
proto external void SetDistanceAtt (float att)
 Set light distance attenuation -> power function, default is 2 corresponding to light without any other internal reflector.
 
proto external void SetConeAngleAttenuation (float coneAngleAttenuation)
 Sets light cone angle attenuation (SPOT)
 
proto external float GetConeAngle ()
 Returns the current cone angle in degrees (useful for LightType.SPOT only)
 
proto external void SetTexture (ResourceName textureName)
 Sets color-lookup texture, light color with LV is multiplied by the texture point lights -> texture must be cube map spot lights, 2D texture -> the texture serves as projector texture spot light, 1D texture of <someWidth, 1> size -> texture serves is angle lookup texture (parametrized by cos^2 angle from spot direction and pixel world pos, IES profile, but not supported fully now as we don't have IES converter)
 
proto external void SetNearPlane (float nearPlane)
 Sets near plane of a light.
 
proto external float GetNearPlane ()
 Returns the current near plane of the light in meters.
 
proto external void SetVolumeEffect (float intensity, float offset, float scale)
 Sets light volumetric effect.
 
proto external void SetLensFlareType (LightLensFlareType type)
 Sets lens flare type of a light.
 
proto external void SetLensFlareIndex (int index)
 Sets lens flare index of a light.
 
proto external void SetLensFlareScale (float scale)
 Sets lens flare scale for a light.
 
proto external void SetLensFlareOffset (vector offset)
 Sets lens flare offset for a light.
 
proto external void SetLightDirection (vector direction)
 Sets direction of light.
 
- Public Member Functions inherited from GenericEntity
proto external void Activate ()
 Activate entity events.
 
proto external void Deactivate ()
 Deactivate entity events.
 
proto external void Show (bool show)
 
proto void Rpc (func method, void p0=NULL, void p1=NULL, void p2=NULL, void p3=NULL, void p4=NULL, void p5=NULL, void p6=NULL, void p7=NULL)
 Attempts to run a remote procedure call (RPC) of this instance with parameters specified in method RplRpc attribute.
 
proto external WorldEditorAPI _WB_GetEditorAPI ()
 This returns world editor API, which is safe to use from editor events bellow.
 
proto external void OnTransformReset (bool isCorrection=false, vector newVelocity=vector.Zero)
 Notifies the entity that its transformation has been discontinuously changed.
 
IEntity _WB_GetEditableOwner ()
 Editor needs to know if there is any entity which manages this one and is editable.
 
void _WB_MakeVisible (IEntitySource src, bool visible)
 Editor needs to have entity visible or not. Do not call editor API here!
 
void _WB_SetTransform (inout vector mat[4], IEntitySource src)
 Editor changed transformation matrix source. This is the place to apply it on entity. Do not call editor API here!
 
void _WB_OnInit (inout vector mat[4], IEntitySource src)
 Called always after entity creation. It's purpose is to prepare entity for editing. Do not edit anything through editor API here because it's too early for undoable actions! Use plain BaseContainer API for changes through src parameter if needed!
 
bool _WB_CanDelete (IEntitySource src)
 Editor needs to know if this entity can to be deleted. Do not call editor API here!
 
bool _WB_CanRename (IEntitySource src)
 Editor needs to know if this entity can to be renamed. Do not call editor API here!
 
bool _WB_CanCopy (IEntitySource src)
 Editor needs to know if this entity can be copied. Do not call editor API here!
 
bool _WB_CanSelect (IEntitySource src)
 Editor needs to know whether this entity can be selected in scene window or not.
 
int _WB_GetAnchorCount (IEntitySource src)
 Returns how many anchor points does this entity have at this time.
 
void _WB_GetAnchor (inout vector position, IEntitySource src, int index)
 Fills position of anchor at index index to anchorPosition
 
void _WB_OnAnchorSnapped (IEntitySource thisSrc, int thisAnchor, IEntitySource otherSrc, int otherAnchor, bool isReceiver)
 Called when two entities are snapped together.
 
bool _WB_CanAnchorSnap (IEntitySource thisSrc, int thisAnchor, IEntitySource otherSrc, int otherAnchor, bool isReceiver)
 
void _WB_GetBoundBox (inout vector min, inout vector max, IEntitySource src)
 Editor needs to know a bound box of entity (For ray-casting, visualizers etc.). You can return any custom size you need. Do not call editor API here!
 
bool _WB_ShouldShowBoundBox (IEntitySource src)
 Returns true if bound box should be visible when entity is hovered/selected in WB.
 
void _WB_SetExtraVisualiser (EntityVisualizerType type, IEntitySource src)
 If entity needs to have a special visualizer instead of default one, here is the place where you can implement it. Do not call editor API here!
 
array< ref WB_UIMenuItem_WB_GetContextMenuItems ()
 An opportunity to append items into editor's "Entity" context menu. Do not call editor API here!
 
bool _WB_OnPhysSimulPlacementBegin (IEntitySource src)
 Does this entity support editing transformation using physics simulation? Do not call editor API here!
 
bool _WB_EnablePhysics (IEntitySource src, bool physics)
 Prepare to edit transformation using physics simulation. Return previous status. Do not call editor API here!
 
array< ref ParamEnum_WB_GetUserEnums (string varName, IEntitySource src)
 Possibility to get variable value choices dynamically. Do not call editor API here!
 
bool _WB_OnKeyChanged (BaseContainer src, string key, BaseContainerList ownerContainers, IEntity parent)
 Any property value has been changed. You can use editor API here and do some additional edit actions which will be part of the same "key changed" action.
 
void _WB_AfterWorldUpdate (float timeSlice)
 Called after updating world in Workbench. The entity must be visible in frustum, selected or named. You can use editor API here and do some edit actions if needed.
 
void _WB_OnContextMenu (int id)
 User has chosen any of your menu item from editor's "Entity" menu which you have recently provided in WB_GetContextMenuItems(). You can use editor API here and do some edit actions.
 
void _WB_OnKeyDown (int keyCode)
 User pressed a key and this entity is main member of entity selection. You can use editor API here and do some edit actions which will be undoable.
 
void _WB_OnCreate (IEntitySource src)
 Called after entity gets created in map during editing or when deleted entity gets restored after undo action. This event isn't called by loading map!!! If you need an event that is being called after every entity creation then use WB_OnInit instead it. You can use editor API here and do some additional edit actions which will be part of the same "create entity" action.
 
void _WB_OnParentChange (IEntitySource src, IEntitySource prevParentSrc)
 Parent entity has been changed ( it's available through src->GetParent() ). prevParentSrc is a pointer to a previous parent (if any)
 
void _WB_OnDelete (IEntitySource src)
 This entity is going to be deleted. You can use editor API here and do some additional edit actions which will be part of the same "entity delete" action.
 
void _WB_OnRename (IEntitySource src, string oldName)
 This entity has been renamed. You can use editor API here and do some additional edit actions which will be part of the same "entity rename" action.
 
- Public Member Functions inherited from IEntity
proto external EntityID GetID ()
 Return unique entity ID.
 
proto external IEntity GetParent ()
 Returns parent of this entity (entity on upper level of hierarchy).
 
proto external IEntity GetRootParent ()
 Returns top-parent of this entity.
 
proto external IEntity GetChildren ()
 Returns first child from this level of hierarchy if there is any.
 
proto external IEntity GetSibling ()
 Returns next sibling of this entity (next entity on this level of hierarchy).
 
proto external VObject GetVObject ()
 Returns visual object set to this Entity. No reference is added.
 
proto external EntityPrefabData GetPrefabData ()
 
proto external EntityComponentPrefabData FindComponentData (TypeName typeName)
 
proto external BaseWorld GetWorld ()
 
proto external void SetFixedLOD (int lod)
 Set fixed LOD. Use -1 for non-fixed LOD.
 
proto external void GetTransform (out vector mat[])
 Returns world transformation of Entity.
 
proto external void GetWorldTransform (out vector mat[])
 See IEntity::GetTransform.
 
proto external void GetLocalTransform (out vector mat[])
 See IEntity::GetTransform.
 
proto external vector VectorToParent (vector vec)
 Transforms local vector to parent(world) space.
 
proto external vector CoordToParent (vector coord)
 Transforms local position to parent(world) space.
 
proto external vector VectorToLocal (vector vec)
 Transforms world space vector to local space.
 
proto external vector CoordToLocal (vector coord)
 Transforms world space position to local space.
 
proto external vector GetYawPitchRoll ()
 Returns orientation of Entity in world space (Yaw, Pitch, Roll).
 
proto external void SetYawPitchRoll (vector angles)
 Sets angles for entity (Yaw, Pitch, Roll).
 
proto external vector GetWorldTransformAxis (int axis)
 See IEntity::GetTransformAxis.
 
proto external vector GetTransformAxis (int axis)
 See IEntity::GetTransformAxis.
 
proto external vector GetLocalTransformAxis (int axis)
 See IEntity::GetTransformAxis.
 
proto external bool SetLocalTransform (vector mat[4])
 See IEntity::SetTransform. Returns false, if there is no change in transformation.
 
proto external bool SetWorldTransform (vector mat[4])
 See IEntity::SetTransform. Returns false, if there is no change in transformation.
 
proto external TNodeId GetPivot ()
 Returns pivot ID from hierarchy component.
 
proto external bool SetTransform (vector mat[4])
 Sets entity world transformation.
 
proto external vector GetLocalAngles ()
 Same as GetLocalYawPitchRoll(), but returns rotation vector around X, Y and Z axis.
 
proto external vector GetLocalYawPitchRoll ()
 Returns local orientation when it's in hierarchy (Yaw, Pitch, Roll).
 
proto external vector GetAngles ()
 Same as GetYawPitchRoll(), but returns rotation vector around X, Y and Z axis.
 
proto external void SetAngles (vector angles)
 Same as SetYawPitchRoll(), but sets rotation around X, Y and Z axis.
 
proto external vector GetOrigin ()
 Returns origin of Entity.
 
proto external void SetOrigin (vector orig)
 Sets origin for entity.
 
proto external void SetScale (float scale)
 
proto external float GetScale ()
 
proto external void GetBounds (out vector mins, out vector maxs)
 Returns local bounding box of model on Entity.
 
proto external void GetWorldBounds (out vector mins, out vector maxs)
 Returns quantized world-bound-box of Entity.
 
proto external volatile void SendEvent (notnull IEntity actor, EntityEvent e, void extra)
 Dynamic event invocation. Parameters are the same as in IEntity::EOnXXXX() methods.
 
proto external string GetName ()
 
proto external int SetVComponentFlags (VCFlags flags)
 Sets component flags.
 
proto external void SetObject (VObject object, string options)
 Sets the visual object to this entity.
 
proto external EntityFlags SetFlags (EntityFlags flags, bool recursively=false)
 Sets Entity flags.
 
proto external EntityFlags ClearFlags (EntityFlags flags, bool recursively=false)
 Clear Entity flags.
 
proto external EntityFlags GetFlags ()
 Returns Entity flags.
 
proto external EntityEvent SetEventMask (EntityEvent e)
 Sets event mask.
 
proto external EntityEvent ClearEventMask (EntityEvent e)
 Clears event mask.
 
proto external EntityEvent GetEventMask ()
 Returns current event mask.
 
proto external bool IsLoaded ()
 
proto external bool IsRemoved ()
 
proto external bool IsDeleted ()
 
proto external int Update ()
 Updates entity state/position.
 
proto external int AddChild (notnull IEntity child, TNodeId pivot, EAddChildFlags flags=EAddChildFlags.AUTO_TRANSFORM)
 Add Entity to hierarchy. Pivot is pivot index, or -1 for center of parent.
 
proto external void RemoveChild (notnull IEntity child, bool keepTransform=false)
 Remove Entity from hierarchy.
 
proto external void SetName (string name)
 
proto external int SetCameraMask (int mask)
 Sets visibility mask for cameras, where Entity will be rendered.
 
proto external Physics GetPhysics ()
 
proto external Particles GetParticles ()
 
proto external Animation GetAnimation ()
 
proto external int Animate (float speed, int loop)
 Updates animation (either xob, or particle, whatever).
 
proto external int AnimateEx (float speed, int loop, out vector lin, out vector ang)
 Updates animation (either xob, or particle, whatever).
 
proto external void SetBone (TNodeId bone, vector angles, vector trans, float scale)
 
proto external bool SetBoneMatrix (TNodeId bone, vector mat[4])
 
proto external bool GetBoneMatrix (TNodeId bone, out vector mat[4])
 
proto external TNodeId GetBoneIndex (string boneName)
 
proto external void GetBoneNames (out notnull array< string > boneNames)
 
proto external bool GetBoneLocalMatrix (TNodeId bone, out vector mat[4])
 
proto external Managed FindComponent (TypeName typeName)
 Finds first occurance of the coresponding component.
 
proto external int FindComponents (TypeName typeName, notnull array< Managed > outComponents)
 Finds all occurances of the coresponding component.
 
- Public Member Functions inherited from Managed
proto external ref Managed Clone ()
 Return shallow copy of object, or null if it is not allowed (not public constructor)
 

Static Public Member Functions

static proto LightEntity CreateLight (LightType type, LightFlags flags, float radius, Color color, float LV, vector position, vector direction=vector.Forward)
 Create new static light by type.
 
- Static Public Member Functions inherited from GenericEntity
static bool Preload (IEntitySource src)
 
static proto void GetMatrixFromSource (BaseWorld world, IEntitySource src, bool withScale, out vector mat[4])
 

Additional Inherited Members

- Protected Member Functions inherited from GenericEntity
bool RplLoad (ScriptBitReader reader)
 Called when Item is initialized from replication stream.
 
bool RplSave (ScriptBitWriter writer)
 Called when Item is getting replicated from Master to Slave connection.
 
proto external void ConnectToDiagSystem ()
 
proto external void DisconnectFromDiagSystem ()
 
void EOnDiag (IEntity owner, float timeSlice)
 
void EOnActivate (IEntity owner)
 Event when entity is activated.
 
void EOnDeactivate (IEntity owner)
 Event when entity is deactivated.
 
void OnTransformResetImpl (TransformResetParams params)
 Script-side implementation of OnTransformReset.
 
- Protected Member Functions inherited from IEntity
void EOnTouch (IEntity owner, IEntity other, int touchTypesMask)
 Event when touched by other entity.
 
void EOnInit (IEntity owner)
 Event after entity is allocated and initialized.
 
void EOnVisible (IEntity owner, int frameNumber)
 Event when we are visible.
 
void EOnFrame (IEntity owner, float timeSlice)
 Event every frame.
 
void EOnPostFrame (IEntity owner, float timeSlice)
 Event after physics update.
 
void EOnAnimEvent (IEntity owner, int type, int slot)
 Event from animation system.
 
void EOnSimulate (IEntity owner, float timeSlice)
 Event before every physics fixed step (can be multiple calls per engine update)
 
void EOnPostSimulate (IEntity owner, float timeSlice)
 Event after every physics fixed step (can be multiple calls per engine update)
 
void EOnJointBreak (IEntity owner, IEntity other)
 Event when joint attached to RigidBody of this entity is broken.
 
void EOnPhysicsMove (IEntity owner)
 Event when physics engine has moved with this Entity.
 
void EOnContact (IEntity owner, IEntity other, Contact contact)
 Event when physics engine registered contact with other RigidBody.
 
void EOnPhysicsActive (IEntity owner, bool activeState)
 Event when a RigidBody active state is changed between consecutive fixed steps.
 
void EOnFixedFrame (IEntity owner, float timeSlice)
 Event every fixed frame.
 
void EOnFixedPostFrame (IEntity owner, float timeSlice)
 Event after physics update every fixed frame.
 
void EOnUser0 (IEntity other, int extra)
 EntityEvent.EV_USER+0.
 
void EOnUser1 (IEntity other, int extra)
 EntityEvent.EV_USER+1.
 
void EOnUser2 (IEntity other, int extra)
 EntityEvent.EV_USER+2.
 
void EOnUser3 (IEntity other, int extra)
 EntityEvent.EV_USER+3.
 
void EOnUser4 (IEntity other, int extra)
 EntityEvent.EV_USER+4.
 
void IEntity (IEntitySource src, IEntity parent)
 protected script Constructor
 

Detailed Description

Use LightEntity::CreateLight instead of spawning LightEntity via Game::SpawnEntity for the creation of light in a script.

If you spawn this entity with a prefab, all parameters sets will be automatically applied. This should be used over LightHandle unless you want a low-level API.

Member Function Documentation

◆ ClearLightFlags()

proto external int LightEntity.ClearLightFlags ( LightFlags  flags)

Clear light flags.

Parameters
flagsflags to be cleared
Returns
currently set flags

◆ CreateLight()

static proto LightEntity LightEntity.CreateLight ( LightType  type,
LightFlags  flags,
float  radius,
Color  color,
float  LV,
vector  position,
vector  direction = vector.Forward 
)
static

Create new static light by type.

Parameters
typeType of light
flagsCreation flags.
radiusRadius
colorColor in RGB form
LVLV value of a light, final light color is combined from color and LV properties (color * LV^2)
positionPosition of the entity in world coordinates
directionDirection of spot-vector (used for spotlights)
Returns
LightEntity

◆ GetConeAngle()

proto external float LightEntity.GetConeAngle ( )

Returns the current cone angle in degrees (useful for LightType.SPOT only)

◆ GetNearPlane()

proto external float LightEntity.GetNearPlane ( )

Returns the current near plane of the light in meters.

◆ GetRadius()

proto external float LightEntity.GetRadius ( )

Returns the current radius of the light in meters.

◆ IsCastShadow()

proto external bool LightEntity.IsCastShadow ( )

Returns true if the light is casting shadows.

◆ IsDynamic()

proto external bool LightEntity.IsDynamic ( )

Returns true if the light is dynamic, false otherwise.

◆ IsEnabled()

proto external bool LightEntity.IsEnabled ( )

Returns true if the light is enabled.

◆ IsLightFlagsSet()

proto external bool LightEntity.IsLightFlagsSet ( LightFlags  flags)

Returns true if the flags is set.

◆ SetCastShadow()

proto external void LightEntity.SetCastShadow ( bool  enable)

◆ SetColor()

proto external void LightEntity.SetColor ( Color  color,
float  LV 
)

Set light's new color.

Parameters
colorcolor of a light
LVLV value of a light, final light color is combined from color and LV properties (color * LV^2)

◆ SetConeAngle()

proto external void LightEntity.SetConeAngle ( float  angle)

Sets light cone angle in degrees (useful for LightType.SPOT only)

◆ SetConeAngleAttenuation()

proto external void LightEntity.SetConeAngleAttenuation ( float  coneAngleAttenuation)

Sets light cone angle attenuation (SPOT)

Parameters
coneAngleAttenuation<0..1> value, where 0 = full angle attenuation, 1 = no angle attenuation

◆ SetDistanceAtt()

proto external void LightEntity.SetDistanceAtt ( float  att)

Set light distance attenuation -> power function, default is 2 corresponding to light without any other internal reflector.

Parameters
attattenuation

◆ SetEnabled()

proto external void LightEntity.SetEnabled ( bool  state)

Set the enabled state of the light.

Parameters
stateEnable state.

◆ SetIntensityEVClip()

proto external void LightEntity.SetIntensityEVClip ( float  clipEV)

Sets light intensity clip in EV.

Lights is clipped when its intensity is low but this could be too early for some lights. This value is bias to move the intensity clip test. The value is in EV thus 1 unit means double of light

Parameters
clipEVNegative values make the test less strict, useful e.g. for lights with low intensities lying near geometry

◆ SetLensFlareIndex()

proto external void LightEntity.SetLensFlareIndex ( int  index)

Sets lens flare index of a light.

Use value < 0 to disable lens flare

Parameters
indexIndex of the lens flare in the world lens flare config

◆ SetLensFlareOffset()

proto external void LightEntity.SetLensFlareOffset ( vector  offset)

Sets lens flare offset for a light.

Parameters
offsetOffset from the light original position vector(offset, offsetUp, offsetSide)

◆ SetLensFlareScale()

proto external void LightEntity.SetLensFlareScale ( float  scale)

Sets lens flare scale for a light.

Parameters
scaleScale of the lens flare

◆ SetLensFlareType()

proto external void LightEntity.SetLensFlareType ( LightLensFlareType  type)

Sets lens flare type of a light.

Parameters
typeLens flare type (Automatic = lens flare is determined by light type, Manual = use index, Disabled = lens flare disabled)

◆ SetLightDirection()

proto external void LightEntity.SetLightDirection ( vector  direction)

Sets direction of light.

It's meaningful for LT_SPOT/LT_DIRECTIONAL only!

Parameters
directionDirection of light

◆ SetLightFlags()

proto external int LightEntity.SetLightFlags ( LightFlags  flags)

Set light flags.

Warning
If you want to convert a static light to dynamic light, you need to delete the current static light and spawn a new light with the dynamic flag set.
Parameters
flagsnew flags combined internally with older flags
Returns
currently set flags

◆ SetNearPlane()

proto external void LightEntity.SetNearPlane ( float  nearPlane)

Sets near plane of a light.

It's meaningful for shadow casting LT_SPOT/LT_POINT lights only!

Parameters
nearPlanenear plane when casting shadows in meters

◆ SetRadius()

proto external void LightEntity.SetRadius ( float  radius)

Set light's new radius.

Parameters
radiuslight radius in meters

◆ SetTexture()

proto external void LightEntity.SetTexture ( ResourceName  textureName)

Sets color-lookup texture, light color with LV is multiplied by the texture point lights -> texture must be cube map spot lights, 2D texture -> the texture serves as projector texture spot light, 1D texture of <someWidth, 1> size -> texture serves is angle lookup texture (parametrized by cos^2 angle from spot direction and pixel world pos, IES profile, but not supported fully now as we don't have IES converter)

Parameters
textureNameName of texture

◆ SetVolumeEffect()

proto external void LightEntity.SetVolumeEffect ( float  intensity,
float  offset,
float  scale 
)

Sets light volumetric effect.

Parameters
intensityvol light intensity
offsetsigned offset of light volume effect according base light
scalescale of light (mainly for optimization)

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