Ver código fonte

More code comments

David Catuhe 7 anos atrás
pai
commit
ebf6b00762

Diferenças do arquivo suprimidas por serem muito extensas
+ 6739 - 6627
dist/preview release/babylon.d.ts


+ 0 - 371
dist/preview release/typedocValidationBaseline.json

@@ -1612,377 +1612,6 @@
         }
       }
     },
-    "SerializationHelper": {
-      "Class": {
-        "Comments": {
-          "MissingText": true
-        }
-      },
-      "Method": {
-        "Clone": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "creationFunction": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "source": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "Instanciate": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "creationFunction": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "source": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "Parse": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "creationFunction": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "source": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "scene": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "rootUrl": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "Serialize": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "entity": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "serializationObject": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        }
-      }
-    },
-    "Sprite": {
-      "Class": {
-        "Comments": {
-          "MissingText": true
-        }
-      },
-      "Constructor": {
-        "new Sprite": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "name": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "manager": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        }
-      },
-      "Property": {
-        "actionManager": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "angle": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "animations": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "cellIndex": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "color": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "disposeWhenFinishedAnimating": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "height": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "invertU": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "invertV": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "isPickable": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "name": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "position": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "size": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "width": {
-          "Comments": {
-            "MissingText": true
-          }
-        }
-      },
-      "Method": {
-        "dispose": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "playAnimation": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "from": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "to": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "loop": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "delay": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "onAnimationEnd": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "stopAnimation": {
-          "Comments": {
-            "MissingText": true
-          }
-        }
-      }
-    },
-    "SpriteManager": {
-      "Class": {
-        "Comments": {
-          "MissingText": true
-        }
-      },
-      "Constructor": {
-        "new SpriteManager": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "name": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "imgUrl": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "capacity": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "cellSize": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "scene": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "epsilon": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "samplingMode": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        }
-      },
-      "Property": {
-        "cellHeight": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "cellWidth": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "fogEnabled": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "isPickable": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "layerMask": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "name": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "onDispose": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "renderingGroupId": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "sprites": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "texture": {
-          "Comments": {
-            "MissingText": true
-          }
-        }
-      },
-      "Method": {
-        "dispose": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "intersects": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "ray": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "camera": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "predicate": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "fastCheck": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "render": {
-          "Comments": {
-            "MissingText": true
-          }
-        }
-      }
-    },
     "StandardRenderingPipeline": {
       "Property": {
         "BloomEnabled": {

+ 42 - 2
src/Sprites/babylon.sprite.ts

@@ -1,17 +1,36 @@
 module BABYLON {
+    /**
+     * Class used to represent a sprite
+     * @see http://doc.babylonjs.com/babylon101/sprites
+     */
     export class Sprite {
+        /** Gets or sets the current world position */
         public position: Vector3;
+        /** Gets or sets the main color */
         public color = new Color4(1.0, 1.0, 1.0, 1.0);
+        /** Gets or sets the width */
         public width = 1.0;
+        /** Gets or sets the height */
         public height = 1.0;
+        /** Gets or sets rotation angle */
         public angle = 0;
+        /** Gets or sets the cell index in the sprite sheet */
         public cellIndex = 0;
+        /** Gets or sets a boolean indicating if UV coordinates should be inverted in U axis */
         public invertU = 0;
+        /** Gets or sets a boolean indicating if UV coordinates should be inverted in B axis */
         public invertV = 0;
+        /** Gets or sets a boolean indicating that this sprite should be disposed after animation ends */
         public disposeWhenFinishedAnimating: boolean;
+        /** Gets the list of attached animations */
         public animations = new Array<Animation>();
+        /** Gets or sets a boolean indicating if the sprite can be picked */
         public isPickable = false;
-        public actionManager: ActionManager;
+
+        /**
+         * Gets or sets the associated action manager
+         */
+        public actionManager: Nullable<ActionManager>;
 
         private _animationStarted = false;
         private _loopAnimation = false;
@@ -27,6 +46,9 @@
          */
         public isVisible = true;
 
+        /**
+         * Gets or sets the sprite size
+         */
         public get size(): number {
             return this.width;
         }
@@ -36,7 +58,15 @@
             this.height = value;
         }
 
-        constructor(public name: string, manager: ISpriteManager) {
+        /**
+         * Creates a new Sprite
+         * @param name defines the name
+         * @param manager defines the manager
+         */
+        constructor(
+                /** defines the name */
+                public name: string, 
+                manager: ISpriteManager) {
             this._manager = manager;
 
             this._manager.sprites.push(this);
@@ -44,6 +74,14 @@
             this.position = Vector3.Zero();
         }
 
+        /**
+         * Starts an animation
+         * @param from defines the initial key
+         * @param to defines the end key
+         * @param loop defines if the animation must loop
+         * @param delay defines the start delay (in ms)
+         * @param onAnimationEnd defines a callback to call when animation ends
+         */
         public playAnimation(from: number, to: number, loop: boolean, delay: number, onAnimationEnd: () => void): void {
             this._fromIndex = from;
             this._toIndex = to;
@@ -59,6 +97,7 @@
             this._onAnimationEnd = onAnimationEnd;
         }
 
+        /** Stops current animation (if any) */
         public stopAnimation(): void {
             this._animationStarted = false;
         }
@@ -89,6 +128,7 @@
             }
         }
 
+        /** Release associated resources */
         public dispose(): void {
             for (var i = 0; i < this._manager.sprites.length; i++) {
                 if (this._manager.sprites[i] == this) {

+ 46 - 1
src/Sprites/babylon.spriteManager.ts

@@ -41,13 +41,24 @@
         render(): void;
     }
 
+    /**
+     * Class used to manage multiple sprites on the same spritesheet
+     * @see http://doc.babylonjs.com/babylon101/sprites
+     */
     export class SpriteManager implements ISpriteManager {
+        /** Gets the list of sprites */
         public sprites = new Array<Sprite>();
+        /** Gets or sets the rendering group id (0 by default) */
         public renderingGroupId = 0;
+        /** Gets or sets camera layer mask */
         public layerMask: number = 0x0FFFFFFF;
+        /** Gets or sets a boolean indicating if the manager must consider scene fog when rendering */
         public fogEnabled = true;
+        /** Gets or sets a boolean indicating if the sprites are pickable */
         public isPickable = false;
+        /** Defines the default width of a cell in the spritesheet */
         public cellWidth: number;
+        /** Defines the default height of a cell in the spritesheet */
         public cellHeight: number;
 
         /**
@@ -56,6 +67,10 @@
         public onDisposeObservable = new Observable<SpriteManager>();
 
         private _onDisposeObserver: Nullable<Observer<SpriteManager>>;
+
+        /**
+         * Callback called when the manager is disposed
+         */
         public set onDispose(callback: () => void) {
             if (this._onDisposeObserver) {
                 this.onDisposeObservable.remove(this._onDisposeObserver);
@@ -76,6 +91,9 @@
         private _effectBase: Effect;
         private _effectFog: Effect;
 
+        /**
+         * Gets or sets the spritesheet texture
+         */
         public get texture(): Texture {
             return this._spriteTexture;
         }
@@ -84,7 +102,20 @@
             this._spriteTexture = value;
         }
 
-        constructor(public name: string, imgUrl: string, capacity: number, cellSize: any, scene: Scene, epsilon: number = 0.01, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE) {
+        /**
+         * Creates a new sprite manager
+         * @param name defines the manager's name
+         * @param imgUrl defines the sprite sheet url
+         * @param capacity defines the maximum allowed number of sprites
+         * @param cellSize defines the size of a sprite cell
+         * @param scene defines the hosting scene
+         * @param epsilon defines the epsilon value to align texture (0.01 by default)
+         * @param samplingMode defines the smapling mode to use with spritesheet
+         */
+        constructor(
+                /** defines the manager's name */
+                public name: string, 
+                imgUrl: string, capacity: number, cellSize: any, scene: Scene, epsilon: number = 0.01, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE) {
             if (!scene._getComponent(SceneComponentConstants.NAME_SPRITE)) {
                 scene._addComponent(new SpriteSceneComponent(scene));
             }
@@ -181,6 +212,14 @@
             this._vertexData[arrayOffset + 15] = sprite.color.a;
         }
 
+        /**
+         * Intersects the sprites with a ray
+         * @param ray defines the ray to intersect with
+         * @param camera defines the current active camera
+         * @param predicate defines a predicate used to select candidate sprites
+         * @param fastCheck defines if a fast check only must be done (the first potential sprite is will be used and not the closer)
+         * @returns null if no hit or a PickingInfo
+         */
         public intersects(ray: Ray, camera:Camera, predicate?: (sprite: Sprite) => boolean, fastCheck?: boolean): Nullable<PickingInfo> {
             var count = Math.min(this._capacity, this.sprites.length);
             var min = Vector3.Zero();
@@ -236,6 +275,9 @@
             return null;
         } 
 
+        /**
+         * Render all child sprites
+         */
         public render(): void {
             // Check
             if (!this._effectBase.isReady() || !this._effectFog.isReady() || !this._spriteTexture || !this._spriteTexture.isReady())
@@ -303,6 +345,9 @@
             engine.setAlphaMode(Engine.ALPHA_DISABLE);
         }
 
+        /**
+         * Release associated resources
+         */
         public dispose(): void {
             if (this._buffer) {
                 this._buffer.dispose();

+ 29 - 0
src/Tools/babylon.decorators.ts

@@ -191,8 +191,17 @@
         return generateSerializableMember(11, sourceName); // camera reference member
     }
 
+    /**
+     * Class used to help serialization objects
+     */
     export class SerializationHelper {
 
+        /**
+         * Static function used to serialized a specific entity
+         * @param entity defines the entity to serialize
+         * @param serializationObject defines the optional target obecjt where serialization data will be stored
+         * @returns a JSON compatible object representing the serialization of the entity
+         */
         public static Serialize<T>(entity: T, serializationObject?: any): any {
             if (!serializationObject) {
                 serializationObject = {};
@@ -257,6 +266,14 @@
             return serializationObject;
         }
 
+        /**
+         * Creates a new entity from a serialization data object
+         * @param creationFunction defines a function used to instanciated the new entity
+         * @param source defines the source serialization data
+         * @param scene defines the hosting scene
+         * @param rootUrl defines the root url for resources
+         * @returns a new entity
+         */
         public static Parse<T>(creationFunction: () => T, source: any, scene: Nullable<Scene>, rootUrl: Nullable<string> = null): T {
             var destination = creationFunction();
 
@@ -329,10 +346,22 @@
             return destination;
         }
 
+        /**
+         * Clones an object
+         * @param creationFunction defines the function used to instanciate the new object
+         * @param source defines the source object
+         * @returns the cloned object
+         */
         public static Clone<T>(creationFunction: () => T, source: T): T {
             return _copySource(creationFunction, source, false);
         }
 
+        /**
+         * Instanciates a new object based on a source one (some data will be shared between both object)
+         * @param creationFunction defines the function used to instanciate the new object
+         * @param source defines the source object
+         * @returns the new object
+         */
         public static Instanciate<T>(creationFunction: () => T, source: T): T {
             return _copySource(creationFunction, source, true);
         }