@babylonjs/core
Version:
Getting started? Play directly with the Babylon.js API using our [playground](https://playground.babylonjs.com/). It also contains a lot of samples to learn how to use it.
99 lines (98 loc) • 4.57 kB
TypeScript
import type { Scene } from "../scene.js";
import { Matrix, Vector3 } from "../Maths/math.vector.js";
import type { AbstractMesh } from "../Meshes/abstractMesh.js";
import { ShadowLight } from "./shadowLight.js";
import type { Effect } from "../Materials/effect.js";
/**
* A point light is a light defined by an unique point in world space.
* The light is emitted in every direction from this point.
* A good example of a point light is a standard light bulb.
* Documentation: https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction
*/
export declare class PointLight extends ShadowLight {
private _shadowAngle;
/**
* Getter: In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback
* This specifies what angle the shadow will use to be created.
*
* It default to 90 degrees to work nicely with the cube texture generation for point lights shadow maps.
*/
get shadowAngle(): number;
/**
* Setter: In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback
* This specifies what angle the shadow will use to be created.
*
* It default to 90 degrees to work nicely with the cube texture generation for point lights shadow maps.
*/
set shadowAngle(value: number);
/**
* Gets the direction if it has been set.
* In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback
*/
get direction(): Vector3;
/**
* In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback
*/
set direction(value: Vector3);
/**
* Creates a PointLight object from the passed name and position (Vector3) and adds it in the scene.
* A PointLight emits the light in every direction.
* It can cast shadows.
* If the scene camera is already defined and you want to set your PointLight at the camera position, just set it :
* ```javascript
* var pointLight = new PointLight("pl", camera.position, scene);
* ```
* Documentation : https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction
* @param name The light friendly name
* @param position The position of the point light in the scene
* @param scene The scene the lights belongs to
*/
constructor(name: string, position: Vector3, scene?: Scene);
/**
* Returns the string "PointLight"
* @returns the class name
*/
getClassName(): string;
/**
* Returns the integer 0.
* @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x
*/
getTypeID(): number;
/**
* Specifies whether or not the shadowmap should be a cube texture.
* @returns true if the shadowmap needs to be a cube texture.
*/
needCube(): boolean;
/**
* Returns a new Vector3 aligned with the PointLight cube system according to the passed cube face index (integer).
* @param faceIndex The index of the face we are computed the direction to generate shadow
* @returns The set direction in 2d mode otherwise the direction to the cubemap face if needCube() is true
*/
getShadowDirection(faceIndex?: number): Vector3;
/**
* Sets the passed matrix "matrix" as a left-handed perspective projection matrix with the following settings :
* - fov = PI / 2
* - aspect ratio : 1.0
* - z-near and far equal to the active camera minZ and maxZ.
* Returns the PointLight.
* @param matrix
* @param viewMatrix
* @param renderList
*/
protected _setDefaultShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
protected _buildUniformLayout(): void;
/**
* Sets the passed Effect "effect" with the PointLight transformed position (or position, if none) and passed name (string).
* @param effect The effect to update
* @param lightIndex The index of the light in the effect to update
* @returns The point light
*/
transferToEffect(effect: Effect, lightIndex: string): PointLight;
transferToNodeMaterialEffect(effect: Effect, lightDataUniformName: string): this;
/**
* Prepares the list of defines specific to the light type.
* @param defines the list of defines
* @param lightIndex defines the index of the light for the effect
*/
prepareLightSpecificDefines(defines: any, lightIndex: number): void;
}