Editor.Components.LightSource
ClassComponent controlling light properties, shadows, and environment mapping.
Index
Properties
- autoLightSourcePosition
- autoShadowFrustumSize
- autoShadowFrustumSizeExtend
- color
- diffuseEnvmapTexture
- dynamicEnvInputTexture
- enabled
- envmapExposure
- envmapFromCameraMode
- envmapRotation
- estimationSharpness
- falloffRange
- falloffType
- hasPrefabChanges
- id
- innerConeAngle
- intensity
- isPrefabInstanceRoot
- lightType
- meta
- name
- outerConeAngle
- renderLayer
- sceneObject
- shadowBlurRadius
- shadowColor
- shadowDensity
- shadowFrustumFarClipPlane
- shadowFrustumNearClipPlane
- shadowFrustumSize
- shadowTextureSize
- shadowType
- specularEnvmapTexture
- type
- useEnvmapFromCamera
Methods
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
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
readonlyhasPrefabChanges: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
readonlyid:Uuid
The unique id of the entity.
Inherited from
innerConeAngle
innerConeAngle:
number
Inner cone angle for spot lights in degrees.
intensity
intensity:
number
Brightness multiplier of the light.
isPrefabInstanceRoot
readonlyisPrefabInstanceRoot: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
readonlymeta:Meta
Metadata associated with this entity, providing access to its unique identifier and other descriptive properties.
Inherited from
name
name:
string
Name of the component.
Inherited from
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
sceneObject
readonlysceneObject:SceneObject
Scene object this component is attached to.
Inherited from
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
readonlytype:string
The entity's type.
Inherited from
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()
staticgetMeta():Meta
Returns metadata about this type.
Returns
Overrides
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
Inherited from
RenderLayerOwner.getPrefabInstanceRoot
getTypeName()
staticgetTypeName():string
Returns the type name of this class.
Returns
string
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object is of the specified type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object refers to the same instance as the given object.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean