A directional light is defined by a direction (what a surprise!). The light is emitted from everywhere in the specified direction, and has an infinite range. An example of a directional light is when a distance planet is lit by the apparently parallel lines of light from its sun. Light in a downward direction will light the top of an object. Documentation: https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction

Hierarchy

  • ShadowLight
    • DirectionalLight

Constructors

Properties

Accessors

Methods

Constructors

Properties

animations: BabylonAnimation[]

Gets a list of Animations associated with the node

autoCalcShadowZBounds: boolean

Automatically compute the shadowMinZ and shadowMaxZ for the projection matrix to best fit (including all the casters) on each frame. autoUpdateExtends must be set to true for this to work

autoUpdateExtends: boolean

Automatically compute the projection matrix to best fit (including all the casters) on each frame.

customProjectionMatrixBuilder: ((viewMatrix: Matrix, renderList: AbstractMesh[], result: Matrix) => void)

Type declaration

    • (viewMatrix: Matrix, renderList: AbstractMesh[], result: Matrix): void
    • Callback defining a custom Projection Matrix Builder. This can be used to override the default projection matrix computation.

      Parameters

      • viewMatrix: Matrix
      • renderList: AbstractMesh[]
      • result: Matrix

      Returns void

diffuse: Color3

Diffuse gives the basic color to an object.

falloffType: number

Defines the falloff type for this light. This lets overriding how punctual light are falling off base on range or angle. This can be set to any values in Light.FALLOFF_x.

Note: This is only useful for PBR Materials at the moment. This could be extended if required to other types of materials.

id: string

Gets or sets the id of the node

inspectableCustomProperties: IInspectable[]

List of inspectable custom properties (used by the Inspector)

See

https://doc.babylonjs.com/toolsAndResources/inspector#extensibility

intensity: number

Strength of the light. Note: By default it is define in the framework own unit. Note: In PBR materials the intensityMode can be use to chose what unit the intensity is defined in.

metadata: any

Gets or sets an object used to store user defined information for the node

name: string

Gets or sets the name of the node

onAccessibilityTagChangedObservable: Observable<Nullable<IAccessibilityTag>>
onDisposeObservable: Observable<Node>

An event triggered when the mesh is disposed

onReady: Nullable<((node: Node) => void)>

Callback raised when the node is ready to be used

renderPriority: number

Defines the rendering priority of the lights. It can help in case of fallback or number of lights exceeding the number allowed of the materials.

reservedDataStore: any

For internal use only. Please do not use.

specular: Color3

Specular produces a highlight color on an object. Note: This is not affecting PBR materials.

state: string

Gets or sets a string used to store user defined state for the node

transformedDirection: Vector3

The transformed direction. Direction of the light in world space taking parenting in account.

transformedPosition: Vector3

The transformed position. Position of the light in world space taking parenting in account.

uniqueId: number

Gets or sets the unique id of the node

FALLOFF_DEFAULT: 0 = 0

Falloff Default: light is falling off following the material specification: standard material is using standard falloff whereas pbr material can request special falloff per materials.

FALLOFF_GLTF: 2 = 2

Falloff gltf: light is falling off as described in the gltf moving to PBR document to enhance interoperability with other engines.

FALLOFF_PHYSICAL: 1 = 1

Falloff Physical: light is falling off following the inverse squared distance law.

FALLOFF_STANDARD: 3 = 3

Falloff Standard: light is falling off like in the standard material to enhance interoperability with other materials.

INTENSITYMODE_AUTOMATIC: 0 = 0

Each light type uses the default quantity according to its type: point/spot lights use luminous intensity directional lights use illuminance

INTENSITYMODE_ILLUMINANCE: 3 = 3

lux (lm/m^2)

INTENSITYMODE_LUMINANCE: 4 = 4

nit (cd/m^2)

INTENSITYMODE_LUMINOUSINTENSITY: 2 = 2

candela (lm/sr)

INTENSITYMODE_LUMINOUSPOWER: 1 = 1

lumen (lm)

LIGHTMAP_DEFAULT: 0 = 0

If every light affecting the material is in this lightmapMode, material.lightmapTexture adds or multiplies (depends on material.useLightmapAsShadowmap) after every other light calculations.

LIGHTMAP_SHADOWSONLY: 2 = 2

material.lightmapTexture as only lighting no light calculation from this light only adds dynamic shadows from this light

LIGHTMAP_SPECULAR: 1 = 1

material.lightmapTexture as only diffuse lighting from this light adds only specular lighting from this light adds dynamic shadows

LIGHTTYPEID_DIRECTIONALLIGHT: 1 = 1

Light type const id of the directional light.

LIGHTTYPEID_HEMISPHERICLIGHT: 3 = 3

Light type const id of the hemispheric light.

LIGHTTYPEID_POINTLIGHT: 0 = 0

Light type const id of the point light.

LIGHTTYPEID_SPOTLIGHT: 2 = 2

Light type const id of the spot light.

Accessors

  • get accessibilityTag(): Nullable<IAccessibilityTag>
  • Returns Nullable<IAccessibilityTag>

  • set accessibilityTag(value: Nullable<IAccessibilityTag>): void
  • Gets or sets the accessibility tag to describe the node for accessibility purpose.

    Parameters

    • value: Nullable<IAccessibilityTag>

    Returns void

  • get animationPropertiesOverride(): Nullable<AnimationPropertiesOverride>
  • Gets or sets the animation properties override

    Returns Nullable<AnimationPropertiesOverride>

  • set animationPropertiesOverride(value: Nullable<AnimationPropertiesOverride>): void
  • Parameters

    • value: Nullable<AnimationPropertiesOverride>

    Returns void

  • get direction(): Vector3
  • In 2d mode (needCube being false), gets the direction used to cast the shadow. Also use as the light direction on spot and directional lights.

    Returns Vector3

  • set direction(value: Vector3): void
  • In 2d mode (needCube being false), sets the direction used to cast the shadow. Also use as the light direction on spot and directional lights.

    Parameters

    Returns void

  • get doNotSerialize(): boolean
  • Gets or sets a boolean used to define if the node must be serialized

    Returns boolean

  • set doNotSerialize(value: boolean): void
  • Parameters

    • value: boolean

    Returns void

  • get excludeWithLayerMask(): number
  • Gets the layer id use to find what meshes are not impacted by the light. Inactive if 0

    Returns number

  • set excludeWithLayerMask(value: number): void
  • Sets the layer id use to find what meshes are not impacted by the light. Inactive if 0

    Parameters

    • value: number

    Returns void

  • get excludedMeshes(): AbstractMesh[]
  • Gets the meshes not impacted by this light.

    Returns AbstractMesh[]

  • set excludedMeshes(value: AbstractMesh[]): void
  • Sets the meshes not impacted by this light.

    Parameters

    Returns void

  • get includeOnlyWithLayerMask(): number
  • Gets the layer id use to find what meshes are impacted by the light. Inactive if 0

    Returns number

  • set includeOnlyWithLayerMask(value: number): void
  • Sets the layer id use to find what meshes are impacted by the light. Inactive if 0

    Parameters

    • value: number

    Returns void

  • get includedOnlyMeshes(): AbstractMesh[]
  • Gets the only meshes impacted by this light.

    Returns AbstractMesh[]

  • set includedOnlyMeshes(value: AbstractMesh[]): void
  • Sets the only meshes impacted by this light.

    Parameters

    Returns void

  • get intensityMode(): number
  • Gets the photometric scale used to interpret the intensity. This is only relevant with PBR Materials where the light intensity can be defined in a physical way.

    Returns number

  • set intensityMode(value: number): void
  • Sets the photometric scale used to interpret the intensity. This is only relevant with PBR Materials where the light intensity can be defined in a physical way.

    Parameters

    • value: number

    Returns void

  • get lightmapMode(): number
  • Gets the lightmap mode of this light (should be one of the constants defined by Light.LIGHTMAP_x)

    Returns number

  • set lightmapMode(value: number): void
  • Sets the lightmap mode of this light (should be one of the constants defined by Light.LIGHTMAP_x)

    Parameters

    • value: number

    Returns void

  • get onClonedObservable(): Observable<Node>
  • An event triggered when the node is cloned

    Returns Observable<Node>

  • set onDispose(callback: (() => void)): void
  • Sets a callback that will be raised when the node will be disposed

    Parameters

    • callback: (() => void)
        • (): void
        • Returns void

    Returns void

  • get onEnabledStateChangedObservable(): Observable<boolean>
  • An event triggered when the enabled state of the node changes

    Returns Observable<boolean>

  • get orthoBottom(): number
  • Gets or sets the orthoBottom property used to build the light frustum

    Returns number

  • set orthoBottom(bottom: number): void
  • Parameters

    • bottom: number

    Returns void

  • get orthoLeft(): number
  • Gets or sets the orthoLeft property used to build the light frustum

    Returns number

  • set orthoLeft(left: number): void
  • Parameters

    • left: number

    Returns void

  • get orthoRight(): number
  • Gets or sets the orthoRight property used to build the light frustum

    Returns number

  • set orthoRight(right: number): void
  • Parameters

    • right: number

    Returns void

  • get orthoTop(): number
  • Gets or sets the orthoTop property used to build the light frustum

    Returns number

  • set orthoTop(top: number): void
  • Parameters

    • top: number

    Returns void

  • get position(): Vector3
  • Sets the position the shadow will be casted from. Also use as the light position for both point and spot lights.

    Returns Vector3

  • set position(value: Vector3): void
  • Sets the position the shadow will be casted from. Also use as the light position for both point and spot lights.

    Parameters

    Returns void

  • get radius(): number
  • Gets the light radius used by PBR Materials to simulate soft area lights.

    Returns number

  • set radius(value: number): void
  • sets the light radius used by PBR Materials to simulate soft area lights.

    Parameters

    • value: number

    Returns void

  • get range(): number
  • Defines how far from the source the light is impacting in scene units. Note: Unused in PBR material as the distance light falloff is defined following the inverse squared falloff.

    Returns number

  • set range(value: number): void
  • Defines how far from the source the light is impacting in scene units. Note: Unused in PBR material as the distance light falloff is defined following the inverse squared falloff.

    Parameters

    • value: number

    Returns void

  • get shadowEnabled(): boolean
  • Gets whether or not the shadows are enabled for this light. This can help turning off/on shadow without detaching the current shadow generator.

    Returns boolean

  • set shadowEnabled(value: boolean): void
  • Sets whether or not the shadows are enabled for this light. This can help turning off/on shadow without detaching the current shadow generator.

    Parameters

    • value: boolean

    Returns void

  • get shadowFrustumSize(): number
  • Fix frustum size for the shadow generation. This is disabled if the value is 0.

    Returns number

  • set shadowFrustumSize(value: number): void
  • Specifies a fix frustum size for the shadow generation.

    Parameters

    • value: number

    Returns void

  • get shadowMaxZ(): number
  • Sets the shadow projection clipping maximum z value.

    Returns number

  • set shadowMaxZ(value: number): void
  • Gets the shadow projection clipping maximum z value.

    Parameters

    • value: number

    Returns void

  • get shadowMinZ(): number
  • Gets the shadow projection clipping minimum z value.

    Returns number

  • set shadowMinZ(value: number): void
  • Sets the shadow projection clipping minimum z value.

    Parameters

    • value: number

    Returns void

  • get shadowOrthoScale(): number
  • Gets the shadow projection scale against the optimal computed one. 0.1 by default which means that the projection window is increase by 10% from the optimal size. This does not impact in fixed frustum size (shadowFrustumSize being set)

    Returns number

  • set shadowOrthoScale(value: number): void
  • Sets the shadow projection scale against the optimal computed one. 0.1 by default which means that the projection window is increase by 10% from the optimal size. This does not impact in fixed frustum size (shadowFrustumSize being set)

    Parameters

    • value: number

    Returns void

  • get worldMatrixFromCache(): Matrix
  • Returns directly the latest state of the mesh World matrix. A Matrix is returned.

    Returns Matrix

Methods

  • Binds the lights information from the scene to the effect for the given mesh.

    Parameters

    • lightIndex: number

      Light index

    • scene: Scene

      The scene where the light belongs to

    • effect: Effect

      The effect we are binding the data to

    • useSpecular: boolean

      Defines if specular is supported

    • Optional receiveShadows: boolean

      Defines if the effect (mesh) we bind the light for receives shadows

    Returns void

  • Attach a behavior to the node

    See

    https://doc.babylonjs.com/features/featuresDeepDive/behaviors

    Returns

    the current Node

    Parameters

    • behavior: Behavior<Node>

      defines the behavior to attach

    • Optional attachImmediately: boolean

      defines that the behavior must be attached even if the scene is still loading

    Returns Node

  • Will start the animation sequence

    Returns

    the object created for this animation. If range does not exist, it will return null

    Parameters

    • name: string

      defines the range frames for animation sequence

    • Optional loop: boolean

      defines if the animation should loop (false by default)

    • Optional speedRatio: number

      defines the speed factor in which to run the animation (1 by default)

    • Optional onAnimationEnd: (() => void)

      defines a function to be executed when the animation ended (undefined by default)

        • (): void
        • Returns void

    Returns Nullable<Animatable>

  • Specifies if the light will affect the passed mesh.

    Returns

    true the mesh is affected otherwise, false.

    Parameters

    Returns boolean

  • Returns a new Light object, named "name", from the current one.

    Returns

    the new created light

    Parameters

    • name: string

      The name of the cloned light

    • Optional newParent: Nullable<Node>

      The parent of this light, if it has one

    Returns Nullable<Light>

  • Computes the transformed information (transformedPosition and transformedDirection in World space) of the current light

    Returns

    true if the information has been computed, false if it does not need to (no parenting)

    Returns boolean

  • Computes the world matrix of the node

    Returns

    the world matrix

    Parameters

    • Optional force: boolean

      defines if the cache version should be invalidated forcing the world matrix to be created from scratch

    Returns Matrix

  • Creates an animation range for this node

    Parameters

    • name: string

      defines the name of the range

    • from: number

      defines the starting key

    • to: number

      defines the end key

    Returns void

  • Delete a specific animation range

    Parameters

    • name: string

      defines the name of the range to delete

    • Optional deleteFrames: boolean

      defines if animation frames from the range must be deleted as well

    Returns void

  • Releases resources associated with this node.

    Parameters

    • Optional doNotRecurse: boolean

      Set to true to not recurse into each children (recurse into each children by default)

    • Optional disposeMaterialAndTextures: boolean

      Set to true to also dispose referenced materials and textures (false by default)

    Returns void

  • Forces the shadow generator to recompute the projection matrix even if position and direction did not changed.

    Returns void

  • Returns the ShadowLight absolute position in the World.

    Returns

    the position vector in world space

    Returns Vector3

  • Get an animation by name

    Returns

    null if not found else the requested animation

    Parameters

    • name: string

      defines the name of the animation to look for

    Returns Nullable<BabylonAnimation>

  • Get an animation range by name

    Returns

    null if not found else the requested animation range

    Parameters

    • name: string

      defines the name of the animation range to look for

    Returns Nullable<AnimationRange>

  • Gets the list of all animation ranges defined on this node

    Returns

    an array

    Returns Nullable<AnimationRange>[]

  • Gets an attached behavior by name

    See

    https://doc.babylonjs.com/features/featuresDeepDive/behaviors

    Returns

    null if behavior was not found else the requested behavior

    Parameters

    • name: string

      defines the name of the behavior to look for

    Returns Nullable<Behavior<Node>>

  • Get all child-meshes of this node

    Returns

    an array of AbstractMesh

    Type Parameters

    Parameters

    • Optional directDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: false)

    • Optional predicate: ((node: Node) => node is T)

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

        • (node: Node): node is T
        • Parameters

          Returns node is T

    Returns T[]

  • Get all child-meshes of this node

    Returns

    an array of AbstractMesh

    Parameters

    • Optional directDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: false)

    • Optional predicate: ((node: Node) => boolean)

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

        • (node: Node): boolean
        • Parameters

          Returns boolean

    Returns AbstractMesh[]

  • Get all direct children of this node

    Returns

    an array of Node

    Type Parameters

    Parameters

    • Optional predicate: ((node: Node) => node is T)

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

        • (node: Node): node is T
        • Parameters

          Returns node is T

    • Optional directDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: true)

    Returns T[]

  • Get all direct children of this node

    Returns

    an array of Node

    Parameters

    • Optional predicate: ((node: Node) => boolean)

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

        • (node: Node): boolean
        • Parameters

          Returns boolean

    • Optional directDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: true)

    Returns Node[]

  • Returns the string "DirectionalLight".

    Returns

    The class name

    Returns string

  • Gets the maxZ used for shadow according to both the scene and the light.

    Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5. (when not using reverse depth buffer / NDC half Z range)

    Returns

    the depth max z

    Parameters

    • activeCamera: Camera

      The camera we are returning the max for

    Returns number

  • Gets the minZ used for shadow according to both the scene and the light.

    Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5. (when not using reverse depth buffer / NDC half Z range)

    Returns

    the depth min z

    Parameters

    • activeCamera: Camera

      The camera we are returning the min for

    Returns number

  • Return the depth scale used for the shadow map.

    Returns

    the depth scale.

    Returns number

  • Will return all nodes that have this node as ascendant

    Returns

    all children nodes of all types

    Type Parameters

    Parameters

    • Optional directDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered

    • Optional predicate: ((node: Node) => node is T)

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

        • (node: Node): node is T
        • Parameters

          Returns node is T

    Returns T[]

  • Will return all nodes that have this node as ascendant

    Returns

    all children nodes of all types

    Parameters

    • Optional directDescendantsOnly: boolean

      defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered

    • Optional predicate: ((node: Node) => boolean)

      defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored

        • (node: Node): boolean
        • Parameters

          Returns boolean

    Returns Node[]

  • Gets the engine of the node

    Returns

    a Engine

    Returns Engine

  • Return the minimum and maximum world vectors of the entire hierarchy under current node

    Returns

    the new bounding vectors

    Parameters

    • Optional includeDescendants: boolean

      Include bounding info from descendants as well (true by default)

    • Optional predicate: Nullable<((abstractMesh: AbstractMesh) => boolean)>

      defines a callback function that can be customize to filter what meshes should be included in the list used to compute the bounding vectors

    Returns { max: Vector3; min: Vector3 }

  • Returns the light rotation in euler definition.

    Returns

    the x y z rotation in local space.

    Returns Vector3

  • Returns the intensity scaled by the Photometric Scale according to the light type and intensity mode.

    Returns

    the scaled intensity in intensity mode unit

    Returns number

  • Gets the scene of the node

    Returns

    a scene

    Returns Scene

  • Get the direction to use to render the shadow map. In case of cube texture, the face index can be passed.

    Returns

    The set direction in 2d mode otherwise the direction to the cubemap face if needCube() is true

    Parameters

    • Optional faceIndex: number

      The index of the face we are computed the direction to generate shadow

    Returns Vector3

  • Returns the Light associated shadow generator if any.

    Returns

    the associated shadow generator.

    Parameters

    • Optional camera: Nullable<Camera>

      Camera for which the shadow generator should be retrieved (default: null). If null, retrieves the default shadow generator

    Returns Nullable<IShadowGenerator>

  • Returns all the shadow generators associated to this light

    Returns

    Returns Nullable<Map<Nullable<Camera>, IShadowGenerator>>

  • Returns the integer 1.

    Returns

    The light Type id as a constant defines in Light.LIGHTTYPEID_x

    Returns number

  • Returns the latest update of the World matrix

    Returns

    a Matrix

    Returns Matrix

  • Is this node a descendant of the given node? The function will iterate up the hierarchy until the ancestor was found or no more parents defined

    Returns

    a boolean indicating if this node is a descendant of the given node

    Parameters

    • ancestor: Node

      defines the parent node to inspect

    Returns boolean

  • Gets a boolean indicating if the node has been disposed

    Returns

    true if the node was disposed

    Returns boolean

  • Is this node enabled? If the node has a parent, all ancestors will be checked and false will be returned if any are false (not enabled), otherwise will return true

    Returns

    whether this node (and its parent) is enabled

    Parameters

    • Optional checkAncestors: boolean

      indicates if this method should check the ancestors. The default is to check the ancestors. If set to false, the method will return the value of this node without checking ancestors

    Returns boolean

  • Is this node ready to be used/rendered

    Returns

    true if the node is ready

    Parameters

    • Optional _completeCheck: boolean

      defines if a complete check (including materials and lights) has to be done (false by default)

    Returns boolean

  • Flag the node as dirty (Forcing it to update everything)

    Returns

    this node

    Parameters

    • Optional _property: string

      helps children apply precise "dirtyfication"

    Returns Node

  • Returns whether or not the shadow generation require a cube texture or a 2d texture.

    Returns

    true if a cube texture needs to be use

    Returns boolean

  • Detects if the projection matrix requires to be recomputed this frame.

    Returns

    true if it requires to be recomputed otherwise, false.

    Returns boolean

  • Prepares the list of defines specific to the light type.

    Parameters

    • defines: any

      the list of defines

    • lightIndex: number

      defines the index of the light for the effect

    Returns void

  • Serializes the current light into a Serialization object.

    Returns

    the serialized object.

    Returns any

  • Serialize animation ranges into a JSON compatible object

    Returns

    serialization object

    Returns any

  • Sets the ShadowLight direction toward the passed target.

    Returns

    the updated ShadowLight direction

    Parameters

    • target: Vector3

      The point to target in local space

    Returns Vector3

  • Set the enabled state of this node.

    Parameters

    • value: boolean

      the new enabled state

    Returns void

  • Sets the shadow projection matrix in parameter to the generated projection matrix.

    Returns

    The current light

    Parameters

    • matrix: Matrix

      The matrix to updated with the projection information

    • viewMatrix: Matrix

      The transform matrix of the light

    • renderList: AbstractMesh[]

      The list of mesh to render in the map

    Returns IShadowLight

  • Converts the light information to a readable string for debug purpose.

    Returns

    the human readable light info

    Parameters

    • Optional fullDetails: boolean

      Supports for multiple levels of logging within scene loading

    Returns string

  • Sets the passed Effect "effect" with the Light textures.

    Returns

    The light

    Parameters

    • effect: Effect

      The effect to update

    • lightIndex: string

      The index of the light in the effect to update

    Returns Light

  • Sets the passed Effect object with the DirectionalLight transformed position (or position if not parented) and the passed name.

    Returns

    The directional light

    Parameters

    • effect: Effect

      The effect to update

    • lightIndex: string

      The index of the light in the effect to update

    Returns DirectionalLight

  • Parameters

    • effect: Effect
    • lightDataUniformName: string

    Returns Light

  • Add a new node constructor

    Parameters

    • type: string

      defines the type name of the node to construct

    • constructorFunc: NodeConstructor

      defines the constructor function

    Returns void

  • Returns a node constructor based on type name

    Returns

    the new constructor or null

    Parameters

    • type: string

      defines the type name

    • name: string

      defines the new node name

    • scene: Scene

      defines the hosting scene

    • Optional options: any

      defines optional options to transmit to constructors

    Returns Nullable<(() => Node)>

  • Creates a new typed light from the passed type (integer) : point light = 0, directional light = 1, spot light = 2, hemispheric light = 3. This new light is named "name" and added to the passed scene.

    Returns

    the constructor function

    Parameters

    • type: number

      Type according to the types available in Light.LIGHTTYPEID_x

    • name: string

      The friendly name of the light

    • scene: Scene

      The scene the new light will belong to

    Returns Nullable<(() => Light)>

  • Parses the passed "parsedLight" and returns a new instanced Light from this parsing.

    Returns

    the created light after parsing

    Parameters

    • parsedLight: any

      The JSON representation of the light

    • scene: Scene

      The scene to create the parsed light in

    Returns Nullable<Light>

  • Parse animation range data from a serialization object and store them into a given node

    Parameters

    • node: Node

      defines where to store the animation ranges

    • parsedNode: any

      defines the serialization object to read data from

    • _scene: Scene

      defines the hosting scene

    Returns void

Generated using TypeDoc