|
@@ -1,8 +1,19 @@
|
|
module BABYLON {
|
|
module BABYLON {
|
|
|
|
+ /**
|
|
|
|
+ * The HemisphericLight simulates the ambient environment light,
|
|
|
|
+ * so the passed direction is the light reflection direction, not the incoming direction.
|
|
|
|
+ */
|
|
export class HemisphericLight extends Light {
|
|
export class HemisphericLight extends Light {
|
|
|
|
+ /**
|
|
|
|
+ * The groundColor is the light in the opposite direction to the one specified during creation.
|
|
|
|
+ * You can think of the diffuse and specular light as coming from the centre of the object in the given direction and the groundColor light in the opposite direction.
|
|
|
|
+ */
|
|
@serializeAsColor3()
|
|
@serializeAsColor3()
|
|
public groundColor = new Color3(0.0, 0.0, 0.0);
|
|
public groundColor = new Color3(0.0, 0.0, 0.0);
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * The light reflection direction, not the incoming direction.
|
|
|
|
+ */
|
|
@serializeAsVector3()
|
|
@serializeAsVector3()
|
|
public direction: Vector3
|
|
public direction: Vector3
|
|
|
|
|
|
@@ -30,27 +41,37 @@
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Returns the string "HemisphericLight".
|
|
|
|
|
|
+ * Returns the string "HemisphericLight".
|
|
|
|
+ * @return The class name
|
|
*/
|
|
*/
|
|
public getClassName(): string {
|
|
public getClassName(): string {
|
|
return "HemisphericLight";
|
|
return "HemisphericLight";
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Sets the HemisphericLight direction towards the passed target (Vector3).
|
|
* Sets the HemisphericLight direction towards the passed target (Vector3).
|
|
- * Returns the updated direction.
|
|
|
|
|
|
+ * Returns the updated direction.
|
|
|
|
+ * @param target The target the direction should point to
|
|
|
|
+ * @return The computed direction
|
|
*/
|
|
*/
|
|
public setDirectionToTarget(target: Vector3): Vector3 {
|
|
public setDirectionToTarget(target: Vector3): Vector3 {
|
|
this.direction = Vector3.Normalize(target.subtract(Vector3.Zero()));
|
|
this.direction = Vector3.Normalize(target.subtract(Vector3.Zero()));
|
|
return this.direction;
|
|
return this.direction;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Returns the shadow generator associated to the light.
|
|
|
|
+ * @returns Always null for hemispheric lights because it does not support shadows.
|
|
|
|
+ */
|
|
public getShadowGenerator(): Nullable<ShadowGenerator> {
|
|
public getShadowGenerator(): Nullable<ShadowGenerator> {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* Sets the passed Effect object with the HemisphericLight normalized direction and color and the passed name (string).
|
|
* Sets the passed Effect object with the HemisphericLight normalized direction and color and the passed name (string).
|
|
- * Returns the HemisphericLight.
|
|
|
|
|
|
+ * @param effect The effect to update
|
|
|
|
+ * @param lightIndex The index of the light in the effect to update
|
|
|
|
+ * @returns The hemispheric light
|
|
*/
|
|
*/
|
|
public transferToEffect(effect: Effect, lightIndex: string): HemisphericLight {
|
|
public transferToEffect(effect: Effect, lightIndex: string): HemisphericLight {
|
|
var normalizeDirection = Vector3.Normalize(this.direction);
|
|
var normalizeDirection = Vector3.Normalize(this.direction);
|
|
@@ -64,14 +85,19 @@
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * @ignore internal use only.
|
|
|
|
+ */
|
|
public _getWorldMatrix(): Matrix {
|
|
public _getWorldMatrix(): Matrix {
|
|
if (!this._worldMatrix) {
|
|
if (!this._worldMatrix) {
|
|
this._worldMatrix = Matrix.Identity();
|
|
this._worldMatrix = Matrix.Identity();
|
|
}
|
|
}
|
|
return this._worldMatrix;
|
|
return this._worldMatrix;
|
|
}
|
|
}
|
|
|
|
+
|
|
/**
|
|
/**
|
|
- * Returns the integer 3.
|
|
|
|
|
|
+ * Returns the integer 3.
|
|
|
|
+ * @return The light Type id as a constant defines in Light.LIGHTTYPEID_x
|
|
*/
|
|
*/
|
|
public getTypeID(): number {
|
|
public getTypeID(): number {
|
|
return Light.LIGHTTYPEID_HEMISPHERICLIGHT;
|
|
return Light.LIGHTTYPEID_HEMISPHERICLIGHT;
|