Skip to main content

Editor.Components.LightSource

Class

Component controlling light properties, shadows, and environment mapping.

Index

Example

const model = this.pluginSystem.findInterface(Editor.Model.IModel) as Editor.Model.IModel;
const scene = model.project.scene;

const obj = scene.createSceneObject('SpotLight');
const light = obj.addComponent('LightSource') as Editor.Components.LightSource;

light.lightType = Editor.Components.LightType.Spot;
light.color = new vec4(1.0, 0.9, 0.8, 1.0);
light.intensity = 2.0;
light.innerConeAngle = 15;
light.outerConeAngle = 30;
light.falloffRange = 50;
light.shadowDensity = 0.8;
light.shadowTextureSize = 1024;

console.log(`LightSource: type=Spot, intensity=${light.intensity}, cone=(${light.innerConeAngle}, ${light.outerConeAngle})`);
console.log(` shadow: density=${light.shadowDensity}, texSize=${light.shadowTextureSize}`);

Extends

Properties

autoLightSourcePosition

autoLightSourcePosition: boolean

Whether light position is adjusted automatically.


autoShadowFrustumSize

autoShadowFrustumSize: boolean

Whether shadow frustum size is calculated automatically.


autoShadowFrustumSizeExtend

autoShadowFrustumSizeExtend: number

Scale factor for automatic shadow frustum size.


color

color: vec4

Light color as an RGBA vector.


diffuseEnvmapTexture

diffuseEnvmapTexture: Texture

Texture for diffuse environment mapping.


dynamicEnvInputTexture

dynamicEnvInputTexture: Texture

Input texture for dynamic environment mapping.


enabled

enabled: boolean

Whether the component is active.

Inherited from

RenderLayerOwner.enabled


envmapExposure

envmapExposure: number

Brightness multiplier for the environment map.


envmapFromCameraMode

envmapFromCameraMode: EnvmapFromCameraMode

Mode for deriving the environment map from the camera.


envmapRotation

envmapRotation: number

Rotation angle of the environment map in degrees.


estimationSharpness

estimationSharpness: number

Sharpness parameter for light estimation.


falloffRange

falloffRange: number

Distance over which light intensity decreases.


falloffType

falloffType: FalloffType

Curve used for light intensity falloff.


hasPrefabChanges

readonly hasPrefabChanges: boolean

Whether this entity differs from its counterpart in the prefab or was added to the prefab instance. Always false outside prefab instances.

Inherited from

RenderLayerOwner.hasPrefabChanges


id

readonly id: Uuid

The unique id of the entity.

Inherited from

RenderLayerOwner.id


innerConeAngle

innerConeAngle: number

Inner cone angle for spot lights in degrees.


intensity

intensity: number

Brightness multiplier of the light.


isPrefabInstanceRoot

readonly isPrefabInstanceRoot: boolean

Whether this entity is the root of a prefab instance.

Inherited from

RenderLayerOwner.isPrefabInstanceRoot


lightType

lightType: LightType

Type of light source (point, directional, spot, etc.).


meta

readonly meta: Meta

Metadata associated with this entity, providing access to its unique identifier and other descriptive properties.

Inherited from

RenderLayerOwner.meta


name

name: string

Name of the component.

Inherited from

RenderLayerOwner.name


outerConeAngle

outerConeAngle: number

Outer cone angle for spot lights in degrees.


renderLayer

renderLayer: LayerSet

The set of render layers this component belongs to.

Inherited from

RenderLayerOwner.renderLayer


sceneObject

readonly sceneObject: SceneObject

Scene object this component is attached to.

Inherited from

RenderLayerOwner.sceneObject


shadowBlurRadius

shadowBlurRadius: number

Blur amount applied to shadow edges.


shadowColor

shadowColor: vec4

Shadow tint as an RGBA vector.


shadowDensity

shadowDensity: number

Shadow opacity multiplier.


shadowFrustumFarClipPlane

shadowFrustumFarClipPlane: number

Far clip distance for shadow projection.


shadowFrustumNearClipPlane

shadowFrustumNearClipPlane: number

Near clip distance for shadow projection.


shadowFrustumSize

shadowFrustumSize: number

Size of the shadow projection volume.


shadowTextureSize

shadowTextureSize: number

Resolution of the shadow map texture.


shadowType

shadowType: ShadowType

Shadow rendering method (none, hard, or soft).


specularEnvmapTexture

specularEnvmapTexture: Texture

Texture for specular environment mapping.


type

readonly type: string

The entity's type.

Inherited from

RenderLayerOwner.type


useEnvmapFromCamera

useEnvmapFromCamera: boolean

Whether environment map is derived from the camera.

Methods

getDirectlyReferencedEntities()

getDirectlyReferencedEntities(): Entity[]

A list of entities which this entity has a reference to.

Returns

Entity[]

Inherited from

RenderLayerOwner.getDirectlyReferencedEntities


getMeta()

static getMeta(): Meta

Returns metadata about this type.

Returns

Meta

Overrides

RenderLayerOwner.getMeta


getOwnedEntities()

getOwnedEntities(): Entity[]

A list of entities which has a reference to this entity.

Returns

Entity[]

Inherited from

RenderLayerOwner.getOwnedEntities


getPrefabInstanceRoot()

getPrefabInstanceRoot(): Prefabable

Returns the nearest prefab instance root that contains this entity, starting with the entity itself, or null if it is not part of a prefab instance.

Returns

Prefabable

Inherited from

RenderLayerOwner.getPrefabInstanceRoot


getTypeName()

static getTypeName(): string

Returns the type name of this class.

Returns

string

Overrides

RenderLayerOwner.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

RenderLayerOwner.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object is of the specified type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

RenderLayerOwner.isOfType


isSame()

isSame(other): boolean

Returns true if this object refers to the same instance as the given object.

Parameters

ParameterType
otherScriptObject

Returns

boolean

Inherited from

RenderLayerOwner.isSame