Viewer
    Preparing search index...

    Interface ILightSceneApi

    The api for a light scene. A light scene is a collection of lights. Therefore multiple light scene can be used to switch between different lighting environments. It can be created by calling the createLightScene method.

    interface ILightSceneApi {
        id: string;
        lights: { [key: string]: ILightApi };
        node: ITreeNode;
        addAmbientLight(
            properties: {
                color?: Color;
                id?: string;
                intensity?: number;
                name?: string;
            },
        ): ILightApi;
        addDirectionalLight(
            properties: {
                castShadow?: boolean;
                color?: Color;
                direction?: vec3;
                id?: string;
                intensity?: number;
                name?: string;
                shadowMapBias?: number;
                shadowMapResolution?: number;
            },
        ): IDirectionalLightApi;
        addHemisphereLight(
            properties: {
                color?: Color;
                groundColor?: Color;
                id?: string;
                intensity?: number;
                name?: string;
            },
        ): IHemisphereLightApi;
        addPointLight(
            properties: {
                color?: Color;
                decay?: number;
                distance?: number;
                id?: string;
                intensity?: number;
                name?: string;
                position?: vec3;
            },
        ): IPointLightApi;
        addSpotLight(
            properties: {
                angle?: number;
                color?: Color;
                decay?: number;
                distance?: number;
                id?: string;
                intensity?: number;
                name?: string;
                penumbra?: number;
                position?: vec3;
                target?: vec3;
            },
        ): ISpotLightApi;
        removeLight(id: string): boolean;
        name?: string;
    }
    Index

    Properties

    id: string

    The id of the light scene.

    lights: { [key: string]: ILightApi }

    The collection of lights in the light scene.

    node: ITreeNode

    The node in which the lights are stored in the [scene tree]ITree.

    name?: string

    The name of the light scene.

    Methods

    • Create an ambient light and add it to the light scene.

      Parameters

      • properties: { color?: Color; id?: string; intensity?: number; name?: string }
        • Optionalcolor?: Color

          The color of the light.

        • Optionalid?: string

          The id of the light.

        • Optionalintensity?: number

          The intensity of the light. (0-Infinity, default: 0.5)

        • Optionalname?: string

          The name of the light.

      Returns ILightApi

    • Create a directional light and add it to the light scene.

      Parameters

      • properties: {
            castShadow?: boolean;
            color?: Color;
            direction?: vec3;
            id?: string;
            intensity?: number;
            name?: string;
            shadowMapBias?: number;
            shadowMapResolution?: number;
        }
        • OptionalcastShadow?: boolean

          Option for the light to cast shadows.

        • Optionalcolor?: Color

          The color of the light.

        • Optionaldirection?: vec3

          The direction of the light.

        • Optionalid?: string

          The id of the light.

        • Optionalintensity?: number

          The intensity of the light. (0-Infinity, default: 0.5)

        • Optionalname?: string

          The name of the light.

        • OptionalshadowMapBias?: number

          The bias of the shadow map. For more info on the shadow bias, see here.

        • OptionalshadowMapResolution?: number

          The resolution of the shadow map. (default: 1024, has to be power of two)

      Returns IDirectionalLightApi

    • Create an hemisphere light and add it to the light scene.

      Parameters

      • properties: {
            color?: Color;
            groundColor?: Color;
            id?: string;
            intensity?: number;
            name?: string;
        }
        • Optionalcolor?: Color

          The color of the light.

        • OptionalgroundColor?: Color

          The ground color of the light.

        • Optionalid?: string

          The id of the light.

        • Optionalintensity?: number

          The intensity of the light. (0-Infinity, default: 0.5)

        • Optionalname?: string

          The name of the light.

      Returns IHemisphereLightApi

    • Create a point light and add it to the light scene.

      Parameters

      • properties: {
            color?: Color;
            decay?: number;
            distance?: number;
            id?: string;
            intensity?: number;
            name?: string;
            position?: vec3;
        }
        • Optionalcolor?: Color

          The color of the light.

        • Optionaldecay?: number

          The decay of the light.

        • Optionaldistance?: number

          The distance of the light.

        • Optionalid?: string

          The id of the light.

        • Optionalintensity?: number

          The intensity of the light. (0-Infinity, default: 0.5)

        • Optionalname?: string

          The name of the light.

        • Optionalposition?: vec3

          The position of the light.

      Returns IPointLightApi

    • Create a point light and add it to the light scene.

      Parameters

      • properties: {
            angle?: number;
            color?: Color;
            decay?: number;
            distance?: number;
            id?: string;
            intensity?: number;
            name?: string;
            penumbra?: number;
            position?: vec3;
            target?: vec3;
        }
        • Optionalangle?: number

          The angle of the light.

        • Optionalcolor?: Color

          The color of the light.

        • Optionaldecay?: number

          The decay of the light.

        • Optionaldistance?: number

          The distance of the light.

        • Optionalid?: string

          The id of the light.

        • Optionalintensity?: number

          The intensity of the light. (0-Infinity, default: 0.5)

        • Optionalname?: string

          The name of the light.

        • Optionalpenumbra?: number

          The penumbra of the light.

        • Optionalposition?: vec3

          The position of the light.

        • Optionaltarget?: vec3

          The target of the light.

      Returns ISpotLightApi

    • Remove a light from the light scene with the specified id.

      Parameters

      • id: string

        The id of the light to remove.

      Returns boolean