Преглед на файлове

Merge branch 'master' into transformNodeDocs

Trevor Baron преди 7 години
родител
ревизия
c758b6d238

Файловите разлики са ограничени, защото са твърде много
+ 8448 - 8204
dist/preview release/babylon.d.ts


Файловите разлики са ограничени, защото са твърде много
+ 0 - 2737
dist/preview release/typedocValidationBaseline.json


+ 42 - 1
src/Loading/babylon.loadingScreen.ts

@@ -1,23 +1,51 @@
 module BABYLON {
 
+    /**
+     * Interface used to present a loading screen while loading a scene
+     * @see http://doc.babylonjs.com/how_to/creating_a_custom_loading_screen
+     */
     export interface ILoadingScreen {
+        /**
+         * Function called to display the loading screen
+         */
         displayLoadingUI: () => void;
+        /**
+         * Function called to hide the loading screen
+         */
         hideLoadingUI: () => void;
-        //default loader support
+        /**
+         * Gets or sets the color to use for the background
+         */
         loadingUIBackgroundColor: string;
+        /**
+         * Gets or sets the text to display while loading
+         */
         loadingUIText: string;
 
     }
 
+    /**
+     * Class used for the default loading screen
+     * @see http://doc.babylonjs.com/how_to/creating_a_custom_loading_screen
+     */
     export class DefaultLoadingScreen implements ILoadingScreen {
 
         private _loadingDiv: Nullable<HTMLDivElement>;
         private _loadingTextDiv: HTMLDivElement;
 
+        /**
+         * Creates a new default loading screen
+         * @param _renderingCanvas defines the canvas used to render the scene
+         * @param _loadingText defines the default text to display
+         * @param _loadingDivBackgroundColor defines the default background color
+         */
         constructor(private _renderingCanvas: HTMLCanvasElement, private _loadingText = "", private _loadingDivBackgroundColor = "black") {
 
         }
 
+        /**
+         * Function called to display the loading screen
+         */
         public displayLoadingUI(): void {
             if (this._loadingDiv) {
                 // Do not add a loading screen if there is already one  
@@ -91,6 +119,9 @@ module BABYLON {
             this._loadingDiv.style.opacity = "1";
         }
 
+        /**
+         * Function called to hide the loading screen
+         */        
         public hideLoadingUI(): void {
             if (!this._loadingDiv) {
                 return;
@@ -110,6 +141,9 @@ module BABYLON {
             this._loadingDiv.addEventListener("transitionend", onTransitionEnd);
         }
 
+        /**
+         * Gets or sets the text to display while loading
+         */
         public set loadingUIText(text: string) {
             this._loadingText = text;
 
@@ -118,6 +152,13 @@ module BABYLON {
             }
         }
 
+        public get loadingUIText(): string {
+            return this._loadingText;
+        }
+
+        /**
+         * Gets or sets the color to use for the background
+         */        
         public get loadingUIBackgroundColor(): string {
             return this._loadingDivBackgroundColor;
         }

+ 119 - 13
src/Loading/babylon.sceneLoader.ts

@@ -1,25 +1,67 @@
 module BABYLON {
+    /**
+     * Class used to represent data loading progression
+     */
     export class SceneLoaderProgressEvent {
-        constructor(public readonly lengthComputable: boolean, public readonly loaded: number, public readonly total: number) {
+        /**
+         * Create a new progress event
+         * @param lengthComputable defines if data length to load can be evaluated
+         * @param loaded defines the loaded data length
+         * @param total defines the data length to load
+         */
+        constructor(
+            /** defines if data length to load can be evaluated */
+            public readonly lengthComputable: boolean, 
+            /** defines the loaded data length */
+            public readonly loaded: number, 
+            /** defines the data length to load */
+            public readonly total: number) {
         }
 
+        /**
+         * Creates a new SceneLoaderProgressEvent from a ProgressEvent
+         * @param event defines the source event
+         * @returns a new SceneLoaderProgressEvent
+         */
         public static FromProgressEvent(event: ProgressEvent): SceneLoaderProgressEvent {
             return new SceneLoaderProgressEvent(event.lengthComputable, event.loaded, event.total);
         }
     }
 
+    /**
+     * Interface used by SceneLoader plugins to define supported file extensions
+     */
     export interface ISceneLoaderPluginExtensions {
+        /**
+         * Defines the list of supported extensions
+         */
         [extension: string]: {
             isBinary: boolean;
         };
     }
 
+    /**
+     * Interface used by SceneLoader plugin factory
+     */
     export interface ISceneLoaderPluginFactory {
+        /**
+         * Defines the name of the factory
+         */
         name: string;
+        /**
+         * Function called to create a new plugin
+         * @return the new plugin
+         */
         createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
+        /**
+         * Boolean indicating if the plugin can direct load specific data
+         */
         canDirectLoad?: (data: string) => boolean;
     }
 
+    /**
+     * Interface used to define a SceneLoader plugin
+     */
     export interface ISceneLoaderPlugin {
         /**
          * The friendly name of this plugin.
@@ -76,6 +118,9 @@
         loadAssetContainer(scene: Scene, data: string, rootUrl: string, onError?: (message: string, exception?: any) => void): AssetContainer;
     }
 
+    /**
+     * Interface used to define an async SceneLoader plugin
+     */
     export interface ISceneLoaderPluginAsync {
         /**
          * The friendly name of this plugin.
@@ -132,41 +177,73 @@
         loadAssetContainerAsync(scene: Scene, data: string, rootUrl: string, onProgress?: (event: SceneLoaderProgressEvent) => void, fileName?: string): Promise<AssetContainer>;
     }
 
+    /**
+     * Defines a plugin registered by the SceneLoader
+     */
     interface IRegisteredPlugin {
+        /**
+         * Defines the plugin to use
+         */
         plugin: ISceneLoaderPlugin | ISceneLoaderPluginAsync | ISceneLoaderPluginFactory;
+        /**
+         * Defines if the plugin supports binary data
+         */
         isBinary: boolean;
     }
 
+    /**
+     * Defines file information
+     */
     interface IFileInfo {
+        /**
+         * Gets the file url
+         */
         url: string;
+        /**
+         * Gets the root url
+         */
         rootUrl: string;
+        /**
+         * Gets filename
+         */
         name: string;
     }
 
+    /**
+     * Class used to load scene from various file formats using registered plugins
+     * @see http://doc.babylonjs.com/how_to/load_from_any_file_type
+     */
     export class SceneLoader {
         // Flags
         private static _ForceFullSceneLoadingForIncremental = false;
         private static _ShowLoadingScreen = true;
         private static _CleanBoneMatrixWeights = false;
 
-        public static get NO_LOGGING(): number {
-            return 0;
-        }
+        /**
+         * No logging while loading
+         */
+        public static readonly NO_LOGGING = 0;
 
-        public static get MINIMAL_LOGGING(): number {
-            return 1;
-        }
+        /**
+         * Minimal logging while loading
+         */
+        public static readonly MINIMAL_LOGGING = 1;
 
-        public static get SUMMARY_LOGGING(): number {
-            return 2;
-        }
+        /**
+         * Summary logging while loading
+         */
+        public static readonly SUMMARY_LOGGING = 2;
 
-        public static get DETAILED_LOGGING(): number {
-            return 3;
-        }
+        /**
+         * Detailled logging while loading
+         */
+        public static readonly DETAILED_LOGGING = 3;
 
         private static _loggingLevel = SceneLoader.NO_LOGGING;
 
+        /**
+         * Gets or sets a boolean indicating if entire scene must be loaded even if scene contains incremental data
+         */
         public static get ForceFullSceneLoadingForIncremental() {
             return SceneLoader._ForceFullSceneLoadingForIncremental;
         }
@@ -175,6 +252,9 @@
             SceneLoader._ForceFullSceneLoadingForIncremental = value;
         }
 
+        /**
+         * Gets or sets a boolean indicating if loading screen must be displayed while loading a scene
+         */
         public static get ShowLoadingScreen(): boolean {
             return SceneLoader._ShowLoadingScreen;
         }
@@ -183,6 +263,10 @@
             SceneLoader._ShowLoadingScreen = value;
         }
 
+        /**
+         * Defines the current logging level (while loading the scene)
+         * @ignorenaming
+         */
         public static get loggingLevel(): number {
             return SceneLoader._loggingLevel;
         }
@@ -191,6 +275,9 @@
             SceneLoader._loggingLevel = value;
         }
 
+        /**
+         * Gets or set a boolean indicating if matrix weights must be cleaned upon loading
+         */
         public static get CleanBoneMatrixWeights(): boolean {
             return SceneLoader._CleanBoneMatrixWeights;
         }
@@ -200,6 +287,10 @@
         }
 
         // Members
+
+        /**
+         * Event raised when a plugin is used to load a scene
+         */
         public static OnPluginActivatedObservable = new Observable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>();
 
         private static _registeredPlugins: { [extension: string]: IRegisteredPlugin } = {};
@@ -375,14 +466,29 @@
         }
 
         // Public functions
+
+        /**
+         * Gets a plugin that can load the given extension
+         * @param extension defines the extension to load
+         * @returns a plugin or null if none works
+         */
         public static GetPluginForExtension(extension: string): ISceneLoaderPlugin | ISceneLoaderPluginAsync | ISceneLoaderPluginFactory {
             return SceneLoader._getPluginForExtension(extension).plugin;
         }
 
+        /**
+         * Gets a boolean indicating that the given extension can be loaded
+         * @param extension defines the extension to load
+         * @returns true if the extension is supported
+         */
         public static IsPluginForExtensionAvailable(extension: string): boolean {
             return !!SceneLoader._registeredPlugins[extension];
         }
 
+        /**
+         * Adds a new plugin to the list of registered plugins
+         * @param plugin defines the plugin to add
+         */
         public static RegisterPlugin(plugin: ISceneLoaderPlugin | ISceneLoaderPluginAsync): void {
             if (typeof plugin.extensions === "string") {
                 var extension = <string>plugin.extensions;

+ 9 - 1
src/Materials/Textures/babylon.rawTexture.ts

@@ -22,7 +22,12 @@
          * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)
          * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)
          */
-        constructor(data: ArrayBufferView, width: number, height: number, public format: number, scene: Scene, generateMipMaps: boolean = true, invertY: boolean = false, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE, type: number = Engine.TEXTURETYPE_UNSIGNED_INT) {
+        constructor(data: ArrayBufferView, width: number, height: number, 
+            /**
+             * Define the format of the data (RGB, RGBA... Engine.TEXTUREFORMAT_xxx)
+             */
+            public format: number, 
+            scene: Scene, generateMipMaps: boolean = true, invertY: boolean = false, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE, type: number = Engine.TEXTURETYPE_UNSIGNED_INT) {
             super(null, scene, !generateMipMaps, invertY);
             this._engine = scene.getEngine();
             this._texture = scene.getEngine().createRawTexture(data, width, height, format, generateMipMaps, invertY, samplingMode, null, type);
@@ -93,6 +98,7 @@
          * @param generateMipMaps Define whether or not to create mip maps for the texture
          * @param invertY define if the data should be flipped on Y when uploaded to the GPU
          * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)
+         * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)
          * @returns the RGB alpha texture
          */
         public static CreateRGBTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps: boolean = true, invertY: boolean = false, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE, type: number = Engine.TEXTURETYPE_UNSIGNED_INT): RawTexture {
@@ -108,6 +114,7 @@
          * @param generateMipMaps Define whether or not to create mip maps for the texture
          * @param invertY define if the data should be flipped on Y when uploaded to the GPU
          * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)
+         * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)
          * @returns the RGBA texture
          */
         public static CreateRGBATexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps: boolean = true, invertY: boolean = false, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE, type: number = Engine.TEXTURETYPE_UNSIGNED_INT): RawTexture {
@@ -123,6 +130,7 @@
          * @param generateMipMaps Define whether or not to create mip maps for the texture
          * @param invertY define if the data should be flipped on Y when uploaded to the GPU
          * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)
+         * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)
          * @returns the R texture
          */
         public static CreateRTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps: boolean = true, invertY: boolean = false, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE, type: number = Engine.TEXTURETYPE_FLOAT): RawTexture {

+ 215 - 74
src/Materials/Textures/babylon.texture.ts

@@ -1,38 +1,69 @@
 module BABYLON {
+    /**
+     * This represents a texture in babylon. It can be easily loaded from a network, base64 or html input.
+     * @see http://doc.babylonjs.com/babylon101/materials#texture
+     */
     export class Texture extends BaseTexture {
-        // Constants
-        public static NEAREST_SAMPLINGMODE = Engine.TEXTURE_NEAREST_SAMPLINGMODE;
-        public static NEAREST_NEAREST_MIPLINEAR = Engine.TEXTURE_NEAREST_NEAREST_MIPLINEAR; // nearest is mag = nearest and min = nearest and mip = linear
-
-        public static BILINEAR_SAMPLINGMODE = Engine.TEXTURE_BILINEAR_SAMPLINGMODE;
-        public static LINEAR_LINEAR_MIPNEAREST = Engine.TEXTURE_LINEAR_LINEAR_MIPNEAREST; // Bilinear is mag = linear and min = linear and mip = nearest
-
-        public static TRILINEAR_SAMPLINGMODE = Engine.TEXTURE_TRILINEAR_SAMPLINGMODE;
-        public static LINEAR_LINEAR_MIPLINEAR = Engine.TEXTURE_LINEAR_LINEAR_MIPLINEAR; // Trilinear is mag = linear and min = linear and mip = linear
-
-        public static NEAREST_NEAREST_MIPNEAREST = Engine.TEXTURE_NEAREST_NEAREST_MIPNEAREST;
-        public static NEAREST_LINEAR_MIPNEAREST = Engine.TEXTURE_NEAREST_LINEAR_MIPNEAREST;
-        public static NEAREST_LINEAR_MIPLINEAR = Engine.TEXTURE_NEAREST_LINEAR_MIPLINEAR;
-        public static NEAREST_LINEAR = Engine.TEXTURE_NEAREST_LINEAR;
-        public static NEAREST_NEAREST = Engine.TEXTURE_NEAREST_NEAREST;
-        public static LINEAR_NEAREST_MIPNEAREST = Engine.TEXTURE_LINEAR_NEAREST_MIPNEAREST;
-        public static LINEAR_NEAREST_MIPLINEAR = Engine.TEXTURE_LINEAR_NEAREST_MIPLINEAR;
-        public static LINEAR_LINEAR = Engine.TEXTURE_LINEAR_LINEAR;
-        public static LINEAR_NEAREST = Engine.TEXTURE_LINEAR_NEAREST;
-
-        public static EXPLICIT_MODE = Engine.TEXTURE_EXPLICIT_MODE;
-        public static SPHERICAL_MODE = Engine.TEXTURE_SPHERICAL_MODE;
-        public static PLANAR_MODE = Engine.TEXTURE_PLANAR_MODE;
-        public static CUBIC_MODE = Engine.TEXTURE_CUBIC_MODE;
-        public static PROJECTION_MODE = Engine.TEXTURE_PROJECTION_MODE;
-        public static SKYBOX_MODE = Engine.TEXTURE_SKYBOX_MODE;
-        public static INVCUBIC_MODE = Engine.TEXTURE_INVCUBIC_MODE;
-        public static EQUIRECTANGULAR_MODE = Engine.TEXTURE_EQUIRECTANGULAR_MODE;
-        public static FIXED_EQUIRECTANGULAR_MODE = Engine.TEXTURE_FIXED_EQUIRECTANGULAR_MODE;
-        public static FIXED_EQUIRECTANGULAR_MIRRORED_MODE = Engine.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE;
-
+        /** nearest is mag = nearest and min = nearest and mip = linear */
+        public static readonly NEAREST_SAMPLINGMODE = Engine.TEXTURE_NEAREST_SAMPLINGMODE;
+        /** nearest is mag = nearest and min = nearest and mip = linear */
+        public static readonly NEAREST_NEAREST_MIPLINEAR = Engine.TEXTURE_NEAREST_NEAREST_MIPLINEAR; // nearest is mag = nearest and min = nearest and mip = linear
+
+        /** Bilinear is mag = linear and min = linear and mip = nearest */
+        public static readonly BILINEAR_SAMPLINGMODE = Engine.TEXTURE_BILINEAR_SAMPLINGMODE;
+        /** Bilinear is mag = linear and min = linear and mip = nearest */
+        public static readonly LINEAR_LINEAR_MIPNEAREST = Engine.TEXTURE_LINEAR_LINEAR_MIPNEAREST; // Bilinear is mag = linear and min = linear and mip = nearest
+
+        /** Trilinear is mag = linear and min = linear and mip = linear */
+        public static readonly TRILINEAR_SAMPLINGMODE = Engine.TEXTURE_TRILINEAR_SAMPLINGMODE;
+        /** Trilinear is mag = linear and min = linear and mip = linear */
+        public static readonly LINEAR_LINEAR_MIPLINEAR = Engine.TEXTURE_LINEAR_LINEAR_MIPLINEAR; // Trilinear is mag = linear and min = linear and mip = linear
+
+        /** mag = nearest and min = nearest and mip = nearest */
+        public static readonly NEAREST_NEAREST_MIPNEAREST = Engine.TEXTURE_NEAREST_NEAREST_MIPNEAREST;
+        /** mag = nearest and min = linear and mip = nearest */
+        public static readonly NEAREST_LINEAR_MIPNEAREST = Engine.TEXTURE_NEAREST_LINEAR_MIPNEAREST;
+        /** mag = nearest and min = linear and mip = linear */
+        public static readonly NEAREST_LINEAR_MIPLINEAR = Engine.TEXTURE_NEAREST_LINEAR_MIPLINEAR;
+        /** mag = nearest and min = linear and mip = none */
+        public static readonly NEAREST_LINEAR = Engine.TEXTURE_NEAREST_LINEAR;
+        /** mag = nearest and min = nearest and mip = none */
+        public static readonly NEAREST_NEAREST = Engine.TEXTURE_NEAREST_NEAREST;
+        /** mag = linear and min = nearest and mip = nearest */
+        public static readonly LINEAR_NEAREST_MIPNEAREST = Engine.TEXTURE_LINEAR_NEAREST_MIPNEAREST;
+        /** mag = linear and min = nearest and mip = linear */
+        public static readonly LINEAR_NEAREST_MIPLINEAR = Engine.TEXTURE_LINEAR_NEAREST_MIPLINEAR;
+        /** mag = linear and min = linear and mip = none */
+        public static readonly LINEAR_LINEAR = Engine.TEXTURE_LINEAR_LINEAR;
+        /** mag = linear and min = nearest and mip = none */
+        public static readonly LINEAR_NEAREST = Engine.TEXTURE_LINEAR_NEAREST;
+
+        /** Explicit coordinates mode */
+        public static readonly EXPLICIT_MODE = Engine.TEXTURE_EXPLICIT_MODE;
+        /** Spherical coordinates mode */
+        public static readonly SPHERICAL_MODE = Engine.TEXTURE_SPHERICAL_MODE;
+        /** Planar coordinates mode */
+        public static readonly PLANAR_MODE = Engine.TEXTURE_PLANAR_MODE;
+        /** Cubic coordinates mode */
+        public static readonly CUBIC_MODE = Engine.TEXTURE_CUBIC_MODE;
+        /** Projection coordinates mode */
+        public static readonly PROJECTION_MODE = Engine.TEXTURE_PROJECTION_MODE;
+        /** Inverse Cubic coordinates mode */
+        public static readonly SKYBOX_MODE = Engine.TEXTURE_SKYBOX_MODE;
+        /** Inverse Cubic coordinates mode */
+        public static readonly INVCUBIC_MODE = Engine.TEXTURE_INVCUBIC_MODE;
+        /** Equirectangular coordinates mode */
+        public static readonly EQUIRECTANGULAR_MODE = Engine.TEXTURE_EQUIRECTANGULAR_MODE;
+        /** Equirectangular Fixed coordinates mode */
+        public static readonly FIXED_EQUIRECTANGULAR_MODE = Engine.TEXTURE_FIXED_EQUIRECTANGULAR_MODE;
+        /** Equirectangular Fixed Mirrored coordinates mode */
+        public static readonly FIXED_EQUIRECTANGULAR_MIRRORED_MODE = Engine.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE;
+
+        /** Texture is not repeating outside of 0..1 UVs */
         public static readonly CLAMP_ADDRESSMODE = Engine.TEXTURE_CLAMP_ADDRESSMODE;
+        /** Texture is repeating outside of 0..1 UVs */
         public static readonly WRAP_ADDRESSMODE = Engine.TEXTURE_WRAP_ADDRESSMODE;
+        /** Texture is repeating and mirrored */
         public static readonly MIRROR_ADDRESSMODE = Engine.TEXTURE_MIRROR_ADDRESSMODE;
 
         /**
@@ -40,28 +71,58 @@
          */
         public static UseSerializedUrlIfAny = false;
 
-        // Members
+        /**
+         * Define the url of the texture.
+         */
         @serialize()
         public url: Nullable<string>;
 
+        /**
+         * Define an offset on the texture to offset the u coordinates of the UVs
+         * @see http://doc.babylonjs.com/how_to/more_materials#offsetting
+         */
         @serialize()
         public uOffset = 0;
 
+        /**
+         * Define an offset on the texture to offset the v coordinates of the UVs
+         * @see http://doc.babylonjs.com/how_to/more_materials#offsetting
+         */
         @serialize()
         public vOffset = 0;
 
+        /**
+         * Define an offset on the texture to scale the u coordinates of the UVs
+         * @see http://doc.babylonjs.com/how_to/more_materials#tiling
+         */
         @serialize()
         public uScale = 1.0;
 
+        /**
+         * Define an offset on the texture to scale the v coordinates of the UVs
+         * @see http://doc.babylonjs.com/how_to/more_materials#tiling
+         */
         @serialize()
         public vScale = 1.0;
 
+        /**
+         * Define an offset on the texture to rotate around the u coordinates of the UVs
+         * @see http://doc.babylonjs.com/how_to/more_materials
+         */
         @serialize()
         public uAng = 0;
 
+        /**
+         * Define an offset on the texture to rotate around the v coordinates of the UVs
+         * @see http://doc.babylonjs.com/how_to/more_materials
+         */
         @serialize()
         public vAng = 0;
 
+        /**
+         * Define an offset on the texture to rotate around the w coordinates of the UVs (in case of 3d texture)
+         * @see http://doc.babylonjs.com/how_to/more_materials
+         */
         @serialize()
         public wAng = 0;
 
@@ -83,6 +144,9 @@
         @serialize()
         public wRotationCenter = 0.5;
 
+        /**
+         * Are mip maps generated for this texture or not.
+         */
         get noMipmap(): boolean {
             return this._noMipmap;
         }
@@ -114,9 +178,17 @@
         protected _format: Nullable<number>;
         private _delayedOnLoad: Nullable<() => void>;
         private _delayedOnError: Nullable<() => void>;
-        protected _onLoadObservable: Nullable<Observable<Texture>>;
+
+        /**
+         * Observable triggered once the texture has been loaded.
+         */
+        public onLoadObservable: Observable<Texture> = new Observable<Texture>();
 
         protected _isBlocking: boolean = true;
+        /**
+         * Is the texture preventing material to render while loading.
+         * If false, a default texture will be used instead of the loading one during the preparation step.
+         */
         public set isBlocking(value: boolean) {
             this._isBlocking = value;
         }
@@ -125,10 +197,28 @@
             return this._isBlocking;
         }
 
+        /**
+         * Get the current sampling mode associated with the texture.
+         */
         public get samplingMode(): number {
             return this._samplingMode;
         }
 
+        /**
+         * Instantiates a new texture.
+         * This represents a texture in babylon. It can be easily loaded from a network, base64 or html input.
+         * @see http://doc.babylonjs.com/babylon101/materials#texture
+         * @param url define the url of the picture to load as a texture
+         * @param scene define the scene the texture will belong to
+         * @param noMipmap define if the texture will require mip maps or not
+         * @param invertY define if the texture needs to be inverted on the y axis during loading
+         * @param samplingMode define the sampling mode we want for the texture while fectching from it (Texture.NEAREST_SAMPLINGMODE...)
+         * @param onLoad define a callback triggered when the texture has been loaded
+         * @param onError define a callback triggered when an error occurred during the loading session
+         * @param buffer define the buffer to load the texture from in case the texture is loaded from a buffer representation
+         * @param deleteBuffer define if the buffer we are loading the texture from should be deleted after load
+         * @param format define the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)
+         */
         constructor(url: Nullable<string>, scene: Nullable<Scene>, noMipmap: boolean = false, invertY: boolean = true, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE, onLoad: Nullable<() => void> = null, onError: Nullable<(message?: string, exception?: any) => void> = null, buffer: Nullable<string | ArrayBuffer | HTMLImageElement | Blob> = null, deleteBuffer: boolean = false, format?: number) {
             super(scene);
 
@@ -151,7 +241,7 @@
             scene.getEngine().onBeforeTextureInitObservable.notifyObservers(this);
 
             let load = () => {
-                if (this._onLoadObservable && this._onLoadObservable.hasObservers()) {
+                if (this.onLoadObservable.hasObservers()) {
                     this.onLoadObservable.notifyObservers(this);
                 }
                 if (onLoad) {
@@ -208,6 +298,10 @@
             this.delayLoad();
         }
 
+        /**
+         * Finish the loading sequence of a texture flagged as delayed load.
+         * @hidden
+         */
         public delayLoad(): void {
             if (this.delayLoadState !== Engine.DELAYLOADSTATE_NOTLOADED) {
                 return;
@@ -242,29 +336,29 @@
         }
 
         /**
-        * Default is Trilinear mode.
-        *
-        * | Value | Type               | Description |
-        * | ----- | ------------------ | ----------- |
-        * | 1     | NEAREST_SAMPLINGMODE or NEAREST_NEAREST_MIPLINEAR  | Nearest is: mag = nearest, min = nearest, mip = linear |
-        * | 2     | BILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPNEAREST | Bilinear is: mag = linear, min = linear, mip = nearest |
-        * | 3     | TRILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPLINEAR | Trilinear is: mag = linear, min = linear, mip = linear |
-        * | 4     | NEAREST_NEAREST_MIPNEAREST |             |
-        * | 5    | NEAREST_LINEAR_MIPNEAREST |             |
-        * | 6    | NEAREST_LINEAR_MIPLINEAR |             |
-        * | 7    | NEAREST_LINEAR |             |
-        * | 8    | NEAREST_NEAREST |             |
-        * | 9   | LINEAR_NEAREST_MIPNEAREST |             |
-        * | 10   | LINEAR_NEAREST_MIPLINEAR |             |
-        * | 11   | LINEAR_LINEAR |             |
-        * | 12   | LINEAR_NEAREST |             |
-        *
-        *    > _mag_: magnification filter (close to the viewer)
-        *    > _min_: minification filter (far from the viewer)
-        *    > _mip_: filter used between mip map levels
-        *
-        */
-
+          * Update the sampling mode of the texture.
+         * Default is Trilinear mode.
+         *
+         * | Value | Type               | Description |
+         * | ----- | ------------------ | ----------- |
+         * | 1     | NEAREST_SAMPLINGMODE or NEAREST_NEAREST_MIPLINEAR  | Nearest is: mag = nearest, min = nearest, mip = linear |
+         * | 2     | BILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPNEAREST | Bilinear is: mag = linear, min = linear, mip = nearest |
+         * | 3     | TRILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPLINEAR | Trilinear is: mag = linear, min = linear, mip = linear |
+         * | 4     | NEAREST_NEAREST_MIPNEAREST |             |
+         * | 5    | NEAREST_LINEAR_MIPNEAREST |             |
+         * | 6    | NEAREST_LINEAR_MIPLINEAR |             |
+         * | 7    | NEAREST_LINEAR |             |
+         * | 8    | NEAREST_NEAREST |             |
+         * | 9   | LINEAR_NEAREST_MIPNEAREST |             |
+         * | 10   | LINEAR_NEAREST_MIPLINEAR |             |
+         * | 11   | LINEAR_LINEAR |             |
+         * | 12   | LINEAR_NEAREST |             |
+         *
+         *    > _mag_: magnification filter (close to the viewer)
+         *    > _min_: minification filter (far from the viewer)
+         *    > _mip_: filter used between mip map levels
+         *@param samplingMode Define the new sampling mode of the texture
+         */
         public updateSamplingMode(samplingMode: number): void {
             if (!this._texture) {
                 return;
@@ -295,6 +389,10 @@
             t.z += this.wRotationCenter;
         }
 
+        /**
+         * Get the current texture matrix which includes the requested offsetting, tiling and rotation components.
+         * @returns the transform matrix of the texture.
+         */
         public getTextureMatrix(): Matrix {
             if (
                 this.uOffset === this._cachedUOffset &&
@@ -350,6 +448,10 @@
             return this._cachedTextureMatrix;
         }
 
+        /**
+         * Get the current matrix used to apply reflection. This is useful to rotate an environment texture for instance.
+         * @returns The reflection texture transform
+         */
         public getReflectionTextureMatrix(): Matrix {
             let scene = this.getScene();
 
@@ -421,19 +523,20 @@
             return this._cachedTextureMatrix;
         }
 
+        /**
+         * Clones the texture.
+         * @returns the cloned texture
+         */
         public clone(): Texture {
             return SerializationHelper.Clone(() => {
                 return new Texture(this._texture ? this._texture.url : null, this.getScene(), this._noMipmap, this._invertY, this._samplingMode);
             }, this);
         }
 
-        public get onLoadObservable(): Observable<Texture> {
-            if (!this._onLoadObservable) {
-                this._onLoadObservable = new Observable<Texture>();
-            }
-            return this._onLoadObservable;
-        }
-
+        /**
+         * Serialize the texture to a JSON representation we can easily use in the resepective Parse function.
+         * @returns The JSON representation of the texture
+         */
         public serialize(): any {
             var serializationObject = super.serialize();
 
@@ -448,28 +551,33 @@
             return serializationObject;
         }
 
+        /**
+         * Get the current class name of the texture usefull for serialization or dynamic coding.
+         * @returns "Texture"
+         */
         public getClassName(): string {
             return "Texture";
         }
 
+        /**
+         * Dispose the texture and release its associated resources.
+         */
         public dispose(): void {
             super.dispose();
 
-            if (this._onLoadObservable) {
-                this._onLoadObservable.clear();
-                this._onLoadObservable = null;
-            }
+            this.onLoadObservable.clear();
 
             this._delayedOnLoad = null;
             this._delayedOnError = null;
         }
 
-        // Statics
-        public static CreateFromBase64String(data: string, name: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE,
-            onLoad: Nullable<() => void> = null, onError: Nullable<() => void> = null, format: number = Engine.TEXTUREFORMAT_RGBA): Texture {
-            return new Texture("data:" + name, scene, noMipmap, invertY, samplingMode, onLoad, onError, data, false, format);
-        }
-
+        /**
+         * Parse the JSON representation of a texture in order to recreate the texture in the given scene.
+         * @param parsedTexture Define the JSON representation of the texture
+         * @param scene Define the scene the parsed texture should be instantiated in
+         * @param rootUrl Define the root url of the parsing sequence in the case of relative dependencies
+         * @returns The parsed texture if successful
+         */
         public static Parse(parsedTexture: any, scene: Scene, rootUrl: string): Nullable<BaseTexture> {
             if (parsedTexture.customType) {
                 var customTexture = Tools.Instantiate(parsedTexture.customType);
@@ -544,6 +652,39 @@
             return texture;
         }
 
+        /**
+         * Creates a texture from its base 64 representation.
+         * @param data Define the base64 payload without the data: prefix
+         * @param name Define the name of the texture in the scene useful fo caching purpose for instance
+         * @param scene Define the scene the texture should belong to
+         * @param noMipmap Forces the texture to not create mip map information if true
+         * @param invertY define if the texture needs to be inverted on the y axis during loading
+         * @param samplingMode define the sampling mode we want for the texture while fectching from it (Texture.NEAREST_SAMPLINGMODE...)
+         * @param onLoad define a callback triggered when the texture has been loaded
+         * @param onError define a callback triggered when an error occurred during the loading session
+         * @param format define the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)
+         * @returns the created texture
+         */
+        public static CreateFromBase64String(data: string, name: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE,
+            onLoad: Nullable<() => void> = null, onError: Nullable<() => void> = null, format: number = Engine.TEXTUREFORMAT_RGBA): Texture {
+            return new Texture("data:" + name, scene, noMipmap, invertY, samplingMode, onLoad, onError, data, false, format);
+        }
+
+        /**
+         * Creates a texture from its data: representation. (data: will be added in case only the payload has been passed in)
+         * @param data Define the base64 payload without the data: prefix
+         * @param name Define the name of the texture in the scene useful fo caching purpose for instance
+         * @param buffer define the buffer to load the texture from in case the texture is loaded from a buffer representation
+         * @param scene Define the scene the texture should belong to
+         * @param deleteBuffer define if the buffer we are loading the texture from should be deleted after load
+         * @param noMipmap Forces the texture to not create mip map information if true
+         * @param invertY define if the texture needs to be inverted on the y axis during loading
+         * @param samplingMode define the sampling mode we want for the texture while fectching from it (Texture.NEAREST_SAMPLINGMODE...)
+         * @param onLoad define a callback triggered when the texture has been loaded
+         * @param onError define a callback triggered when an error occurred during the loading session
+         * @param format define the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)
+         * @returns the created texture
+         */
         public static LoadFromDataString(name: string, buffer: any, scene: Scene, deleteBuffer: boolean = false, noMipmap: boolean = false, invertY: boolean = true, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE,
             onLoad: Nullable<() => void> = null, onError: Nullable<(message?: string, exception?: any) => void> = null, format: number = Engine.TEXTUREFORMAT_RGBA): Texture {
             if (name.substr(0, 5) !== "data:") {

+ 3 - 3
src/Materials/Textures/babylon.videoTexture.ts

@@ -191,7 +191,7 @@
                     if (!error) {
                         this.video.pause();
                     }
-                    if (this._onLoadObservable && this._onLoadObservable.hasObservers()) {
+                    if (this.onLoadObservable.hasObservers()) {
                         this.onLoadObservable.notifyObservers(this);
                     }
                 };
@@ -212,7 +212,7 @@
                     this.video.onplaying = oldHandler;
                     this._texture.isReady = true;
                     this._updateInternalTexture();
-                    if (this._onLoadObservable && this._onLoadObservable.hasObservers()) {
+                    if (this.onLoadObservable.hasObservers()) {
                         this.onLoadObservable.notifyObservers(this);
                     }
                 }
@@ -220,7 +220,7 @@
             else {
                 this._texture.isReady = true;
                 this._updateInternalTexture();
-                if (this._onLoadObservable && this._onLoadObservable.hasObservers()) {
+                if (this.onLoadObservable.hasObservers()) {
                     this.onLoadObservable.notifyObservers(this);
                 }
             }

+ 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);
         }