Forráskód Böngészése

Merge branch 'master' into mathDocs

Trevor Baron 7 éve
szülő
commit
f3f7652bce

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 3994 - 3118
Playground/babylon.d.txt


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 4035 - 3159
dist/preview release/babylon.d.ts


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 1
dist/preview release/babylon.js


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 952 - 315
dist/preview release/babylon.max.js


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 952 - 315
dist/preview release/babylon.no-module.max.js


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 1
dist/preview release/babylon.worker.js


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 954 - 317
dist/preview release/es6.js


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1377 - 2539
dist/preview release/typedocValidationBaseline.json


+ 19 - 5
dist/preview release/viewer/babylon.viewer.d.ts

@@ -168,11 +168,11 @@ declare module BabylonViewer {
                 * Mainly used for help and errors
                 * @param subScreen the name of the subScreen. Those can be defined in the configuration object
                 */
-            showOverlayScreen(subScreen: string): Promise<string> | Promise<Template>;
+            showOverlayScreen(subScreen: string): Promise<Template> | Promise<string>;
             /**
                 * Hide the overlay screen.
                 */
-            hideOverlayScreen(): Promise<string> | Promise<Template>;
+            hideOverlayScreen(): Promise<Template> | Promise<string>;
             /**
                 * show the viewer (in case it was hidden)
                 *
@@ -189,11 +189,11 @@ declare module BabylonViewer {
                 * Show the loading screen.
                 * The loading screen can be configured using the configuration object
                 */
-            showLoadingScreen(): Promise<string> | Promise<Template>;
+            showLoadingScreen(): Promise<Template> | Promise<string>;
             /**
                 * Hide the loading screen
                 */
-            hideLoadingScreen(): Promise<string> | Promise<Template>;
+            hideLoadingScreen(): Promise<Template> | Promise<string>;
             dispose(): void;
             protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
     }
@@ -924,7 +924,7 @@ declare module BabylonViewer {
       * @param name the name of the custom optimizer configuration
       * @param upgrade set to true if you want to upgrade optimizer and false if you want to degrade
       */
-    export function getCustomOptimizerByName(name: string, upgrade?: boolean): (sceneManager: SceneManager) => boolean;
+    export function getCustomOptimizerByName(name: string, upgrade?: boolean): typeof extendedUpgrade;
     export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
 }
 declare module BabylonViewer {
@@ -1558,6 +1558,20 @@ declare module BabylonViewer {
     export function addLoaderPlugin(name: string, plugin: ILoaderPlugin): void;
 }
 declare module BabylonViewer {
+    /**
+        * A custom upgrade-oriented function configuration for the scene optimizer.
+        *
+        * @param viewer the viewer to optimize
+        */
+    export function extendedUpgrade(sceneManager: SceneManager): boolean;
+    /**
+        * A custom degrade-oriented function configuration for the scene optimizer.
+        *
+        * @param viewer the viewer to optimize
+        */
+    export function extendedDegrade(sceneManager: SceneManager): boolean;
+}
+declare module BabylonViewer {
 }
 declare module BabylonViewer {
     export interface IEnvironmentMapConfiguration {

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 1
dist/preview release/viewer/babylon.viewer.js


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 1
dist/preview release/viewer/babylon.viewer.max.js


+ 22 - 5
dist/preview release/viewer/babylon.viewer.module.d.ts

@@ -200,11 +200,11 @@ declare module 'babylonjs-viewer/viewer/defaultViewer' {
                 * Mainly used for help and errors
                 * @param subScreen the name of the subScreen. Those can be defined in the configuration object
                 */
-            showOverlayScreen(subScreen: string): Promise<string> | Promise<Template>;
+            showOverlayScreen(subScreen: string): Promise<Template> | Promise<string>;
             /**
                 * Hide the overlay screen.
                 */
-            hideOverlayScreen(): Promise<string> | Promise<Template>;
+            hideOverlayScreen(): Promise<Template> | Promise<string>;
             /**
                 * show the viewer (in case it was hidden)
                 *
@@ -221,11 +221,11 @@ declare module 'babylonjs-viewer/viewer/defaultViewer' {
                 * Show the loading screen.
                 * The loading screen can be configured using the configuration object
                 */
-            showLoadingScreen(): Promise<string> | Promise<Template>;
+            showLoadingScreen(): Promise<Template> | Promise<string>;
             /**
                 * Hide the loading screen
                 */
-            hideLoadingScreen(): Promise<string> | Promise<Template>;
+            hideLoadingScreen(): Promise<Template> | Promise<string>;
             dispose(): void;
             protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
     }
@@ -985,13 +985,14 @@ declare module 'babylonjs-viewer/templating/viewerTemplatePlugin' {
 }
 
 declare module 'babylonjs-viewer/optimizer/custom' {
+    import { extendedUpgrade } from "babylonjs-viewer/optimizer/custom/extended";
     import { SceneManager } from "babylonjs-viewer/managers/sceneManager";
     /**
       *
       * @param name the name of the custom optimizer configuration
       * @param upgrade set to true if you want to upgrade optimizer and false if you want to degrade
       */
-    export function getCustomOptimizerByName(name: string, upgrade?: boolean): (sceneManager: SceneManager) => boolean;
+    export function getCustomOptimizerByName(name: string, upgrade?: boolean): typeof extendedUpgrade;
     export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
 }
 
@@ -1662,6 +1663,22 @@ declare module 'babylonjs-viewer/loader/plugins' {
     export function addLoaderPlugin(name: string, plugin: ILoaderPlugin): void;
 }
 
+declare module 'babylonjs-viewer/optimizer/custom/extended' {
+    import { SceneManager } from 'babylonjs-viewer/managers/sceneManager';
+    /**
+        * A custom upgrade-oriented function configuration for the scene optimizer.
+        *
+        * @param viewer the viewer to optimize
+        */
+    export function extendedUpgrade(sceneManager: SceneManager): boolean;
+    /**
+        * A custom degrade-oriented function configuration for the scene optimizer.
+        *
+        * @param viewer the viewer to optimize
+        */
+    export function extendedDegrade(sceneManager: SceneManager): boolean;
+}
+
 declare module 'babylonjs-viewer/configuration/interfaces' {
     export * from 'babylonjs-viewer/configuration/interfaces/cameraConfiguration';
     export * from 'babylonjs-viewer/configuration/interfaces/colorGradingConfiguration';

+ 2 - 4
dist/preview release/viewer/package.json

@@ -35,12 +35,10 @@
     "dependencies": {
         "deepmerge": "~2.1.1",
         "handlebars": "~4.0.11",
-        "pepjs": "~0.4.3"
-    },
-    "peerDependencies": {
+        "pepjs": "~0.4.3",
         "babylonjs": ">3.3.0-alpha",
         "babylonjs-loaders": ">3.3.0-alpha",
         "babylonjs-gltf2interface": ">3.3.0-alpha",
         "babylonjs-viewer-assets": ">3.3.0-alpha"
     }
-}
+}

+ 7 - 0
src/Materials/babylon.colorCurves.ts

@@ -314,6 +314,10 @@
             this._dirty = true;
         }
 
+        /**
+         * Returns the class name
+         * @returns The class name
+         */
         public getClassName(): string {
             return "ColorCurves";
         }
@@ -322,6 +326,9 @@
          * Binds the color curves to the shader.
          * @param colorCurves The color curve to bind
          * @param effect The effect to bind to
+         * @param positiveUniform The positive uniform shader parameter
+         * @param neutralUniform The neutral uniform shader parameter
+         * @param negativeUniform The negative uniform shader parameter
          */
         public static Bind(colorCurves: ColorCurves, effect: Effect, positiveUniform = "vCameraColorCurvePositive", neutralUniform = "vCameraColorCurveNeutral", negativeUniform = "vCameraColorCurveNegative"): void {
             if (colorCurves._dirty) {

+ 2 - 2
src/Mesh/babylon.mesh.ts

@@ -1238,7 +1238,7 @@
                         indexToBind = null;
                         break;
                     case Material.WireFrameFillMode:
-                        indexToBind = subMesh.getLinesIndexBuffer(<IndicesArray>this.getIndices(), engine);
+                        indexToBind = subMesh._getLinesIndexBuffer(<IndicesArray>this.getIndices(), engine);
                         break;
                     default:
                     case Material.TriangleFillMode:
@@ -1270,7 +1270,7 @@
                 engine.drawArraysType(fillMode, subMesh.verticesStart, subMesh.verticesCount, instancesCount);
             } else if (fillMode == Material.WireFrameFillMode) {
                 // Triangles as wireframe
-                engine.drawElementsType(fillMode, 0, subMesh.linesIndexCount, instancesCount);
+                engine.drawElementsType(fillMode, 0, subMesh._linesIndexCount, instancesCount);
             } else {
                 engine.drawElementsType(fillMode, subMesh.indexStart, subMesh.indexCount, instancesCount);
             }

+ 77 - 8
src/Mesh/babylon.meshSimplification.ts

@@ -1,6 +1,7 @@
 module BABYLON {
     /**
-     * A simplifier interface for future simplification implementations.
+     * A simplifier interface for future simplification implementations
+     * @see http://doc.babylonjs.com/how_to/in-browser_mesh_simplification
      */
     export interface ISimplifier {
         /**
@@ -16,40 +17,102 @@
 
     /**
      * Expected simplification settings.
-     * Quality should be between 0 and 1 (1 being 100%, 0 being 0%);
+     * Quality should be between 0 and 1 (1 being 100%, 0 being 0%)
+     * @see http://doc.babylonjs.com/how_to/in-browser_mesh_simplification
      */
     export interface ISimplificationSettings {
+        /**
+         * Gets or sets the expected quality
+         */
         quality: number;
+        /**
+         * Gets or sets the distance when this optimized version should be used
+         */
         distance: number;
+        /**
+         * Gets an already optimized mesh
+         */
         optimizeMesh?: boolean;
     }
 
+    /**
+     * Class used to specify simplification options
+     * @see http://doc.babylonjs.com/how_to/in-browser_mesh_simplification
+     */
     export class SimplificationSettings implements ISimplificationSettings {
-        constructor(public quality: number, public distance: number, public optimizeMesh?: boolean) {
+        /**
+         * Creates a SimplificationSettings
+         * @param quality expected quality
+         * @param distance distance when this optimized version should be used
+         * @param optimizeMesh already optimized mesh
+         */
+        constructor(
+            /** expected quality */
+            public quality: number, 
+            /** distance when this optimized version should be used */
+            public distance: number, 
+            /** already optimized mesh  */
+            public optimizeMesh?: boolean) {
         }
     }
 
+    /**
+     * Interface used to define a simplification task
+     */
     export interface ISimplificationTask {
+        /**
+         * Array of settings
+         */
         settings: Array<ISimplificationSettings>;
+        /**
+         * Simplification type
+         */
         simplificationType: SimplificationType;
+        /**
+         * Mesh to simplify
+         */
         mesh: Mesh;
+        /**
+         * Callback called on success
+         */
         successCallback?: () => void;
+        /**
+         * Defines if parallel processing can be used
+         */
         parallelProcessing: boolean;
     }
 
+    /**
+     * Queue used to order the simplification tasks
+     * @see http://doc.babylonjs.com/how_to/in-browser_mesh_simplification
+     */
     export class SimplificationQueue {
         private _simplificationArray: Array<ISimplificationTask>;
+
+        /**
+         * Gets a boolean indicating that the process is still running
+         */
         public running: boolean;
 
+        /**
+         * Creates a new queue
+         */
         constructor() {
             this.running = false;
             this._simplificationArray = [];
         }
 
+        /**
+         * Adds a new simplification task
+         * @param task defines a task to add
+         */
         public addTask(task: ISimplificationTask) {
             this._simplificationArray.push(task);
         }
 
+        /**
+         * Execute next task
+         */
         public executeNext() {
             var task = this._simplificationArray.pop();
             if (task) {
@@ -60,6 +123,10 @@
             }
         }
 
+        /**
+         * Execute a simplification task
+         * @param task defines the task to run
+         */
         public runSimplification(task: ISimplificationTask) {
             if (task.parallelProcessing) {
                 //parallel simplifier
@@ -115,13 +182,14 @@
     /**
      * The implemented types of simplification
      * At the moment only Quadratic Error Decimation is implemented
+     * @see http://doc.babylonjs.com/how_to/in-browser_mesh_simplification
      */
     export enum SimplificationType {
         /** Quadratic error decimation */
         QUADRATIC
     }
 
-    export class DecimationTriangle {
+     class DecimationTriangle {
         public normal: Vector3;
         public error: Array<number>;
         public deleted: boolean;
@@ -140,7 +208,7 @@
         }
     }
 
-    export class DecimationVertex {
+    class DecimationVertex {
         public q: QuadraticMatrix;
         public isBorder: boolean;
 
@@ -162,7 +230,7 @@
         }
     }
 
-    export class QuadraticMatrix {
+    class QuadraticMatrix {
         public data: Array<number>;
 
         constructor(data?: Array<number>) {
@@ -213,7 +281,7 @@
         }
     }
 
-    export class Reference {
+    class Reference {
         constructor(public vertexId: number, public triangleId: number) { }
     }
 
@@ -222,8 +290,9 @@
      * Original paper : http://www1.cs.columbia.edu/~cs4162/html05s/garland97.pdf
      * Ported mostly from QSlim and http://voxels.blogspot.de/2014/05/quadric-mesh-simplification-with-source.html to babylon JS
      * @author RaananW
+     * @see http://doc.babylonjs.com/how_to/in-browser_mesh_simplification
      */
-    export class QuadraticErrorSimplification implements ISimplifier {
+    class QuadraticErrorSimplification implements ISimplifier {
 
         private triangles: Array<DecimationTriangle>;
         private vertices: Array<DecimationVertex>;

+ 104 - 34
src/Mesh/babylon.subMesh.ts

@@ -1,14 +1,25 @@
 module BABYLON {
+    /**
+     * Base class for submeshes
+     */
     export class BaseSubMesh {
         /** @hidden */
         public _materialDefines: Nullable<MaterialDefines>;
         /** @hidden */
         public _materialEffect: Nullable<Effect>;
 
+        /**
+         * Gets associated effect
+         */
         public get effect(): Nullable<Effect> {
             return this._materialEffect;
         }
 
+        /**
+         * Sets associated effect (effect used to render this submesh)
+         * @param effect defines the effect to associate with
+         * @param defines defines the set of defines used to compile this effect
+         */
         public setEffect(effect: Nullable<Effect>, defines: Nullable<MaterialDefines> = null) {
             if (this._materialEffect === effect) {
                 if (!effect) {
@@ -21,9 +32,12 @@
         }
     }
 
+    /**
+     * Defines a subdivision inside a mesh
+     */
     export class SubMesh extends BaseSubMesh implements ICullable {
-        public linesIndexCount: number;
-
+        /** @hidden */
+        public _linesIndexCount: number;
         private _mesh: AbstractMesh;
         private _renderingMesh: Mesh;
         private _boundingInfo: BoundingInfo;
@@ -46,11 +60,44 @@
 
         private _currentMaterial: Nullable<Material>;
 
+        /**
+         * Add a new submesh to a mesh
+         * @param materialIndex defines the material index to use
+         * @param verticesStart defines vertex index start
+         * @param verticesCount defines vertices count
+         * @param indexStart defines index start
+         * @param indexCount defines indices count
+         * @param mesh defines the parent mesh
+         * @param renderingMesh defines an optional rendering mesh
+         * @param createBoundingBox defines if bounding box should be created for this submesh
+         * @returns the new submesh
+         */
         public static AddToMesh(materialIndex: number, verticesStart: number, verticesCount: number, indexStart: number, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh, createBoundingBox: boolean = true): SubMesh {
             return new SubMesh(materialIndex, verticesStart, verticesCount, indexStart, indexCount, mesh, renderingMesh, createBoundingBox);
         }
 
-        constructor(public materialIndex: number, public verticesStart: number, public verticesCount: number, public indexStart: number, public indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh, createBoundingBox: boolean = true) {
+        /**
+         * Creates a new submesh
+         * @param materialIndex defines the material index to use
+         * @param verticesStart defines vertex index start
+         * @param verticesCount defines vertices count
+         * @param indexStart defines index start
+         * @param indexCount defines indices count
+         * @param mesh defines the parent mesh
+         * @param renderingMesh defines an optional rendering mesh
+         * @param createBoundingBox defines if bounding box should be created for this submesh
+         */
+        constructor(
+            /** the material index to use */
+            public materialIndex: number, 
+            /** vertex index start */
+            public verticesStart: number, 
+            /** vertices count */
+            public verticesCount: number, 
+            /** index start */
+            public indexStart: number, 
+            /** indices count */
+            public indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh, createBoundingBox: boolean = true) {
             super();
             this._mesh = mesh;
             this._renderingMesh = renderingMesh || <Mesh>mesh;
@@ -66,12 +113,17 @@
             }
         }
 
+        /**
+         * Returns true if this submesh covers the entire parent mesh
+         * @ignorenaming
+         */
         public get IsGlobal(): boolean {
             return (this.verticesStart === 0 && this.verticesCount === this._mesh.getTotalVertices());
         }
 
         /**
-         * Returns the submesh BoudingInfo object.  
+         * Returns the submesh BoudingInfo object
+         * @returns current bounding info (or mesh's one if the submesh is global)
          */
         public getBoundingInfo(): BoundingInfo {
             if (this.IsGlobal) {
@@ -82,8 +134,9 @@
         }
 
         /**
-         * Sets the submesh BoundingInfo.  
-         * Return the SubMesh.  
+         * Sets the submesh BoundingInfo  
+         * @param boundingInfo defines the new bounding info to use
+         * @returns the SubMesh
          */
         public setBoundingInfo(boundingInfo: BoundingInfo): SubMesh {
             this._boundingInfo = boundingInfo;
@@ -91,21 +144,24 @@
         }
 
         /** 
-         * Returns the mesh of the current submesh.  
+         * Returns the mesh of the current submesh
+         * @return the parent mesh
          */
         public getMesh(): AbstractMesh {
             return this._mesh;
         }
 
         /**
-         * Returns the rendering mesh of the submesh.  
+         * Returns the rendering mesh of the submesh
+         * @returns the rendering mesh (could be different from parent mesh)
          */
         public getRenderingMesh(): Mesh {
             return this._renderingMesh;
         }
 
         /**
-         * Returns the submesh material.  
+         * Returns the submesh material
+         * @returns null or the current material
          */
         public getMaterial(): Nullable<Material> {
             var rootMaterial = this._renderingMesh.material;
@@ -128,9 +184,10 @@
         }
 
         // Methods
+
         /**
-         * Sets a new updated BoundingInfo object to the submesh.  
-         * Returns the SubMesh.  
+         * Sets a new updated BoundingInfo object to the submesh
+         * @returns the SubMesh 
          */
         public refreshBoundingInfo(): SubMesh {
             this._lastColliderWorldVertices = null;
@@ -169,8 +226,9 @@
         }
 
         /**
-         * Updates the submesh BoundingInfo.  
-         * Returns the Submesh.  
+         * Updates the submesh BoundingInfo
+         * @param world defines the world matrix to use to update the bounding info
+         * @returns the submesh
          */
         public updateBoundingInfo(world: Matrix): SubMesh {
             let boundingInfo = this.getBoundingInfo();
@@ -185,7 +243,8 @@
 
         /**
          * True is the submesh bounding box intersects the frustum defined by the passed array of planes.  
-         * Boolean returned.  
+         * @param frustumPlanes defines the frustum planes
+         * @returns true if the submesh is intersecting with the frustum  
          */
         public isInFrustum(frustumPlanes: Plane[]): boolean {
             let boundingInfo = this.getBoundingInfo();
@@ -197,8 +256,9 @@
         }
 
         /**
-         * True is the submesh bounding box is completely inside the frustum defined by the passed array of planes.  
-         * Boolean returned.  
+         * True is the submesh bounding box is completely inside the frustum defined by the passed array of planes
+         * @param frustumPlanes defines the frustum planes
+         * @returns true if the submesh is inside the frustum  
          */
         public isCompletelyInFrustum(frustumPlanes: Plane[]): boolean {
             let boundingInfo = this.getBoundingInfo();
@@ -210,8 +270,9 @@
         }
 
         /**
-         * Renders the submesh.  
-         * Returns it.  
+         * Renders the submesh  
+         * @param enableAlphaMode defines if alpha needs to be used
+         * @returns the submesh
          */
         public render(enableAlphaMode: boolean): SubMesh {
             this._renderingMesh.render(this, enableAlphaMode);
@@ -219,10 +280,9 @@
         }
 
         /**
-         * Returns a new Index Buffer.  
-         * Type returned : WebGLBuffer.  
+         * @hidden 
          */
-        public getLinesIndexBuffer(indices: IndicesArray, engine: Engine): WebGLBuffer {
+        public _getLinesIndexBuffer(indices: IndicesArray, engine: Engine): WebGLBuffer {
             if (!this._linesIndexBuffer) {
                 var linesIndices = [];
 
@@ -233,14 +293,15 @@
                 }
 
                 this._linesIndexBuffer = engine.createIndexBuffer(linesIndices);
-                this.linesIndexCount = linesIndices.length;
+                this._linesIndexCount = linesIndices.length;
             }
             return this._linesIndexBuffer;
         }
 
         /**
-         * True is the passed Ray intersects the submesh bounding box.  
-         * Boolean returned.  
+         * Checks if the submesh intersects with a ray
+         * @param ray defines the ray to test
+         * @returns true is the passed ray intersects the submesh bounding box
          */
         public canIntersects(ray: Ray): boolean {
             let boundingInfo = this.getBoundingInfo();
@@ -252,7 +313,12 @@
         }
 
         /**
-         * Returns an object IntersectionInfo.  
+         * Intersects current submesh with a ray
+         * @param ray defines the ray to test
+         * @param positions defines mesh's positions array
+         * @param indices defines mesh's indices array
+         * @param fastCheck defines if only bounding info should be used
+         * @returns intersection info or null if no intersection
          */
         public intersects(ray: Ray, positions: Vector3[], indices: IndicesArray, fastCheck?: boolean): Nullable<IntersectionInfo> {
             var intersectInfo: Nullable<IntersectionInfo> = null;
@@ -333,7 +399,10 @@
 
         // Clone    
         /**
-         * Creates a new Submesh from the passed Mesh.  
+         * Creates a new submesh from the passed mesh
+         * @param newMesh defines the new hosting mesh
+         * @param newRenderingMesh defines an optional rendering mesh
+         * @returns the new submesh
          */
         public clone(newMesh: AbstractMesh, newRenderingMesh?: Mesh): SubMesh {
             var result = new SubMesh(this.materialIndex, this.verticesStart, this.verticesCount, this.indexStart, this.indexCount, newMesh, newRenderingMesh, false);
@@ -352,9 +421,9 @@
         }
 
         // Dispose
+
         /**
-         * Disposes the Submesh.  
-         * Returns nothing.  
+         * Release associated resources
          */
         public dispose(): void {
             if (this._linesIndexBuffer) {
@@ -369,12 +438,13 @@
 
         // Statics
         /**
-         * Creates a new Submesh from the passed parameters : 
-         * - materialIndex (integer) : the index of the main mesh material.  
-         * - startIndex (integer) : the index where to start the copy in the mesh indices array.  
-         * - indexCount (integer) : the number of indices to copy then from the startIndex.  
-         * - mesh (Mesh) : the main mesh to create the submesh from.  
-         * - renderingMesh (optional Mesh) : rendering mesh.  
+         * Creates a new submesh from indices data
+         * @param materialIndex the index of the main mesh material
+         * @param startIndex the index where to start the copy in the mesh indices array
+         * @param indexCount the number of indices to copy then from the startIndex
+         * @param mesh the main mesh to create the submesh from
+         * @param renderingMesh the optional rendering mesh
+         * @returns a new submesh
          */
         public static CreateFromIndices(materialIndex: number, startIndex: number, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh): SubMesh {
             var minVertexIndex = Number.MAX_VALUE;

+ 16 - 13
src/PostProcess/babylon.colorCorrectionPostProcess.ts

@@ -1,18 +1,21 @@
-//
-//  This post-process allows the modification of rendered colors by using
-//  a 'look-up table' (LUT). This effect is also called Color Grading.
-// 
-//  The object needs to be provided an url to a texture containing the color
-//  look-up table: the texture must be 256 pixels wide and 16 pixels high.
-//  Use an image editing software to tweak the LUT to match your needs.
-// 
-//  For an example of a color LUT, see here:
-//      http://udn.epicgames.com/Three/rsrc/Three/ColorGrading/RGBTable16x1.png
-//  For explanations on color grading, see here:
-//      http://udn.epicgames.com/Three/ColorGrading.html
-//
+
 
 module BABYLON {
+    /**
+     * 
+     * This post-process allows the modification of rendered colors by using
+     * a 'look-up table' (LUT). This effect is also called Color Grading.
+     *
+     * The object needs to be provided an url to a texture containing the color
+     * look-up table: the texture must be 256 pixels wide and 16 pixels high.
+     * Use an image editing software to tweak the LUT to match your needs.
+     * 
+     * For an example of a color LUT, see here:
+     * @see http://udn.epicgames.com/Three/rsrc/Three/ColorGrading/RGBTable16x1.png
+     * For explanations on color grading, see here:
+     * @see http://udn.epicgames.com/Three/ColorGrading.html
+     *
+     */
     export class ColorCorrectionPostProcess extends PostProcess {
 
         private _colorTableTexture: Texture;

+ 11 - 0
src/Tools/babylon.dds.ts

@@ -141,9 +141,20 @@
         sphericalPolynomial?: SphericalPolynomial;
     };
 
+    /**
+     * Class used to provide DDS decompression tools
+     */
     export class DDSTools {
+        /**
+         * Gets or sets a boolean indicating that LOD info is stored in alpha channel (false by default)
+         */
         public static StoreLODInAlphaChannel = false;
 
+        /**
+         * Gets DDS information from an array buffer
+         * @param arrayBuffer defines the array buffer to read data from
+         * @returns the DDS information
+         */
         public static GetDDSInfo(arrayBuffer: any): DDSInfo {
             var header = new Int32Array(arrayBuffer, 0, headerLengthInt);
             var extendedHeader = new Int32Array(arrayBuffer, 0, headerLengthInt + 4);

+ 35 - 0
src/Tools/babylon.filesInput.ts

@@ -1,7 +1,16 @@
 module BABYLON {
+    /**
+     * Class used to help managing file picking and drag'n'drop
+     */
     export class FilesInput {
+        /**
+         * List of files ready to be loaded
+         */
         public static FilesToLoad: { [key: string]: File } = {};
 
+        /**
+         * Callback called when a file is processed
+         */
         public onProcessFileCallback: (file: File, name: string, extension: string) => true = () => { return true; };
 
         private _engine: Engine;
@@ -18,6 +27,18 @@
         private _sceneFileToLoad: File;
         private _filesToLoad: File[];
 
+        /**
+         * Creates a new FilesInput
+         * @param engine defines the rendering engine
+         * @param scene defines the hosting scene
+         * @param sceneLoadedCallback callback called when scene is loaded
+         * @param progressCallback callback called to track progress
+         * @param additionalRenderLoopLogicCallback callback called to add user logic to the rendering loop
+         * @param textureLoadingCallback callback called when a texture is loading
+         * @param startingProcessingFilesCallback callback called when the system is about to process all files
+         * @param onReloadCallback callback called when a reload is requested
+         * @param errorCallback callback call if an error occurs
+         */
         constructor(engine: Engine, scene: Scene, sceneLoadedCallback: (sceneFile: File, scene: Scene) => void, progressCallback: (progress: SceneLoaderProgressEvent) => void, additionalRenderLoopLogicCallback: () => void, 
             textureLoadingCallback: (remaining: number) => void, startingProcessingFilesCallback: (files?: File[]) => void, onReloadCallback: (sceneFile: File) => void, errorCallback: (sceneFile: File, scene: Scene, message: string) => void) {
             this._engine = engine;
@@ -36,6 +57,10 @@
         private _dragOverHandler: (e: any) => void;
         private _dropHandler: (e: any) => void;
 
+        /**
+         * Calls this function to listen to drag'n'drop events on a specific DOM element
+         * @param elementToMonitor defines the DOM element to track
+         */
         public monitorElementForDragNDrop(elementToMonitor: HTMLElement): void {
             if (elementToMonitor) {
                 this._elementToMonitor = elementToMonitor;
@@ -50,6 +75,9 @@
             }
         }
 
+        /**
+         * Release all associated resources
+         */
         public dispose() {
             if (!this._elementToMonitor) {
                 return;
@@ -134,6 +162,10 @@
             }
         }
 
+        /**
+         * Load files from a drop event
+         * @param event defines the drop event to use as source
+         */
         public loadFiles(event: any): void {
             // Handling data transfer via drag'n'drop
             if (event && event.dataTransfer && event.dataTransfer.files) {
@@ -214,6 +246,9 @@
             }
         }
 
+        /**
+         * Reload the current scene from the loaded files
+         */
         public reload() {
             // If a scene file has been provided
             if (this._sceneFileToLoad) {

+ 74 - 25
src/Tools/babylon.khronosTextureContainer.ts

@@ -4,36 +4,79 @@ module BABYLON {
      * for file layout see https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/
      */
     export class KhronosTextureContainer {
-        static HEADER_LEN = 12 + (13 * 4); // identifier + header elements (not including key value meta-data pairs)
+        private static HEADER_LEN = 12 + (13 * 4); // identifier + header elements (not including key value meta-data pairs)
 
         // load types
-        static COMPRESSED_2D = 0; // uses a gl.compressedTexImage2D()
-        static COMPRESSED_3D = 1; // uses a gl.compressedTexImage3D()
-        static TEX_2D = 2; // uses a gl.texImage2D()
-        static TEX_3D = 3; // uses a gl.texImage3D()
+        private static COMPRESSED_2D = 0; // uses a gl.compressedTexImage2D()
+        private static COMPRESSED_3D = 1; // uses a gl.compressedTexImage3D()
+        private static TEX_2D = 2; // uses a gl.texImage2D()
+        private static TEX_3D = 3; // uses a gl.texImage3D()
 
         // elements of the header 
+        /**
+         * Gets the openGL type
+         */
         public glType: number;
+        /**
+         * Gets the openGL type size
+         */
         public glTypeSize: number;
+        /**
+         * Gets the openGL format
+         */
         public glFormat: number;
+        /**
+         * Gets the openGL internal format
+         */
         public glInternalFormat: number;
+        /**
+         * Gets the base internal format
+         */
         public glBaseInternalFormat: number;
+        /**
+         * Gets image width in pixel
+         */
         public pixelWidth: number;
+        /**
+         * Gets image height in pixel
+         */
         public pixelHeight: number;
+        /**
+         * Gets image depth in pixels
+         */
         public pixelDepth: number;
+        /**
+         * Gets the number of array elements
+         */
         public numberOfArrayElements: number;
+        /**
+         * Gets the number of faces
+         */
         public numberOfFaces: number;
+        /**
+         * Gets the number of mipmap levels
+         */
         public numberOfMipmapLevels: number;
+        /**
+         * Gets the bytes of key value data
+         */
         public bytesOfKeyValueData: number;
-
+        /**
+         * Gets the load type
+         */
         public loadType: number;
+
+
         /**
-         * @param {ArrayBuffer} arrayBuffer- contents of the KTX container file
-         * @param {number} facesExpected- should be either 1 or 6, based whether a cube texture or or
-         * @param {boolean} threeDExpected- provision for indicating that data should be a 3D texture, not implemented
-         * @param {boolean} textureArrayExpected- provision for indicating that data should be a texture array, not implemented
+         * Creates a new KhronosTextureContainer
+         * @param arrayBuffer contents of the KTX container file
+         * @param facesExpected should be either 1 or 6, based whether a cube texture or or
+         * @param threeDExpected provision for indicating that data should be a 3D texture, not implemented
+         * @param textureArrayExpected provision for indicating that data should be a texture array, not implemented
          */
-        public constructor(public arrayBuffer: any, facesExpected: number, threeDExpected?: boolean, textureArrayExpected?: boolean) {
+        public constructor(
+            /** contents of the KTX container file */
+            public arrayBuffer: any, facesExpected: number, threeDExpected?: boolean, textureArrayExpected?: boolean) {
             // Test that it is a ktx formatted file, based on the first 12 bytes, character representation is:
             // '�', 'K', 'T', 'X', ' ', '1', '1', '�', '\r', '\n', '\x1A', '\n'
             // 0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A
@@ -51,18 +94,18 @@ module BABYLON {
             var oppositeEndianess = header[0] === 0x01020304;
 
             // read all the header elements in order they exist in the file, without modification (sans endainness)
-            this.glType = oppositeEndianess ? this.switchEndainness(header[1]) : header[1]; // must be 0 for compressed textures
-            this.glTypeSize = oppositeEndianess ? this.switchEndainness(header[2]) : header[2]; // must be 1 for compressed textures
-            this.glFormat = oppositeEndianess ? this.switchEndainness(header[3]) : header[3]; // must be 0 for compressed textures
-            this.glInternalFormat = oppositeEndianess ? this.switchEndainness(header[4]) : header[4]; // the value of arg passed to gl.compressedTexImage2D(,,x,,,,)
-            this.glBaseInternalFormat = oppositeEndianess ? this.switchEndainness(header[5]) : header[5]; // specify GL_RGB, GL_RGBA, GL_ALPHA, etc (un-compressed only)
-            this.pixelWidth = oppositeEndianess ? this.switchEndainness(header[6]) : header[6]; // level 0 value of arg passed to gl.compressedTexImage2D(,,,x,,,)
-            this.pixelHeight = oppositeEndianess ? this.switchEndainness(header[7]) : header[7]; // level 0 value of arg passed to gl.compressedTexImage2D(,,,,x,,)
-            this.pixelDepth = oppositeEndianess ? this.switchEndainness(header[8]) : header[8]; // level 0 value of arg passed to gl.compressedTexImage3D(,,,,,x,,)
-            this.numberOfArrayElements = oppositeEndianess ? this.switchEndainness(header[9]) : header[9]; // used for texture arrays
-            this.numberOfFaces = oppositeEndianess ? this.switchEndainness(header[10]) : header[10]; // used for cubemap textures, should either be 1 or 6
-            this.numberOfMipmapLevels = oppositeEndianess ? this.switchEndainness(header[11]) : header[11]; // number of levels; disregard possibility of 0 for compressed textures
-            this.bytesOfKeyValueData = oppositeEndianess ? this.switchEndainness(header[12]) : header[12]; // the amount of space after the header for meta-data
+            this.glType = oppositeEndianess ? this.switchEndianness(header[1]) : header[1]; // must be 0 for compressed textures
+            this.glTypeSize = oppositeEndianess ? this.switchEndianness(header[2]) : header[2]; // must be 1 for compressed textures
+            this.glFormat = oppositeEndianess ? this.switchEndianness(header[3]) : header[3]; // must be 0 for compressed textures
+            this.glInternalFormat = oppositeEndianess ? this.switchEndianness(header[4]) : header[4]; // the value of arg passed to gl.compressedTexImage2D(,,x,,,,)
+            this.glBaseInternalFormat = oppositeEndianess ? this.switchEndianness(header[5]) : header[5]; // specify GL_RGB, GL_RGBA, GL_ALPHA, etc (un-compressed only)
+            this.pixelWidth = oppositeEndianess ? this.switchEndianness(header[6]) : header[6]; // level 0 value of arg passed to gl.compressedTexImage2D(,,,x,,,)
+            this.pixelHeight = oppositeEndianess ? this.switchEndianness(header[7]) : header[7]; // level 0 value of arg passed to gl.compressedTexImage2D(,,,,x,,)
+            this.pixelDepth = oppositeEndianess ? this.switchEndianness(header[8]) : header[8]; // level 0 value of arg passed to gl.compressedTexImage3D(,,,,,x,,)
+            this.numberOfArrayElements = oppositeEndianess ? this.switchEndianness(header[9]) : header[9]; // used for texture arrays
+            this.numberOfFaces = oppositeEndianess ? this.switchEndianness(header[10]) : header[10]; // used for cubemap textures, should either be 1 or 6
+            this.numberOfMipmapLevels = oppositeEndianess ? this.switchEndianness(header[11]) : header[11]; // number of levels; disregard possibility of 0 for compressed textures
+            this.bytesOfKeyValueData = oppositeEndianess ? this.switchEndianness(header[12]) : header[12]; // the amount of space after the header for meta-data
 
             // Make sure we have a compressed type.  Not only reduces work, but probably better to let dev know they are not compressing.
             if (this.glType !== 0) {
@@ -93,8 +136,14 @@ module BABYLON {
             this.loadType = KhronosTextureContainer.COMPRESSED_2D;
         }
 
-        // not as fast hardware based, but will probably never need to use
-        public switchEndainness(val: number): number {
+        // 
+        /**
+         * Revert the endianness of a value.
+         * Not as fast hardware based, but will probably never need to use
+         * @param val defines the value to convert
+         * @returns the new value
+         */
+        public switchEndianness(val: number): number {
             return ((val & 0xFF) << 24)
                 | ((val & 0xFF00) << 8)
                 | ((val >> 8) & 0xFF00)

+ 0 - 7
src/Tools/babylon.performanceMonitor.ts

@@ -34,7 +34,6 @@ module BABYLON {
 
 		/**
 		 * Returns the average frame time in milliseconds over the sliding window (or the subset of frames sampled so far)
-		 * @return Average frame time in milliseconds
 		 */
         public get averageFrameTime(): number {
             return this._rollingFrameTime.average;
@@ -42,7 +41,6 @@ module BABYLON {
 
 		/**
 		 * Returns the variance frame time in milliseconds over the sliding window (or the subset of frames sampled so far)
-		 * @return Frame time variance in milliseconds squared
 		 */
         public get averageFrameTimeVariance(): number {
             return this._rollingFrameTime.variance;
@@ -50,7 +48,6 @@ module BABYLON {
 
 		/**
 		 * Returns the frame time of the most recent frame
-		 * @return Frame time in milliseconds
 		 */
         public get instantaneousFrameTime(): number {
             return this._rollingFrameTime.history(0);
@@ -58,7 +55,6 @@ module BABYLON {
 
 		/**
 		 * Returns the average framerate in frames per second over the sliding window (or the subset of frames sampled so far)
-		 * @return Framerate in frames per second
 		 */
         public get averageFPS(): number {
             return 1000.0 / this._rollingFrameTime.average;
@@ -66,7 +62,6 @@ module BABYLON {
 
 		/**
 		 * Returns the average framerate in frames per second using the most recent frame time
-		 * @return Framerate in frames per second
 		 */
         public get instantaneousFPS(): number {
             let history = this._rollingFrameTime.history(0);
@@ -80,7 +75,6 @@ module BABYLON {
 
 		/**
 		 * Returns true if enough samples have been taken to completely fill the sliding window
-		 * @return true if saturated
 		 */
         public get isSaturated(): boolean {
             return this._rollingFrameTime.isSaturated();
@@ -105,7 +99,6 @@ module BABYLON {
 
 		/**
 		 * Returns true if sampling is enabled
-		 * @return true if enabled
 		 */
         public get isEnabled(): boolean {
             return this._enabled;

+ 18 - 0
src/Tools/babylon.sceneSerializer.ts

@@ -115,11 +115,22 @@
         }
     }
 
+    /**
+     * Class used to serialize a scene into a string
+     */
     export class SceneSerializer {
+        /**
+         * Clear cache used by a previous serialization
+         */
         public static ClearCache(): void {
             serializedGeometries = [];
         }
 
+        /**
+         * Serialize a scene into a JSON compatible object
+         * @param scene defines the scene to serialize
+         * @returns a JSON compatible object
+         */
         public static Serialize(scene: Scene): any {
             var serializationObject: any = {};
 
@@ -292,6 +303,13 @@
             return serializationObject;
         }
 
+        /**
+         * Serialize a mesh into a JSON compatible object
+         * @param toSerialize defines the mesh to serialize
+         * @param withParents defines if parents must be serialized as well
+         * @param withChildren defines if children must be serialized as well
+         * @returns a JSON compatible object
+         */
         public static SerializeMesh(toSerialize: any /* Mesh || Mesh[] */, withParents: boolean = false, withChildren: boolean = false): any {
             var serializationObject: any = {};
 

+ 45 - 3
src/Tools/babylon.tags.ts

@@ -1,5 +1,12 @@
 module BABYLON {
+    /**
+     * Class used to store custom tags 
+     */
     export class Tags {
+        /**
+         * Adds support for tags on the given object
+         * @param obj defines the object to use
+         */
         public static EnableFor(obj: any): void {
             obj._tags = obj._tags || {};
 
@@ -20,6 +27,10 @@
             };
         }
 
+        /**
+         * Removes tags support
+         * @param obj defines the object to use
+         */
         public static DisableFor(obj: any): void {
             delete obj._tags;
             delete obj.hasTags;
@@ -28,6 +39,11 @@
             delete obj.matchesTagsQuery;
         }
 
+        /**
+         * Gets a boolean indicating if the given object has tags
+         * @param obj defines the object to use
+         * @returns a boolean
+         */
         public static HasTags(obj: any): boolean {
             if (!obj._tags) {
                 return false;
@@ -35,6 +51,12 @@
             return !Tools.IsEmpty(obj._tags);
         }
 
+        /**
+         * Gets the tags available on a given object
+         * @param obj defines the object to use
+         * @param asString defines if the tags must be returned as a string instead of an array of strings
+         * @returns the tags
+         */
         public static GetTags(obj: any, asString: boolean = true): any {
             if (!obj._tags) {
                 return null;
@@ -53,9 +75,12 @@
 
         }
 
-        // the tags 'true' and 'false' are reserved and cannot be used as tags
-        // a tag cannot start with '||', '&&', and '!'
-        // it cannot contain whitespaces
+        /**
+         * Adds tags to an object
+         * @param obj defines the object to use
+         * @param tagsString defines the tag string. The tags 'true' and 'false' are reserved and cannot be used as tags.
+         * A tag cannot start with '||', '&&', and '!'. It cannot contain whitespaces
+         */
         public static AddTagsTo(obj: any, tagsString: string): void {
             if (!tagsString) {
                 return;
@@ -71,6 +96,9 @@
             });
         }
 
+        /**
+         * @hidden
+         */
         public static _AddTagTo(obj: any, tag: string): void {
             tag = tag.trim();
 
@@ -86,6 +114,11 @@
             obj._tags[tag] = true;
         }
 
+        /**
+         * Removes specific tags from a specific object
+         * @param obj defines the object to use
+         * @param tagsString defines the tags to remove
+         */
         public static RemoveTagsFrom(obj: any, tagsString: string) {
             if (!Tags.HasTags(obj)) {
                 return;
@@ -96,10 +129,19 @@
             }
         }
 
+        /**
+         * @hidden
+         */        
         public static _RemoveTagFrom(obj: any, tag: string): void {
             delete obj._tags[tag];
         }
 
+        /**
+         * Defines if tags hosted on an object match a given query
+         * @param obj defines the object to use
+         * @param tagsQuery defines the tag query
+         * @returns a boolean
+         */
         public static MatchesQuery(obj: any, tagsQuery: string): boolean {
             if (tagsQuery === undefined) {
                 return true;

+ 12 - 3
src/Tools/babylon.textureTools.ts

@@ -1,11 +1,15 @@
 module BABYLON {
+    /**
+     * Class used to host texture specific utilities
+     */
     export class TextureTools {
 		/**
 		 * Uses the GPU to create a copy texture rescaled at a given size
 		 * @param texture Texture to copy from
-		 * @param width Desired width
-		 * @param height Desired height
-		 * @return Generated texture
+		 * @param width defines the desired width
+		 * @param height defines the desired height
+         * @param useBilinearMode defines if bilinear mode has to be used
+		 * @return the generated texture
 		 */
         public static CreateResizedCopy(texture: Texture, width: number, height: number, useBilinearMode: boolean = true): Texture {
 
@@ -63,6 +67,11 @@
             return rtt;
         }
 
+        /**
+         * Gets an environment BRDF texture for a given scene
+         * @param scene defines the hosting scene
+         * @returns the environment BRDF texture
+         */
         public static GetEnvironmentBRDFTexture(scene: Scene): BaseTexture {
             if (!scene._environmentBRDFTexture) {
                 var texture = Texture.CreateFromBase64String(this._environmentBRDFBase64Texture, "EnvironmentBRDFTexture", scene, true, false, Texture.BILINEAR_SAMPLINGMODE);

+ 16 - 5
src/Tools/babylon.tga.ts

@@ -1,9 +1,9 @@
 module BABYLON {
-    /*
-    * Based on jsTGALoader - Javascript loader for TGA file
-    * By Vincent Thibault
-    * @blog http://blog.robrowser.com/javascript-tga-loader.html
-    */
+    /**
+     * Based on jsTGALoader - Javascript loader for TGA file
+     * By Vincent Thibault
+     * @see http://blog.robrowser.com/javascript-tga-loader.html
+     */
     export class TGATools {
 
         //private static _TYPE_NO_DATA = 0;
@@ -20,6 +20,11 @@
         private static _ORIGIN_UL = 0x02;
         private static _ORIGIN_UR = 0x03;
 
+        /**
+         * Gets the header of a TGA file
+         * @param data defines the TGA data
+         * @returns the header
+         */
         public static GetTGAHeader(data: Uint8Array): any {
             var offset = 0;
 
@@ -199,6 +204,7 @@
             engine._uploadDataToTextureDirectly(texture, imageData);
         }
 
+        /** @hidden */
         static _getImageData8bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array {
             var image = pixel_data, colormap = palettes;
             var width = header.width, height = header.height;
@@ -219,6 +225,7 @@
             return imageData;
         }
 
+        /** @hidden */
         static _getImageData16bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array {
             var image = pixel_data;
             var width = header.width, height = header.height;
@@ -243,6 +250,7 @@
             return imageData;
         }
 
+        /** @hidden */
         static _getImageData24bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array {
             var image = pixel_data;
             var width = header.width, height = header.height;
@@ -262,6 +270,7 @@
             return imageData;
         }
 
+        /** @hidden */
         static _getImageData32bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array {
             var image = pixel_data;
             var width = header.width, height = header.height;
@@ -281,6 +290,7 @@
             return imageData;
         }
 
+        /** @hidden */
         static _getImageDataGrey8bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array {
             var image = pixel_data;
             var width = header.width, height = header.height;
@@ -301,6 +311,7 @@
             return imageData;
         }
 
+        /** @hidden */
         static _getImageDataGrey16bits(header: any, palettes: Uint8Array, pixel_data: Uint8Array, y_start: number, y_step: number, y_end: number, x_start: number, x_step: number, x_end: number): Uint8Array {
             var image = pixel_data;
             var width = header.width, height = header.height;

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 355 - 159
src/Tools/babylon.tools.ts