Browse Source

Merge pull request #384 from raananw/Documentation

Documentation Node, Scene, ActionManager
David Catuhe 10 years ago
parent
commit
6e53d83064

+ 48 - 0
Babylon/Actions/babylon.actionManager.js

@@ -1,6 +1,17 @@
 var BABYLON;
 (function (BABYLON) {
+    /**
+    * ActionEvent is the event beint sent when an action is triggered.
+    */
     var ActionEvent = (function () {
+        /**
+        * @constructor
+        * @param source The mesh that triggered the action.
+        * @param pointerX the X mouse cursor position at the time of the event
+        * @param pointerY the Y mouse cursor position at the time of the event
+        * @param meshUnderPointer The mesh that is currently pointed at (can be null)
+        * @param sourceEvent the original (browser) event that triggered the ActionEvent
+        */
         function ActionEvent(source, pointerX, pointerY, meshUnderPointer, sourceEvent) {
             this.source = source;
             this.pointerX = pointerX;
@@ -8,11 +19,21 @@
             this.meshUnderPointer = meshUnderPointer;
             this.sourceEvent = sourceEvent;
         }
+        /**
+        * Helper function to auto-create an ActionEvent from a source mesh.
+        * @param source the source mesh that triggered the event
+        * @param evt {Event} The original (browser) event
+        */
         ActionEvent.CreateNew = function (source, evt) {
             var scene = source.getScene();
             return new ActionEvent(source, scene.pointerX, scene.pointerY, scene.meshUnderPointer, evt);
         };
 
+        /**
+        * Helper function to auto-create an ActionEvent from a scene. If triggered by a mesh use ActionEvent.CreateNew
+        * @param scene the scene where the event occurred
+        * @param evt {Event} The original (browser) event
+        */
         ActionEvent.CreateNewFromScene = function (scene, evt) {
             return new ActionEvent(null, scene.pointerX, scene.pointerY, scene.meshUnderPointer, evt);
         };
@@ -20,6 +41,10 @@
     })();
     BABYLON.ActionEvent = ActionEvent;
 
+    /**
+    * Action Manager manages all events to be triggered on a given mesh or the global scene.
+    * A single scene can have many Action Managers to handle predefined actions on specific meshes.
+    */
     var ActionManager = (function () {
         function ActionManager(scene) {
             // Members
@@ -137,6 +162,11 @@
             return this._scene;
         };
 
+        /**
+        * Does this action manager handles actions of any of the given triggers
+        * @param {number[]} triggers - the triggers to be tested
+        * @return {boolean} whether one (or more) of the triggers is handeled
+        */
         ActionManager.prototype.hasSpecificTriggers = function (triggers) {
             for (var index = 0; index < this.actions.length; index++) {
                 var action = this.actions[index];
@@ -150,6 +180,10 @@
         };
 
         Object.defineProperty(ActionManager.prototype, "hasPointerTriggers", {
+            /**
+            * Does this action manager has pointer triggers
+            * @return {boolean} whether or not it has pointer triggers
+            */
             get: function () {
                 for (var index = 0; index < this.actions.length; index++) {
                     var action = this.actions[index];
@@ -166,6 +200,10 @@
         });
 
         Object.defineProperty(ActionManager.prototype, "hasPickTriggers", {
+            /**
+            * Does this action manager has pick triggers
+            * @return {boolean} whether or not it has pick triggers
+            */
             get: function () {
                 for (var index = 0; index < this.actions.length; index++) {
                     var action = this.actions[index];
@@ -181,6 +219,11 @@
             configurable: true
         });
 
+        /**
+        * Registers an action to this action manager
+        * @param {BABYLON.Action} action - the action to be registered
+        * @return {BABYLON.Action} the action amended (prepared) after registration
+        */
         ActionManager.prototype.registerAction = function (action) {
             if (action.trigger === ActionManager.OnEveryFrameTrigger) {
                 if (this.getScene().actionManager !== this) {
@@ -197,6 +240,11 @@
             return action;
         };
 
+        /**
+        * Process a specific trigger
+        * @param {number} trigger - the trigger to process
+        * @param evt {BABYLON.ActionEvent} the event details to be processed
+        */
         ActionManager.prototype.processTrigger = function (trigger, evt) {
             for (var index = 0; index < this.actions.length; index++) {
                 var action = this.actions[index];

+ 49 - 1
Babylon/Actions/babylon.actionManager.ts

@@ -1,20 +1,45 @@
 module BABYLON {
 
+    /**
+     * ActionEvent is the event beint sent when an action is triggered.
+     */
     export class ActionEvent {
+        /**
+         * @constructor
+         * @param source The mesh that triggered the action.
+         * @param pointerX the X mouse cursor position at the time of the event
+         * @param pointerY the Y mouse cursor position at the time of the event
+         * @param meshUnderPointer The mesh that is currently pointed at (can be null)
+         * @param sourceEvent the original (browser) event that triggered the ActionEvent
+         */
         constructor(public source: AbstractMesh, public pointerX: number, public pointerY: number, public meshUnderPointer: AbstractMesh, public sourceEvent?: any) {
 
         }
 
+        /**
+         * Helper function to auto-create an ActionEvent from a source mesh.
+         * @param source the source mesh that triggered the event
+         * @param evt {Event} The original (browser) event
+         */
         public static CreateNew(source: AbstractMesh, evt?: Event): ActionEvent {
             var scene = source.getScene();
             return new ActionEvent(source, scene.pointerX, scene.pointerY, scene.meshUnderPointer, evt);
         }
 
+        /**
+         * Helper function to auto-create an ActionEvent from a scene. If triggered by a mesh use ActionEvent.CreateNew
+         * @param scene the scene where the event occurred
+         * @param evt {Event} The original (browser) event
+         */
         public static CreateNewFromScene(scene: Scene, evt: Event): ActionEvent {
             return new ActionEvent(null, scene.pointerX, scene.pointerY, scene.meshUnderPointer, evt);
         }
     }
 
+    /**
+     * Action Manager manages all events to be triggered on a given mesh or the global scene.
+     * A single scene can have many Action Managers to handle predefined actions on specific meshes.
+     */
     export class ActionManager {
         // Statics
         private static _NothingTrigger = 0;
@@ -101,6 +126,11 @@
             return this._scene;
         }
 
+        /**
+         * Does this action manager handles actions of any of the given triggers
+         * @param {number[]} triggers - the triggers to be tested
+         * @return {boolean} whether one (or more) of the triggers is handeled 
+         */
         public hasSpecificTriggers(triggers: number[]): boolean {
             for (var index = 0; index < this.actions.length; index++) {
                 var action = this.actions[index];
@@ -113,6 +143,10 @@
             return false;
         }
 
+        /**
+         * Does this action manager has pointer triggers
+         * @return {boolean} whether or not it has pointer triggers
+         */
         public get hasPointerTriggers(): boolean {
             for (var index = 0; index < this.actions.length; index++) {
                 var action = this.actions[index];
@@ -125,6 +159,10 @@
             return false;
         }
 
+        /**
+         * Does this action manager has pick triggers
+         * @return {boolean} whether or not it has pick triggers
+         */
         public get hasPickTriggers(): boolean {
             for (var index = 0; index < this.actions.length; index++) {
                 var action = this.actions[index];
@@ -137,6 +175,11 @@
             return false;
         }
 
+        /**
+         * Registers an action to this action manager
+         * @param {BABYLON.Action} action - the action to be registered
+         * @return {BABYLON.Action} the action amended (prepared) after registration
+         */
         public registerAction(action: Action): Action {
             if (action.trigger === ActionManager.OnEveryFrameTrigger) {
                 if (this.getScene().actionManager !== this) {
@@ -154,6 +197,11 @@
             return action;
         }
 
+        /**
+         * Process a specific trigger
+         * @param {number} trigger - the trigger to process
+         * @param evt {BABYLON.ActionEvent} the event details to be processed
+         */
         public processTrigger(trigger: number, evt: ActionEvent): void {
             for (var index = 0; index < this.actions.length; index++) {
                 var action = this.actions[index];
@@ -173,7 +221,7 @@
                     action._executeCurrent(evt);
                 }
             }
-        }
+        } 
 
         public _getEffectiveTarget(target: any, propertyPath: string): any {
             var properties = propertyPath.split(".");

+ 33 - 0
Babylon/babylon.node.js

@@ -1,6 +1,14 @@
 var BABYLON;
 (function (BABYLON) {
+    /**
+    * Node is the basic class for all scene objects (Mesh, Light Camera).
+    */
     var Node = (function () {
+        /**
+        * @constructor
+        * @param {string} name - the name and id to be given to this node
+        * @param {BABYLON.Scene} the scene this node will be added to
+        */
         function Node(name, scene) {
             this.state = "";
             this.animations = new Array();
@@ -79,10 +87,20 @@
             return true;
         };
 
+        /**
+        * Is this node ready to be used/rendered
+        * @return {boolean} is it ready
+        */
         Node.prototype.isReady = function () {
             return this._isReady;
         };
 
+        /**
+        * Is this node enabled.
+        * If the node has a parent and is enabled, the parent will be inspected as well.
+        * @return {boolean} whether this node (and its parent) is enabled.
+        * @see setEnabled
+        */
         Node.prototype.isEnabled = function () {
             if (!this._isEnabled) {
                 return false;
@@ -95,10 +113,21 @@
             return true;
         };
 
+        /**
+        * Set the enabled state of this node.
+        * @param {boolean} value - the new enabled state
+        * @see isEnabled
+        */
         Node.prototype.setEnabled = function (value) {
             this._isEnabled = value;
         };
 
+        /**
+        * Is this node a descendant of the given node.
+        * The function will iterate up the hierarchy until the ancestor was found or no more parents defined.
+        * @param {BABYLON.Node} ancestor - The parent node to inspect
+        * @see parent
+        */
         Node.prototype.isDescendantOf = function (ancestor) {
             if (this.parent) {
                 if (this.parent === ancestor) {
@@ -119,6 +148,10 @@
             }
         };
 
+        /**
+        * Will return all nodes that have this node as parent.
+        * @return {BABYLON.Node[]} all children nodes of all types.
+        */
         Node.prototype.getDescendants = function () {
             var results = [];
             this._getDescendants(this._scene.meshes, results);

+ 35 - 1
Babylon/babylon.node.ts

@@ -1,4 +1,8 @@
 module BABYLON {
+
+    /**
+     * Node is the basic class for all scene objects (Mesh, Light Camera).
+     */
     export class Node {
         public parent: Node;
         public name: string;
@@ -19,7 +23,12 @@
         private _scene: Scene;
         public _cache;
 
-        constructor(name: string, scene) {
+        /**
+         * @constructor
+         * @param {string} name - the name and id to be given to this node
+         * @param {BABYLON.Scene} the scene this node will be added to
+         */
+        constructor(name: string, scene: Scene) {
             this.name = name;
             this.id = name;
             this._scene = scene;
@@ -92,10 +101,20 @@
             return true;
         }
 
+        /**
+         * Is this node ready to be used/rendered
+         * @return {boolean} is it ready
+         */
         public isReady(): boolean {
             return this._isReady;
         }
 
+        /**
+         * Is this node enabled. 
+         * If the node has a parent and is enabled, the parent will be inspected as well.
+         * @return {boolean} whether this node (and its parent) is enabled.
+         * @see setEnabled
+         */
         public isEnabled(): boolean {
             if (!this._isEnabled) {
                 return false;
@@ -108,10 +127,21 @@
             return true;
         }
 
+        /**
+         * Set the enabled state of this node.
+         * @param {boolean} value - the new enabled state
+         * @see isEnabled
+         */
         public setEnabled(value: boolean): void {
             this._isEnabled = value;
         }
 
+        /**
+         * Is this node a descendant of the given node.
+         * The function will iterate up the hierarchy until the ancestor was found or no more parents defined.
+         * @param {BABYLON.Node} ancestor - The parent node to inspect
+         * @see parent
+         */
         public isDescendantOf(ancestor: Node): boolean {
             if (this.parent) {
                 if (this.parent === ancestor) {
@@ -133,6 +163,10 @@
             }
         }
 
+        /**
+         * Will return all nodes that have this node as parent.
+         * @return {BABYLON.Node[]} all children nodes of all types.
+         */
         public getDescendants(): Node[] {
             var results = [];
             this._getDescendants(this._scene.meshes, results);

+ 132 - 1
Babylon/babylon.scene.js

@@ -1,7 +1,14 @@
 var BABYLON;
 (function (BABYLON) {
+    /**
+    * Represents a scene to be rendered by the engine.
+    * @see http://doc.babylonjs.com/page.php?p=21911
+    */
     var Scene = (function () {
-        // Constructor
+        /**
+        * @constructor
+        * @param {BABYLON.Engine} engine - the engine to be used to render this scene.
+        */
         function Scene(engine) {
             // Members
             this.autoClear = true;
@@ -13,6 +20,10 @@
             this.animationsEnabled = true;
             this.cameraToUseForPointers = null;
             // Fog
+            /**
+            * is fog enabled on this scene.
+            * @type {boolean}
+            */
             this.fogEnabled = true;
             this.fogMode = Scene.FOGMODE_NONE;
             this.fogColor = new BABYLON.Color3(0.2, 0.2, 0.3);
@@ -20,13 +31,36 @@
             this.fogStart = 0;
             this.fogEnd = 1000.0;
             // Lights
+            /**
+            * is shadow enabled on this scene.
+            * @type {boolean}
+            */
             this.shadowsEnabled = true;
+            /**
+            * is light enabled on this scene.
+            * @type {boolean}
+            */
             this.lightsEnabled = true;
+            /**
+            * All of the lights added to this scene.
+            * @see BABYLON.Light
+            * @type {BABYLON.Light[]}
+            */
             this.lights = new Array();
             // Cameras
+            /**
+            * All of the cameras added to this scene.
+            * @see BABYLON.Camera
+            * @type {BABYLON.Camera[]}
+            */
             this.cameras = new Array();
             this.activeCameras = new Array();
             // Meshes
+            /**
+            * All of the (abstract) meshes added to this scene.
+            * @see BABYLON.AbstractMesh
+            * @type {BABYLON.AbstractMesh[]}
+            */
             this.meshes = new Array();
             // Geometries
             this._geometries = new Array();
@@ -120,6 +154,10 @@
         });
 
         Object.defineProperty(Scene.prototype, "meshUnderPointer", {
+            /**
+            * The mesh that is currently under the pointer.
+            * @return {BABYLON.AbstractMesh} mesh under the pointer/mouse cursor or null if none.
+            */
             get: function () {
                 return this._meshUnderPointer;
             },
@@ -128,6 +166,10 @@
         });
 
         Object.defineProperty(Scene.prototype, "pointerX", {
+            /**
+            * Current on-screen X position of the pointer
+            * @return {number} X position of the pointer
+            */
             get: function () {
                 return this._pointerX;
             },
@@ -136,6 +178,10 @@
         });
 
         Object.defineProperty(Scene.prototype, "pointerY", {
+            /**
+            * Current on-screen Y position of the pointer
+            * @return {number} Y position of the pointer
+            */
             get: function () {
                 return this._pointerY;
             },
@@ -388,6 +434,10 @@
             return this._pendingData.length;
         };
 
+        /**
+        * Registers a function to be executed when the scene is ready.
+        * @param {Function} func - the function to be executed.
+        */
         Scene.prototype.executeWhenReady = function (func) {
             var _this = this;
             this._onReadyCallbacks.push(func);
@@ -419,6 +469,19 @@
         };
 
         // Animations
+        /**
+        * Will start the animation sequence of a given target
+        * @param target - the target
+        * @param {number} from - from which frame should animation start
+        * @param {number} to - till which frame should animation run.
+        * @param {boolean} [loop] - should the animation loop
+        * @param {number} [speedRatio] - the speed in which to run the animation
+        * @param {Function} [onAnimationEnd] function to be executed when the animation ended.
+        * @param {BABYLON.Animatable} [animatable] an animatable object. If not provided a new one will be created from the given params.
+        * @return {BABYLON.Animatable} the animatable object created for this animation
+        * @see BABYLON.Animatable
+        * @see http://doc.babylonjs.com/page.php?p=22081
+        */
         Scene.prototype.beginAnimation = function (target, from, to, loop, speedRatio, onAnimationEnd, animatable) {
             if (speedRatio === undefined) {
                 speedRatio = 1.0;
@@ -466,6 +529,11 @@
             return null;
         };
 
+        /**
+        * Will stop the animation of the given target
+        * @param target - the target
+        * @see beginAnimation
+        */
         Scene.prototype.stopAnimation = function (target) {
             var animatable = this.getAnimatableByTarget(target);
 
@@ -516,6 +584,12 @@
         };
 
         // Methods
+        /**
+        * sets the active camera of the scene using its ID
+        * @param {string} id - the camera's ID
+        * @return {BABYLON.Camera|null} the new active camera or null if none found.
+        * @see activeCamera
+        */
         Scene.prototype.setActiveCameraByID = function (id) {
             var camera = this.getCameraByID(id);
 
@@ -527,6 +601,12 @@
             return null;
         };
 
+        /**
+        * sets the active camera of the scene using its name
+        * @param {string} name - the camera's name
+        * @return {BABYLON.Camera|null} the new active camera or null if none found.
+        * @see activeCamera
+        */
         Scene.prototype.setActiveCameraByName = function (name) {
             var camera = this.getCameraByName(name);
 
@@ -538,6 +618,11 @@
             return null;
         };
 
+        /**
+        * get a material using its id
+        * @param {string} the material's ID
+        * @return {BABYLON.Material|null} the material or null if none found.
+        */
         Scene.prototype.getMaterialByID = function (id) {
             for (var index = 0; index < this.materials.length; index++) {
                 if (this.materials[index].id === id) {
@@ -548,6 +633,11 @@
             return null;
         };
 
+        /**
+        * get a material using its name
+        * @param {string} the material's name
+        * @return {BABYLON.Material|null} the material or null if none found.
+        */
         Scene.prototype.getMaterialByName = function (name) {
             for (var index = 0; index < this.materials.length; index++) {
                 if (this.materials[index].name === name) {
@@ -568,6 +658,11 @@
             return null;
         };
 
+        /**
+        * get a camera using its name
+        * @param {string} the camera's name
+        * @return {BABYLON.Camera|null} the camera or null if none found.
+        */
         Scene.prototype.getCameraByName = function (name) {
             for (var index = 0; index < this.cameras.length; index++) {
                 if (this.cameras[index].name === name) {
@@ -578,6 +673,11 @@
             return null;
         };
 
+        /**
+        * get a light node using its name
+        * @param {string} the light's name
+        * @return {BABYLON.Light|null} the light or null if none found.
+        */
         Scene.prototype.getLightByName = function (name) {
             for (var index = 0; index < this.lights.length; index++) {
                 if (this.lights[index].name === name) {
@@ -588,6 +688,11 @@
             return null;
         };
 
+        /**
+        * get a light node using its ID
+        * @param {string} the light's id
+        * @return {BABYLON.Light|null} the light or null if none found.
+        */
         Scene.prototype.getLightByID = function (id) {
             for (var index = 0; index < this.lights.length; index++) {
                 if (this.lights[index].id === id) {
@@ -598,6 +703,11 @@
             return null;
         };
 
+        /**
+        * get a geometry using its ID
+        * @param {string} the geometry's id
+        * @return {BABYLON.Geometry|null} the geometry or null if none found.
+        */
         Scene.prototype.getGeometryByID = function (id) {
             for (var index = 0; index < this._geometries.length; index++) {
                 if (this._geometries[index].id === id) {
@@ -608,6 +718,12 @@
             return null;
         };
 
+        /**
+        * add a new geometry to this scene.
+        * @param {BABYLON.Geometry} geometry - the geometry to be added to the scene.
+        * @param {boolean} [force] - force addition, even if a geometry with this ID already exists
+        * @return {boolean} was the geometry added or not
+        */
         Scene.prototype.pushGeometry = function (geometry, force) {
             if (!force && this.getGeometryByID(geometry.id)) {
                 return false;
@@ -622,6 +738,11 @@
             return this._geometries;
         };
 
+        /**
+        * Get a the first added mesh found of a given ID
+        * @param {string} id - the id to search for
+        * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
+        */
         Scene.prototype.getMeshByID = function (id) {
             for (var index = 0; index < this.meshes.length; index++) {
                 if (this.meshes[index].id === id) {
@@ -632,6 +753,11 @@
             return null;
         };
 
+        /**
+        * Get a the last added mesh found of a given ID
+        * @param {string} id - the id to search for
+        * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
+        */
         Scene.prototype.getLastMeshByID = function (id) {
             for (var index = this.meshes.length - 1; index >= 0; index--) {
                 if (this.meshes[index].id === id) {
@@ -642,6 +768,11 @@
             return null;
         };
 
+        /**
+        * Get a the last added node (Mesh, Camera, Light) found of a given ID
+        * @param {string} id - the id to search for
+        * @return {BABYLON.Node|null} the node found or null if not found at all.
+        */
         Scene.prototype.getLastEntryByID = function (id) {
             for (var index = this.meshes.length - 1; index >= 0; index--) {
                 if (this.meshes[index].id === id) {

+ 149 - 1
Babylon/babylon.scene.ts

@@ -3,6 +3,10 @@
         dispose(): void;
     }
 
+    /**
+     * Represents a scene to be rendered by the engine.
+     * @see http://doc.babylonjs.com/page.php?p=21911
+     */
     export class Scene {
         // Statics
         public static FOGMODE_NONE = 0;
@@ -17,8 +21,20 @@
         public autoClear = true;
         public clearColor: any = new Color3(0.2, 0.2, 0.3);
         public ambientColor = new Color3(0, 0, 0);
+        /**
+        * A function to be executed before rendering this scene
+        * @type {Function}
+        */
         public beforeRender: () => void;
+        /**
+        * A function to be executed after rendering this scene
+        * @type {Function}
+        */
         public afterRender: () => void;
+        /**
+        * A function to be executed when this scene is disposed.
+        * @type {Function}
+        */
         public onDispose: () => void;
         public beforeCameraRender: (camera: Camera) => void;
         public afterCameraRender: (camera: Camera) => void;
@@ -42,6 +58,10 @@
         private _onKeyUp: (evt: Event) => void;
 
         // Fog
+        /**
+        * is fog enabled on this scene.
+        * @type {boolean}
+        */
         public fogEnabled = true;
         public fogMode = Scene.FOGMODE_NONE;
         public fogColor = new Color3(0.2, 0.2, 0.3);
@@ -50,16 +70,39 @@
         public fogEnd = 1000.0;
 
         // Lights
+        /**
+        * is shadow enabled on this scene.
+        * @type {boolean}
+        */
         public shadowsEnabled = true;
+        /**
+        * is light enabled on this scene.
+        * @type {boolean}
+        */
         public lightsEnabled = true;
+        /**
+        * All of the lights added to this scene.
+        * @see BABYLON.Light
+        * @type {BABYLON.Light[]}
+        */
         public lights = new Array<Light>();
 
         // Cameras
+        /**
+        * All of the cameras added to this scene.
+        * @see BABYLON.Camera
+        * @type {BABYLON.Camera[]}
+        */
         public cameras = new Array<Camera>();
         public activeCameras = new Array<Camera>();
         public activeCamera: Camera;
 
         // Meshes
+        /**
+        * All of the (abstract) meshes added to this scene.
+        * @see BABYLON.AbstractMesh
+        * @type {BABYLON.AbstractMesh[]}
+        */
         public meshes = new Array<AbstractMesh>();
 
         // Geometries
@@ -114,6 +157,10 @@
         public database; //ANY
 
         // Actions
+        /**
+         * This scene's action manager
+         * @type {BABYLON.ActionManager}
+         */
         public actionManager: ActionManager;
         public _actionManagers = new Array<ActionManager>();
         private _meshesForIntersections = new SmartArray<AbstractMesh>(256);
@@ -183,7 +230,10 @@
 
         private _debugLayer: DebugLayer;
 
-        // Constructor
+        /**
+         * @constructor
+         * @param {BABYLON.Engine} engine - the engine to be used to render this scene.
+         */
         constructor(engine: Engine) {
             this._engine = engine;
 
@@ -209,14 +259,26 @@
             return this._debugLayer;
         }
 
+        /**
+         * The mesh that is currently under the pointer.
+         * @return {BABYLON.AbstractMesh} mesh under the pointer/mouse cursor or null if none.
+         */
         public get meshUnderPointer(): AbstractMesh {
             return this._meshUnderPointer;
         }
 
+        /**
+         * Current on-screen X position of the pointer
+         * @return {number} X position of the pointer
+         */
         public get pointerX(): number {
             return this._pointerX;
         }
 
+        /**
+         * Current on-screen Y position of the pointer
+         * @return {number} Y position of the pointer
+         */
         public get pointerY(): number {
             return this._pointerY;
         }
@@ -469,6 +531,10 @@
             return this._pendingData.length;
         }
 
+        /**
+         * Registers a function to be executed when the scene is ready.
+         * @param {Function} func - the function to be executed.
+         */
         public executeWhenReady(func: () => void): void {
             this._onReadyCallbacks.push(func);
 
@@ -498,6 +564,19 @@
         }
 
         // Animations
+        /**
+         * Will start the animation sequence of a given target
+         * @param target - the target 
+         * @param {number} from - from which frame should animation start
+         * @param {number} to - till which frame should animation run.
+         * @param {boolean} [loop] - should the animation loop
+         * @param {number} [speedRatio] - the speed in which to run the animation
+         * @param {Function} [onAnimationEnd] function to be executed when the animation ended.
+         * @param {BABYLON.Animatable} [animatable] an animatable object. If not provided a new one will be created from the given params.
+         * @return {BABYLON.Animatable} the animatable object created for this animation
+         * @see BABYLON.Animatable
+         * @see http://doc.babylonjs.com/page.php?p=22081
+         */
         public beginAnimation(target: any, from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void, animatable?: Animatable): Animatable {
             if (speedRatio === undefined) {
                 speedRatio = 1.0;
@@ -545,6 +624,11 @@
             return null;
         }
 
+        /**
+         * Will stop the animation of the given target
+         * @param target - the target 
+         * @see beginAnimation 
+         */
         public stopAnimation(target: any): void {
             var animatable = this.getAnimatableByTarget(target);
 
@@ -594,6 +678,13 @@
         }
 
         // Methods
+
+        /**
+         * sets the active camera of the scene using its ID
+         * @param {string} id - the camera's ID
+         * @return {BABYLON.Camera|null} the new active camera or null if none found.
+         * @see activeCamera
+         */
         public setActiveCameraByID(id: string): Camera {
             var camera = this.getCameraByID(id);
 
@@ -605,6 +696,12 @@
             return null;
         }
 
+        /**
+         * sets the active camera of the scene using its name
+         * @param {string} name - the camera's name
+         * @return {BABYLON.Camera|null} the new active camera or null if none found.
+         * @see activeCamera
+         */
         public setActiveCameraByName(name: string): Camera {
             var camera = this.getCameraByName(name);
 
@@ -616,6 +713,11 @@
             return null;
         }
 
+        /**
+         * get a material using its id
+         * @param {string} the material's ID
+         * @return {BABYLON.Material|null} the material or null if none found.
+         */
         public getMaterialByID(id: string): Material {
             for (var index = 0; index < this.materials.length; index++) {
                 if (this.materials[index].id === id) {
@@ -626,6 +728,11 @@
             return null;
         }
 
+        /**
+         * get a material using its name
+         * @param {string} the material's name
+         * @return {BABYLON.Material|null} the material or null if none found.
+         */
         public getMaterialByName(name: string): Material {
             for (var index = 0; index < this.materials.length; index++) {
                 if (this.materials[index].name === name) {
@@ -646,6 +753,11 @@
             return null;
         }
 
+        /**
+         * get a camera using its name
+         * @param {string} the camera's name
+         * @return {BABYLON.Camera|null} the camera or null if none found.
+         */
         public getCameraByName(name: string): Camera {
             for (var index = 0; index < this.cameras.length; index++) {
                 if (this.cameras[index].name === name) {
@@ -656,6 +768,11 @@
             return null;
         }
 
+        /**
+         * get a light node using its name
+         * @param {string} the light's name
+         * @return {BABYLON.Light|null} the light or null if none found.
+         */
         public getLightByName(name: string): Light {
             for (var index = 0; index < this.lights.length; index++) {
                 if (this.lights[index].name === name) {
@@ -666,6 +783,11 @@
             return null;
         }
 
+        /**
+         * get a light node using its ID
+         * @param {string} the light's id
+         * @return {BABYLON.Light|null} the light or null if none found.
+         */
         public getLightByID(id: string): Light {
             for (var index = 0; index < this.lights.length; index++) {
                 if (this.lights[index].id === id) {
@@ -676,6 +798,11 @@
             return null;
         }
 
+        /**
+         * get a geometry using its ID
+         * @param {string} the geometry's id
+         * @return {BABYLON.Geometry|null} the geometry or null if none found.
+         */
         public getGeometryByID(id: string): Geometry {
             for (var index = 0; index < this._geometries.length; index++) {
                 if (this._geometries[index].id === id) {
@@ -686,6 +813,12 @@
             return null;
         }
 
+        /**
+         * add a new geometry to this scene.
+         * @param {BABYLON.Geometry} geometry - the geometry to be added to the scene.
+         * @param {boolean} [force] - force addition, even if a geometry with this ID already exists
+         * @return {boolean} was the geometry added or not
+         */
         public pushGeometry(geometry: Geometry, force?: boolean): boolean {
             if (!force && this.getGeometryByID(geometry.id)) {
                 return false;
@@ -700,6 +833,11 @@
             return this._geometries;
         }
 
+        /**
+         * Get a the first added mesh found of a given ID
+         * @param {string} id - the id to search for
+         * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
+         */
         public getMeshByID(id: string): AbstractMesh {
             for (var index = 0; index < this.meshes.length; index++) {
                 if (this.meshes[index].id === id) {
@@ -710,6 +848,11 @@
             return null;
         }
 
+        /**
+         * Get a the last added mesh found of a given ID
+         * @param {string} id - the id to search for
+         * @return {BABYLON.AbstractMesh|null} the mesh found or null if not found at all.
+         */
         public getLastMeshByID(id: string): AbstractMesh {
             for (var index = this.meshes.length - 1; index >= 0; index--) {
                 if (this.meshes[index].id === id) {
@@ -720,6 +863,11 @@
             return null;
         }
 
+        /**
+         * Get a the last added node (Mesh, Camera, Light) found of a given ID
+         * @param {string} id - the id to search for
+         * @return {BABYLON.Node|null} the node found or null if not found at all.
+         */
         public getLastEntryByID(id: string): Node {
             for (var index = this.meshes.length - 1; index >= 0; index--) {
                 if (this.meshes[index].id === id) {