瀏覽代碼

Hemispheric light documentation update

sebastien 7 年之前
父節點
當前提交
87dd1a0223
共有 2 個文件被更改,包括 33 次插入6 次删除
  1. 2 1
      src/Lights/babylon.directionalLight.ts
  2. 31 5
      src/Lights/babylon.hemisphericLight.ts

+ 2 - 1
src/Lights/babylon.directionalLight.ts

@@ -73,6 +73,7 @@
 
         /**
          * Returns the string "DirectionalLight".
+         * @return The class name
          */
         public getClassName(): string {
             return "DirectionalLight";
@@ -80,6 +81,7 @@
 
         /**
          * Returns the integer 1.
+         * @return The light Type id as a constant defines in Light.LIGHTTYPEID_x
          */
         public getTypeID(): number {
             return Light.LIGHTTYPEID_DIRECTIONALLIGHT;
@@ -178,7 +180,6 @@
 
         /**
          * Sets the passed Effect object with the DirectionalLight transformed position (or position if not parented) and the passed name.  
-         * Returns the DirectionalLight.
          * @param effect The effect to update
          * @param lightIndex The index of the light in the effect to update
          * @returns The directional light

+ 31 - 5
src/Lights/babylon.hemisphericLight.ts

@@ -1,8 +1,19 @@
 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 {
+        /**
+         * 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()
         public groundColor = new Color3(0.0, 0.0, 0.0);
 
+        /**
+         * The light reflection direction, not the incoming direction.
+         */
         @serializeAsVector3()
         public direction: Vector3
 
@@ -30,27 +41,37 @@
         }
 
         /**
-         * Returns the string "HemisphericLight".  
+         * Returns the string "HemisphericLight".
+         * @return The class name
          */
         public getClassName(): string {
             return "HemisphericLight";
-        }          
+        }
+
         /**
          * 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 {
             this.direction = Vector3.Normalize(target.subtract(Vector3.Zero()));
             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> {
             return null;
         }
 
         /**
          * 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 {
             var normalizeDirection = Vector3.Normalize(this.direction);
@@ -64,14 +85,19 @@
             return this;
         }
 
+        /**
+         * @ignore internal use only.
+         */
         public _getWorldMatrix(): Matrix {
             if (!this._worldMatrix) {
                 this._worldMatrix = Matrix.Identity();
             }
             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 {
             return Light.LIGHTTYPEID_HEMISPHERICLIGHT;