ソースを参照

No more internals

Raanan Weber 7 年 前
コミット
f4d7dba7a8

+ 16 - 16
src/Engine/babylon.engine.ts

@@ -744,9 +744,9 @@
         }
 
         // States
-        protected _depthCullingState = new Internals._DepthCullingState();
-        protected _stencilState = new Internals._StencilState();
-        protected _alphaState = new Internals._AlphaState();
+        protected _depthCullingState = new _DepthCullingState();
+        protected _stencilState = new _StencilState();
+        protected _alphaState = new _AlphaState();
         protected _alphaMode = Engine.ALPHA_DISABLE;
 
         // Cache
@@ -3111,7 +3111,7 @@
             if (isKTX || isTGA || isDDS) {
                 if (isKTX) {
                     callback = (data) => {
-                        var ktx = new Internals.KhronosTextureContainer(data, 1);
+                        var ktx = new KhronosTextureContainer(data, 1);
 
                         this._prepareWebGLTexture(texture, scene, ktx.pixelWidth, ktx.pixelHeight, invertY, false, true, () => {
                             ktx.uploadLevels(this._gl, !noMipmap);
@@ -3122,21 +3122,21 @@
                     callback = (arrayBuffer) => {
                         var data = new Uint8Array(arrayBuffer);
 
-                        var header = Internals.TGATools.GetTGAHeader(data);
+                        var header = TGATools.GetTGAHeader(data);
 
                         this._prepareWebGLTexture(texture, scene, header.width, header.height, invertY, noMipmap, false, () => {
-                            Internals.TGATools.UploadContent(this._gl, data);
+                            TGATools.UploadContent(this._gl, data);
                             return false;
                         }, samplingMode);
                     };
 
                 } else if (isDDS) {
                     callback = (data) => {
-                        var info = Internals.DDSTools.GetDDSInfo(data);
+                        var info = DDSTools.GetDDSInfo(data);
 
                         var loadMipmap = (info.isRGB || info.isLuminance || info.mipmapCount > 1) && !noMipmap && ((info.width >> (info.mipmapCount - 1)) === 1);
                         this._prepareWebGLTexture(texture, scene, info.width, info.height, invertY, !loadMipmap, info.isFourCC, () => {
-                            Internals.DDSTools.UploadDDSLevels(this, this._gl, data, info, loadMipmap, 1);
+                            DDSTools.UploadDDSLevels(this, this._gl, data, info, loadMipmap, 1);
                             return false;
                         }, samplingMode);
                     };
@@ -3942,11 +3942,11 @@
                     gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
 
                     if (loadData.isDDS) {
-                        var info: Internals.DDSInfo = loadData.info;
+                        var info: DDSInfo = loadData.info;
                         var data: any = loadData.data;
                         gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, info.isCompressed ? 1 : 0);
 
-                        Internals.DDSTools.UploadDDSLevels(this, this._gl, data, info, true, 6, mipmapIndex);
+                        DDSTools.UploadDDSLevels(this, this._gl, data, info, true, 6, mipmapIndex);
                     }
                     else {
                         Tools.Warn("DDS is the only prefiltered cube map supported so far.")
@@ -4008,7 +4008,7 @@
 
             if (isKTX) {
                 Tools.LoadFile(rootUrl, data => {
-                    var ktx = new Internals.KhronosTextureContainer(data, 6);
+                    var ktx = new KhronosTextureContainer(data, 6);
 
                     var loadMipmap = ktx.numberOfMipmapLevels > 1 && !noMipmap;
 
@@ -4028,19 +4028,19 @@
                     cascadeLoadFiles(rootUrl,
                         scene,
                         imgs => {
-                            var info: Internals.DDSInfo | undefined;
+                            var info: DDSInfo | undefined;
                             var loadMipmap: boolean = false;
                             var width: number = 0;
                             for (let index = 0; index < imgs.length; index++) {
                                 let data = imgs[index];
-                                info = Internals.DDSTools.GetDDSInfo(data);
+                                info = DDSTools.GetDDSInfo(data);
 
                                 loadMipmap = (info.isRGB || info.isLuminance || info.mipmapCount > 1) && !noMipmap;
 
                                 this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture);
                                 gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, info.isCompressed ? 1 : 0);
 
-                                Internals.DDSTools.UploadDDSLevels(this, this._gl, data, info, loadMipmap, 6, -1, index);
+                                DDSTools.UploadDDSLevels(this, this._gl, data, info, loadMipmap, 6, -1, index);
 
                                 if (!noMipmap && !info.isFourCC && info.mipmapCount === 1) {
                                     gl.generateMipmap(gl.TEXTURE_CUBE_MAP);
@@ -4065,14 +4065,14 @@
                 } else {
                     Tools.LoadFile(rootUrl,
                         data => {
-                            var info = Internals.DDSTools.GetDDSInfo(data);
+                            var info = DDSTools.GetDDSInfo(data);
 
                             var loadMipmap = (info.isRGB || info.isLuminance || info.mipmapCount > 1) && !noMipmap;
 
                             this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture);
                             gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, info.isCompressed ? 1 : 0);
 
-                            Internals.DDSTools.UploadDDSLevels(this, this._gl, data, info, loadMipmap, 6);
+                            DDSTools.UploadDDSLevels(this, this._gl, data, info, loadMipmap, 6);
 
                             if (!noMipmap && !info.isFourCC && info.mipmapCount === 1) {
                                 gl.generateMipmap(gl.TEXTURE_CUBE_MAP);

+ 1 - 1
src/Loading/Plugins/babylon.babylonFileLoader.ts

@@ -1,4 +1,4 @@
-module BABYLON.Internals {
+module BABYLON {
 
     var parseMaterialById = (id: string, parsedData: any, scene: Scene, rootUrl: string) => {
         for (var index = 0, cache = parsedData.materials.length; index < cache; index++) {

+ 1 - 1
src/Materials/PBR/babylon.pbrBaseSimpleMaterial.ts

@@ -1,4 +1,4 @@
-module BABYLON.Internals {
+module BABYLON {
     /**
      * The Physically based simple base material of BJS.
      * 

+ 6 - 6
src/Materials/PBR/babylon.pbrMetallicRoughnessMaterial.ts

@@ -5,7 +5,7 @@
      * This fits to the PBR convention in the GLTF definition: 
      * https://github.com/KhronosGroup/glTF/tree/2.0/specification/2.0
      */
-    export class PBRMetallicRoughnessMaterial extends Internals.PBRBaseSimpleMaterial {
+    export class PBRMetallicRoughnessMaterial extends PBRBaseSimpleMaterial {
 
         /**
          * The base color has two different interpretations depending on the value of metalness. 
@@ -16,7 +16,7 @@
         @serializeAsColor3()
         @expandToProperty("_markAllSubMeshesAsTexturesDirty", "_albedoColor")
         public baseColor: Color3;
-        
+
         /**
          * Base texture of the metallic workflow. It contains both the baseColor information in RGB as
          * well as opacity information in the alpha channel.
@@ -97,14 +97,14 @@
 
             if (this.metallicRoughnessTexture === texture) {
                 return true;
-            }        
+            }
 
-            return false;    
-        }        
+            return false;
+        }
 
         public clone(name: string): PBRMetallicRoughnessMaterial {
             var clone = SerializationHelper.Clone(() => new PBRMetallicRoughnessMaterial(name, this.getScene()), this);
-            
+
             clone.id = name;
             clone.name = name;
 

+ 6 - 6
src/Materials/PBR/babylon.pbrSpecularGlossinessMaterial.ts

@@ -5,7 +5,7 @@
      * This fits to the PBR convention in the GLTF definition: 
      * https://github.com/KhronosGroup/glTF/tree/2.0/extensions/Khronos/KHR_materials_pbrSpecularGlossiness
      */
-    export class PBRSpecularGlossinessMaterial extends Internals.PBRBaseSimpleMaterial {
+    export class PBRSpecularGlossinessMaterial extends PBRBaseSimpleMaterial {
 
         /**
          * Specifies the diffuse color of the material.
@@ -13,7 +13,7 @@
         @serializeAsColor3("diffuse")
         @expandToProperty("_markAllSubMeshesAsTexturesDirty", "_albedoColor")
         public diffuseColor: Color3;
-        
+
         /**
          * Specifies the diffuse texture of the material. This can also contains the opcity value in its alpha
          * channel.
@@ -35,7 +35,7 @@
         @serialize()
         @expandToProperty("_markAllSubMeshesAsTexturesDirty", "_microSurface")
         public glossiness: number;
-        
+
         /**
          * Specifies both the specular color RGB and the glossiness A of the material per pixels.
          */
@@ -89,9 +89,9 @@
 
             if (this.specularGlossinessTexture === texture) {
                 return true;
-            }        
+            }
 
-            return false;    
+            return false;
         }
 
         public clone(name: string): PBRSpecularGlossinessMaterial {
@@ -100,7 +100,7 @@
             clone.id = name;
             clone.name = name;
 
-            return clone;            
+            return clone;
         }
 
         /**

+ 10 - 10
src/Materials/Textures/babylon.baseTexture.ts

@@ -7,7 +7,7 @@
 
         @serialize("hasAlpha")
         private _hasAlpha = false;
-        public set hasAlpha(value : boolean) {
+        public set hasAlpha(value: boolean) {
             if (this._hasAlpha === value) {
                 return;
             }
@@ -18,7 +18,7 @@
         }
         public get hasAlpha(): boolean {
             return this._hasAlpha;
-        }    
+        }
 
         @serialize()
         public getAlphaFromRGB = false;
@@ -31,7 +31,7 @@
 
         @serialize("coordinatesMode")
         private _coordinatesMode = Texture.EXPLICIT_MODE;
-        public set coordinatesMode(value : number) {
+        public set coordinatesMode(value: number) {
             if (this._coordinatesMode === value) {
                 return;
             }
@@ -42,7 +42,7 @@
         }
         public get coordinatesMode(): number {
             return this._coordinatesMode;
-        }            
+        }
 
         @serialize()
         public wrapU = Texture.WRAP_ADDRESSMODE;
@@ -93,7 +93,7 @@
 
         public getClassName(): string {
             return "BaseTexture";
-        }             
+        }
 
         public animations = new Array<Animation>();
 
@@ -213,7 +213,7 @@
         }
 
         public _rebuild(): void {
-            
+
         }
 
         public delayLoad(): void {
@@ -268,13 +268,13 @@
         }
 
         public get sphericalPolynomial(): Nullable<SphericalPolynomial> {
-            if (!this._texture || !Internals.CubeMapToSphericalPolynomialTools || !this.isReady()) {
+            if (!this._texture || !CubeMapToSphericalPolynomialTools || !this.isReady()) {
                 return null;
             }
 
             if (!this._texture._sphericalPolynomial) {
-                this._texture._sphericalPolynomial = 
-                    Internals.CubeMapToSphericalPolynomialTools.ConvertCubeMapTextureToSphericalPolynomial(this);
+                this._texture._sphericalPolynomial =
+                    CubeMapToSphericalPolynomialTools.ConvertCubeMapTextureToSphericalPolynomial(this);
             }
 
             return this._texture._sphericalPolynomial;
@@ -311,7 +311,7 @@
             if (!this._scene) {
                 return;
             }
-            
+
             // Animations
             this._scene.stopAnimation(this);
 

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

@@ -277,11 +277,11 @@ module BABYLON {
                     return null;
                 }
                 // Extract the raw linear data.
-                var data = Internals.HDRTools.GetCubeMapTextureData(buffer, this._size);
+                var data = HDRTools.GetCubeMapTextureData(buffer, this._size);
 
                 // Generate harmonics if needed.
                 if (this._generateHarmonics) {
-                    var sphericalPolynomial = Internals.CubeMapToSphericalPolynomialTools.ConvertCubeMapToSphericalPolynomial(data);
+                    var sphericalPolynomial = CubeMapToSphericalPolynomialTools.ConvertCubeMapToSphericalPolynomial(data);
                     this.sphericalPolynomial = sphericalPolynomial;
                 }
 
@@ -350,7 +350,7 @@ module BABYLON {
             //     this._usePMREMGenerator) {
             //     mipmapGenerator = (data: ArrayBufferView[]) => {
             //         // Custom setup of the generator matching with the PBR shader values.
-            //         var generator = new BABYLON.Internals.PMREMGenerator(data,
+            //         var generator = new BABYLON.PMREMGenerator(data,
             //             this._size,
             //             this._size,
             //             0,

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

@@ -97,7 +97,7 @@
         public instances = new Array<InstancedMesh>();
         public delayLoadingFile: string;
         public _binaryInfo: any;
-        private _LODLevels = new Array<Internals.MeshLODLevel>();
+        private _LODLevels = new Array<MeshLODLevel>();
         public onLODLevelSelection: (distance: number, mesh: Mesh, selectedLevel: Mesh) => void;
 
         // Morph
@@ -318,7 +318,7 @@
                 return this;
             }
 
-            var level = new Internals.MeshLODLevel(distance, mesh);
+            var level = new MeshLODLevel(distance, mesh);
             this._LODLevels.push(level);
 
             if (mesh) {

+ 1 - 1
src/Mesh/babylon.meshLODLevel.ts

@@ -1,4 +1,4 @@
-module BABYLON.Internals {
+module BABYLON {
     export class MeshLODLevel {
         constructor(public distance: number, public mesh: Mesh) {
         }

+ 7 - 7
src/States/babylon.alphaCullingState.ts

@@ -1,4 +1,4 @@
-module BABYLON.Internals {
+module BABYLON {
     export class _AlphaState {
         private _isAlphaBlendDirty = false;
         private _isBlendFunctionParametersDirty = false;
@@ -49,7 +49,7 @@
             this._blendConstants[3] = a;
 
             this._isBlendConstantsDirty = true;
-        }        
+        }
 
         public setAlphaBlendFunctionParameters(value0: number, value1: number, value2: number, value3: number): void {
             if (
@@ -81,7 +81,7 @@
             this._blendEquationParameters[1] = alpha;
 
             this._isBlendEquationParametersDirty = true;
-        }        
+        }
 
         public reset() {
             this._alphaBlend = false;
@@ -91,12 +91,12 @@
             this._blendFunctionParameters[3] = null;
 
             this._blendEquationParameters[0] = null;
-            this._blendEquationParameters[1] = null; 
+            this._blendEquationParameters[1] = null;
 
             this._blendConstants[0] = null;
             this._blendConstants[1] = null;
             this._blendConstants[2] = null;
-            this._blendConstants[3] = null;                       
+            this._blendConstants[3] = null;
 
             this._isAlphaBlendDirty = true;
             this._isBlendFunctionParametersDirty = false;
@@ -131,13 +131,13 @@
             if (this._isBlendEquationParametersDirty) {
                 gl.blendEquationSeparate((<any>this._isBlendEquationParametersDirty)[0], (<any>this._isBlendEquationParametersDirty)[1]);
                 this._isBlendEquationParametersDirty = false;
-            }        
+            }
 
             // Constants
             if (this._isBlendConstantsDirty) {
                 gl.blendColor(<number>this._blendConstants[0], <number>this._blendConstants[1], <number>this._blendConstants[2], <number>this._blendConstants[3]);
                 this._isBlendConstantsDirty = false;
-            }                    
+            }
         }
     }
 }

+ 3 - 3
src/States/babylon.depthCullingState.ts

@@ -1,4 +1,4 @@
-module BABYLON.Internals {
+module BABYLON {
     export class _DepthCullingState {
         private _isDepthTestDirty = false;
         private _isDepthMaskDirty = false;
@@ -7,7 +7,7 @@
         private _isCullDirty = false;
         private _isZOffsetDirty = false;
         private _isFrontFaceDirty = false;
-        
+
         private _depthTest: boolean;
         private _depthMask: boolean;
         private _depthFunc: Nullable<number>;
@@ -15,7 +15,7 @@
         private _cullFace: Nullable<number>;
         private _zOffset: number;
         private _frontFace: Nullable<number>;
-        
+
         /**
          * Initializes the state.
          */

+ 1 - 1
src/States/babylon.stencilState.ts

@@ -1,4 +1,4 @@
-module BABYLON.Internals {
+module BABYLON {
     export class _StencilState {
         private _isStencilTestDirty = false;
         private _isStencilMaskDirty = false;

+ 3 - 3
src/Tools/HDR/babylon.cubemapToSphericalPolynomial.ts

@@ -1,4 +1,4 @@
-module BABYLON.Internals {
+module BABYLON {
 
     class FileFaceOrientation {
         public name: string;
@@ -13,7 +13,7 @@ module BABYLON.Internals {
             this.worldAxisForFileY = worldAxisForFileY;
         }
     };
-    
+
     /**
      * Helper class dealing with the extraction of spherical polynomial dataArray
      * from a cube map.
@@ -156,7 +156,7 @@ module BABYLON.Internals {
             }
 
             // Solid angle for entire sphere is 4*pi
-            var sphereSolidAngle = 4.0 * Math.PI; 
+            var sphereSolidAngle = 4.0 * Math.PI;
 
             // Adjust the solid angle to allow for how many faces we processed.
             var facesProcessed = 6.0;

+ 3 - 3
src/Tools/HDR/babylon.hdr.ts

@@ -1,4 +1,4 @@
-module BABYLON.Internals {
+module BABYLON {
     /**
      * Header information of HDR texture files.
      */
@@ -7,12 +7,12 @@ module BABYLON.Internals {
          * The height of the texture in pixels.
          */
         height: number;
-        
+
         /**
          * The width of the texture in pixels.
          */
         width: number;
-        
+
         /**
          * The index of the beginning of the data in the binary file.
          */

+ 9 - 9
src/Tools/HDR/babylon.panoramaToCubemap.ts

@@ -1,4 +1,4 @@
-module BABYLON.Internals {
+module BABYLON {
     /**
      * CubeMap information grouping all the data for each faces as well as the cubemap size.
      */
@@ -8,37 +8,37 @@ module BABYLON.Internals {
          * This is stored in format, left to right, up to down format.
          */
         front: Nullable<ArrayBufferView>;
-        
+
         /**
          * The pixel array for the back face.
          * This is stored in format, left to right, up to down format.
          */
         back: Nullable<ArrayBufferView>;
-        
+
         /**
          * The pixel array for the left face.
          * This is stored in format, left to right, up to down format.
          */
         left: Nullable<ArrayBufferView>;
-        
+
         /**
          * The pixel array for the right face.
          * This is stored in format, left to right, up to down format.
          */
         right: Nullable<ArrayBufferView>;
-        
+
         /**
          * The pixel array for the up face.
          * This is stored in format, left to right, up to down format.
          */
         up: Nullable<ArrayBufferView>;
-        
+
         /**
          * The pixel array for the down face.
          * This is stored in format, left to right, up to down format.
          */
         down: Nullable<ArrayBufferView>;
-        
+
         /**
          * The size of the cubemap stored.
          * 
@@ -191,7 +191,7 @@ module BABYLON.Internals {
 
             var dx = theta / Math.PI;
             var dy = phi / Math.PI;
-            
+
             // recenter.
             dx = dx * 0.5 + 0.5;
 
@@ -215,5 +215,5 @@ module BABYLON.Internals {
             };
         }
     }
-} 
+}
 

+ 1 - 1
src/Tools/babylon.andOrNotEvaluator.ts

@@ -1,4 +1,4 @@
-module BABYLON.Internals {
+module BABYLON {
     export class AndOrNotEvaluator {
         public static Eval(query: string, evaluateCallback: (val: any) => boolean): boolean {
             if (!query.match(/\([^\(\)]*\)/g)) {

+ 77 - 77
src/Tools/babylon.dds.ts

@@ -1,33 +1,33 @@
-module BABYLON.Internals {
+module BABYLON {
     // Based on demo done by Brandon Jones - http://media.tojicode.com/webgl-samples/dds.html
     // All values and structures referenced from:
     // http://msdn.microsoft.com/en-us/library/bb943991.aspx/
     var DDS_MAGIC = 0x20534444;
 
-    var 
+    var
         //DDSD_CAPS = 0x1,
         //DDSD_HEIGHT = 0x2,
         //DDSD_WIDTH = 0x4,
         //DDSD_PITCH = 0x8,
         //DDSD_PIXELFORMAT = 0x1000,
         DDSD_MIPMAPCOUNT = 0x20000
-        //DDSD_LINEARSIZE = 0x80000,
-        //DDSD_DEPTH = 0x800000;
+    //DDSD_LINEARSIZE = 0x80000,
+    //DDSD_DEPTH = 0x800000;
 
     // var DDSCAPS_COMPLEX = 0x8,
     //     DDSCAPS_MIPMAP = 0x400000,
     //     DDSCAPS_TEXTURE = 0x1000;
 
     var DDSCAPS2_CUBEMAP = 0x200
-        // DDSCAPS2_CUBEMAP_POSITIVEX = 0x400,
-        // DDSCAPS2_CUBEMAP_NEGATIVEX = 0x800,
-        // DDSCAPS2_CUBEMAP_POSITIVEY = 0x1000,
-        // DDSCAPS2_CUBEMAP_NEGATIVEY = 0x2000,
-        // DDSCAPS2_CUBEMAP_POSITIVEZ = 0x4000,
-        // DDSCAPS2_CUBEMAP_NEGATIVEZ = 0x8000,
-        // DDSCAPS2_VOLUME = 0x200000;
-
-    var 
+    // DDSCAPS2_CUBEMAP_POSITIVEX = 0x400,
+    // DDSCAPS2_CUBEMAP_NEGATIVEX = 0x800,
+    // DDSCAPS2_CUBEMAP_POSITIVEY = 0x1000,
+    // DDSCAPS2_CUBEMAP_NEGATIVEY = 0x2000,
+    // DDSCAPS2_CUBEMAP_POSITIVEZ = 0x4000,
+    // DDSCAPS2_CUBEMAP_NEGATIVEZ = 0x8000,
+    // DDSCAPS2_VOLUME = 0x200000;
+
+    var
         //DDPF_ALPHAPIXELS = 0x1,
         //DDPF_ALPHA = 0x2,
         DDPF_FOURCC = 0x4,
@@ -48,7 +48,7 @@
             (value >> 8) & 0xff,
             (value >> 16) & 0xff,
             (value >> 24) & 0xff
-            );
+        );
     }
 
     var FOURCC_DXT1 = FourCCToInt32("DXT1");
@@ -116,19 +116,19 @@
             var textureType = Engine.TEXTURETYPE_UNSIGNED_INT;
 
             switch (fourCC) {
-                case FOURCC_D3DFMT_R16G16B16A16F:  
-                    textureType = Engine.TEXTURETYPE_HALF_FLOAT;                           
+                case FOURCC_D3DFMT_R16G16B16A16F:
+                    textureType = Engine.TEXTURETYPE_HALF_FLOAT;
                     break;
                 case FOURCC_D3DFMT_R32G32B32A32F:
                     textureType = Engine.TEXTURETYPE_FLOAT;
-                    break;                    
+                    break;
                 case FOURCC_DX10:
                     if (dxgiFormat === DXGI_FORMAT_R16G16B16A16_FLOAT) {
                         textureType = Engine.TEXTURETYPE_HALF_FLOAT;
                         break;
                     }
             }
-  
+
             return {
                 width: header[off_width],
                 height: header[off_height],
@@ -151,7 +151,7 @@
                 DDSTools._FloatView = new Float32Array(1);
                 DDSTools._Int32View = new Int32Array(DDSTools._FloatView.buffer);
             }
-            
+
             DDSTools._FloatView[0] = value;
             var x = DDSTools._Int32View[0];
 
@@ -193,16 +193,16 @@
             var e = (value & 0x7C00) >> 10;
             var f = value & 0x03FF;
 
-            if(e === 0) {
+            if (e === 0) {
                 return (s ? -1 : 1) * Math.pow(2, -14) * (f / Math.pow(2, 10));
             } else if (e == 0x1F) {
                 return f ? NaN : ((s ? -1 : 1) * Infinity);
             }
 
-            return (s ? -1 : 1) * Math.pow(2, e-15) * (1 + (f / Math.pow(2, 10)));
+            return (s ? -1 : 1) * Math.pow(2, e - 15) * (1 + (f / Math.pow(2, 10)));
         }
 
-        private static _GetHalfFloatAsFloatRGBAArrayBuffer(width: number, height: number, dataOffset: number, dataLength: number, arrayBuffer: ArrayBuffer, lod: number): Float32Array {   
+        private static _GetHalfFloatAsFloatRGBAArrayBuffer(width: number, height: number, dataOffset: number, dataLength: number, arrayBuffer: ArrayBuffer, lod: number): Float32Array {
             var destArray = new Float32Array(dataLength);
             var srcData = new Uint16Array(arrayBuffer, dataOffset);
             var index = 0;
@@ -222,9 +222,9 @@
             }
 
             return destArray;
-        } 
-    
-        private static _GetHalfFloatRGBAArrayBuffer(width: number, height: number, dataOffset: number, dataLength: number, arrayBuffer: ArrayBuffer, lod: number): Uint16Array {   
+        }
+
+        private static _GetHalfFloatRGBAArrayBuffer(width: number, height: number, dataOffset: number, dataLength: number, arrayBuffer: ArrayBuffer, lod: number): Uint16Array {
             if (DDSTools.StoreLODInAlphaChannel) {
                 var destArray = new Uint16Array(dataLength);
                 var srcData = new Uint16Array(arrayBuffer, dataOffset);
@@ -244,7 +244,7 @@
             }
 
             return new Uint16Array(arrayBuffer, dataOffset, dataLength);
-        }           
+        }
 
         private static _GetFloatRGBAArrayBuffer(width: number, height: number, dataOffset: number, dataLength: number, arrayBuffer: ArrayBuffer, lod: number): Float32Array {
             if (DDSTools.StoreLODInAlphaChannel) {
@@ -263,11 +263,11 @@
                 }
 
                 return destArray;
-            }            
+            }
             return new Float32Array(arrayBuffer, dataOffset, dataLength);
         }
 
-        private static _GetFloatAsUIntRGBAArrayBuffer(width: number, height: number, dataOffset: number, dataLength: number, arrayBuffer: ArrayBuffer, lod: number): Float32Array {   
+        private static _GetFloatAsUIntRGBAArrayBuffer(width: number, height: number, dataOffset: number, dataLength: number, arrayBuffer: ArrayBuffer, lod: number): Float32Array {
             var destArray = new Uint8Array(dataLength);
             var srcData = new Float32Array(arrayBuffer, dataOffset);
             var index = 0;
@@ -289,7 +289,7 @@
             return destArray;
         }
 
-        private static _GetHalfFloatAsUIntRGBAArrayBuffer(width: number, height: number, dataOffset: number, dataLength: number, arrayBuffer: ArrayBuffer, lod: number): Float32Array {   
+        private static _GetHalfFloatAsUIntRGBAArrayBuffer(width: number, height: number, dataOffset: number, dataLength: number, arrayBuffer: ArrayBuffer, lod: number): Float32Array {
             var destArray = new Uint8Array(dataLength);
             var srcData = new Uint16Array(arrayBuffer, dataOffset);
             var index = 0;
@@ -329,7 +329,7 @@
             return byteArray;
         }
 
-        private static _GetRGBArrayBuffer(width: number, height: number, dataOffset:number, dataLength: number, arrayBuffer: ArrayBuffer): Uint8Array {            
+        private static _GetRGBArrayBuffer(width: number, height: number, dataOffset: number, dataLength: number, arrayBuffer: ArrayBuffer): Uint8Array {
             var byteArray = new Uint8Array(dataLength);
             var srcData = new Uint8Array(arrayBuffer, dataOffset);
             var index = 0;
@@ -361,7 +361,7 @@
             return byteArray;
         }
 
-        public static UploadDDSLevels(engine: Engine, gl:WebGLRenderingContext, arrayBuffer: any, info: DDSInfo, loadMipmaps: boolean, faces: number, lodIndex = -1, currentFace?: number): void {
+        public static UploadDDSLevels(engine: Engine, gl: WebGLRenderingContext, arrayBuffer: any, info: DDSInfo, loadMipmaps: boolean, faces: number, lodIndex = -1, currentFace?: number): void {
             var ext = engine.getCaps().s3tc;
 
             var header = new Int32Array(arrayBuffer, 0, headerLengthInt);
@@ -394,53 +394,53 @@
             if (info.isFourCC) {
                 fourCC = header[off_pfFourCC];
                 switch (fourCC) {
-                case FOURCC_DXT1:
-                    blockBytes = 8;
-                    internalFormat = (<WEBGL_compressed_texture_s3tc>ext).COMPRESSED_RGBA_S3TC_DXT1_EXT;
-                    break;
-                case FOURCC_DXT3:
-                    blockBytes = 16;
-                    internalFormat = (<WEBGL_compressed_texture_s3tc>ext).COMPRESSED_RGBA_S3TC_DXT3_EXT;
-                    break;
-                case FOURCC_DXT5:
-                    blockBytes = 16;
-                    internalFormat = (<WEBGL_compressed_texture_s3tc>ext).COMPRESSED_RGBA_S3TC_DXT5_EXT;
-                    break;
-                case FOURCC_D3DFMT_R16G16B16A16F:  
-                    computeFormats = true;
-                    break;
-                case FOURCC_D3DFMT_R32G32B32A32F:
-                    computeFormats = true;
-                    break;
-                case FOURCC_DX10:
-                    // There is an additionnal header so dataOffset need to be changed
-                    dataOffset += 5 * 4; // 5 uints
-
-                    let supported = false;
-                    switch (info.dxgiFormat) {
-                        case DXGI_FORMAT_R16G16B16A16_FLOAT:
-                            computeFormats = true;
-                            supported = true;
-                            break;
-                        case DXGI_FORMAT_B8G8R8X8_UNORM:
-                            info.isRGB = true;
-                            info.isFourCC = false;
-                            bpp = 32;
-                            supported = true;
-                            break;
-                    }
-
-                    if (supported) {
+                    case FOURCC_DXT1:
+                        blockBytes = 8;
+                        internalFormat = (<WEBGL_compressed_texture_s3tc>ext).COMPRESSED_RGBA_S3TC_DXT1_EXT;
                         break;
-                    }
-                default:
-                    console.error("Unsupported FourCC code:", Int32ToFourCC(fourCC));
-                    return;
+                    case FOURCC_DXT3:
+                        blockBytes = 16;
+                        internalFormat = (<WEBGL_compressed_texture_s3tc>ext).COMPRESSED_RGBA_S3TC_DXT3_EXT;
+                        break;
+                    case FOURCC_DXT5:
+                        blockBytes = 16;
+                        internalFormat = (<WEBGL_compressed_texture_s3tc>ext).COMPRESSED_RGBA_S3TC_DXT5_EXT;
+                        break;
+                    case FOURCC_D3DFMT_R16G16B16A16F:
+                        computeFormats = true;
+                        break;
+                    case FOURCC_D3DFMT_R32G32B32A32F:
+                        computeFormats = true;
+                        break;
+                    case FOURCC_DX10:
+                        // There is an additionnal header so dataOffset need to be changed
+                        dataOffset += 5 * 4; // 5 uints
+
+                        let supported = false;
+                        switch (info.dxgiFormat) {
+                            case DXGI_FORMAT_R16G16B16A16_FLOAT:
+                                computeFormats = true;
+                                supported = true;
+                                break;
+                            case DXGI_FORMAT_B8G8R8X8_UNORM:
+                                info.isRGB = true;
+                                info.isFourCC = false;
+                                bpp = 32;
+                                supported = true;
+                                break;
+                        }
+
+                        if (supported) {
+                            break;
+                        }
+                    default:
+                        console.error("Unsupported FourCC code:", Int32ToFourCC(fourCC));
+                        return;
                 }
             }
 
             if (computeFormats) {
-                format = engine._getWebGLTextureType(info.textureType);    
+                format = engine._getWebGLTextureType(info.textureType);
                 internalFormat = engine._getRGBABufferInternalSizedFormat(info.textureType);
             }
 
@@ -448,7 +448,7 @@
             if (header[off_flags] & DDSD_MIPMAPCOUNT && loadMipmaps !== false) {
                 mipmapCount = Math.max(1, header[off_mipmapCount]);
             }
-            
+
             for (var face = 0; face < faces; face++) {
                 var sampler = faces === 1 ? gl.TEXTURE_2D : (gl.TEXTURE_CUBE_MAP_POSITIVE_X + face + (currentFace ? currentFace : 0));
 
@@ -466,7 +466,7 @@
 
                             if (engine.badOS || engine.badDesktopOS || (!engine.getCaps().textureHalfFloat && !engine.getCaps().textureFloat)) { // Required because iOS has many issues with float and half float generation
                                 if (bpp === 128) {
-                                    floatArray = DDSTools._GetFloatAsUIntRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i);                                    
+                                    floatArray = DDSTools._GetFloatAsUIntRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i);
                                 }
                                 else if (bpp === 64) {
                                     floatArray = DDSTools._GetHalfFloatAsUIntRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i);
@@ -483,8 +483,8 @@
                                     floatArray = DDSTools._GetHalfFloatAsFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i);
 
                                     info.textureType = Engine.TEXTURETYPE_FLOAT;
-                                    format = engine._getWebGLTextureType(info.textureType);    
-                                    internalFormat = engine._getRGBABufferInternalSizedFormat(info.textureType);                            
+                                    format = engine._getWebGLTextureType(info.textureType);
+                                    internalFormat = engine._getRGBABufferInternalSizedFormat(info.textureType);
                                 } else { // 64
                                     floatArray = DDSTools._GetHalfFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i);
                                 }

+ 55 - 55
src/Tools/babylon.khronosTextureContainer.ts

@@ -1,69 +1,69 @@
-module BABYLON.Internals {
+module BABYLON {
     /**
      * for description see https://www.khronos.org/opengles/sdk/tools/KTX/
      * 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)
-        
+
         // 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()
-        
+        static TEX_2D = 2; // uses a gl.texImage2D()
+        static TEX_3D = 3; // uses a gl.texImage3D()
+
         // elements of the header 
-        public glType : number;
-        public glTypeSize : number;
-        public glFormat : number;
-        public glInternalFormat : number;
-        public glBaseInternalFormat : number;
-        public pixelWidth : number;
-        public pixelHeight : number;
-        public pixelDepth : number;
-        public numberOfArrayElements : number;
-        public numberOfFaces : number;
-        public numberOfMipmapLevels : number;
-        public bytesOfKeyValueData : number;
-        
-        public loadType : number;
+        public glType: number;
+        public glTypeSize: number;
+        public glFormat: number;
+        public glInternalFormat: number;
+        public glBaseInternalFormat: number;
+        public pixelWidth: number;
+        public pixelHeight: number;
+        public pixelDepth: number;
+        public numberOfArrayElements: number;
+        public numberOfFaces: number;
+        public numberOfMipmapLevels: number;
+        public bytesOfKeyValueData: number;
+
+        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
          */
-        public constructor (public arrayBuffer : any, facesExpected : number, threeDExpected? : boolean, textureArrayExpected? : boolean) {
+        public constructor(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'
+            // '�', 'K', 'T', 'X', ' ', '1', '1', '�', '\r', '\n', '\x1A', '\n'
             // 0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A
             var identifier = new Uint8Array(this.arrayBuffer, 0, 12);
-            if (identifier[ 0] !== 0xAB || identifier[ 1] !== 0x4B || identifier[ 2] !== 0x54 || identifier[ 3] !== 0x58 || identifier[ 4] !== 0x20 || identifier[ 5] !== 0x31 || 
-                identifier[ 6] !== 0x31 || identifier[ 7] !== 0xBB || identifier[ 8] !== 0x0D || identifier[ 9] !== 0x0A || identifier[10] !== 0x1A || identifier[11] !== 0x0A) {
+            if (identifier[0] !== 0xAB || identifier[1] !== 0x4B || identifier[2] !== 0x54 || identifier[3] !== 0x58 || identifier[4] !== 0x20 || identifier[5] !== 0x31 ||
+                identifier[6] !== 0x31 || identifier[7] !== 0xBB || identifier[8] !== 0x0D || identifier[9] !== 0x0A || identifier[10] !== 0x1A || identifier[11] !== 0x0A) {
                 Tools.Error("texture missing KTX identifier");
                 return;
             }
-            
+
             // load the reset of the header in native 32 bit int
             var header = new Int32Array(this.arrayBuffer, 12, 13);
-            
+
             // determine of the remaining header values are recorded in the opposite endianness & require conversion
             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.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
+
             // 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) {
                 Tools.Error("only compressed formats currently supported");
@@ -72,60 +72,60 @@ module BABYLON.Internals {
                 // value of zero is an indication to generate mipmaps @ runtime.  Not usually allowed for compressed, so disregard.
                 this.numberOfMipmapLevels = Math.max(1, this.numberOfMipmapLevels);
             }
-            
+
             if (this.pixelHeight === 0 || this.pixelDepth !== 0) {
                 Tools.Error("only 2D textures currently supported");
                 return;
             }
-            
+
             if (this.numberOfArrayElements !== 0) {
                 Tools.Error("texture arrays not currently supported");
                 return;
             }
-            
+
             if (this.numberOfFaces !== facesExpected) {
                 Tools.Error("number of faces expected" + facesExpected + ", but found " + this.numberOfFaces);
                 return;
             }
-              
+
             // we now have a completely validated file, so could use existence of loadType as success
             // would need to make this more elaborate & adjust checks above to support more than one load type
             this.loadType = KhronosTextureContainer.COMPRESSED_2D;
         }
-        
+
         // not as fast hardware based, but will probably never need to use
-        public switchEndainness(val : number) : number {
+        public switchEndainness(val: number): number {
             return ((val & 0xFF) << 24)
-                 | ((val & 0xFF00) << 8)
-                 | ((val >> 8) & 0xFF00)
-                 | ((val >> 24) & 0xFF);            
+                | ((val & 0xFF00) << 8)
+                | ((val >> 8) & 0xFF00)
+                | ((val >> 24) & 0xFF);
         }
-        
+
         /**
          * It is assumed that the texture has already been created & is currently bound
          */
-        public uploadLevels(gl: WebGLRenderingContext, loadMipmaps: boolean) : void {
-            switch (this.loadType){
+        public uploadLevels(gl: WebGLRenderingContext, loadMipmaps: boolean): void {
+            switch (this.loadType) {
                 case KhronosTextureContainer.COMPRESSED_2D:
                     this._upload2DCompressedLevels(gl, loadMipmaps);
                     break;
-                    
+
                 case KhronosTextureContainer.TEX_2D:
                 case KhronosTextureContainer.COMPRESSED_3D:
                 case KhronosTextureContainer.TEX_3D:
             }
         }
-        
+
         private _upload2DCompressedLevels(gl: WebGLRenderingContext, loadMipmaps: boolean): void {
             // initialize width & height for level 1
             var dataOffset = KhronosTextureContainer.HEADER_LEN + this.bytesOfKeyValueData;
             var width = this.pixelWidth;
             var height = this.pixelHeight;
-            
+
             var mipmapCount = loadMipmaps ? this.numberOfMipmapLevels : 1;
             for (var level = 0; level < mipmapCount; level++) {
                 var imageSize = new Int32Array(this.arrayBuffer, dataOffset, 1)[0]; // size per face, since not supporting array cubemaps
-                
+
                 for (var face = 0; face < this.numberOfFaces; face++) {
                     var sampler = this.numberOfFaces === 1 ? gl.TEXTURE_2D : (gl.TEXTURE_CUBE_MAP_POSITIVE_X + face);
                     var byteArray = new Uint8Array(this.arrayBuffer, dataOffset + 4, imageSize);

+ 2 - 2
src/Tools/babylon.tags.ts

@@ -66,7 +66,7 @@
             }
 
             var tags = tagsString.split(" ");
-            tags.forEach( function(tag, index, array) {
+            tags.forEach(function (tag, index, array) {
                 Tags._AddTagTo(obj, tag);
             });
         }
@@ -109,7 +109,7 @@
                 return Tags.HasTags(obj);
             }
 
-            return Internals.AndOrNotEvaluator.Eval(tagsQuery, r => Tags.HasTags(obj) && obj._tags[r]);
+            return AndOrNotEvaluator.Eval(tagsQuery, r => Tags.HasTags(obj) && obj._tags[r]);
         }
     }
 }

+ 1 - 1
src/Tools/babylon.tga.ts

@@ -1,4 +1,4 @@
-module BABYLON.Internals {
+module BABYLON {
     /*
     * Based on jsTGALoader - Javascript loader for TGA file
     * By Vincent Thibault

+ 1 - 1
src/Tools/babylon.tools.ts

@@ -1010,7 +1010,7 @@
 
                 if (dataType & 2) {
                     // Check header width and height since there is no "TGA" magic number
-                    var tgaHeader = Internals.TGATools.GetTGAHeader(xhr.response);
+                    var tgaHeader = TGATools.GetTGAHeader(xhr.response);
 
                     if (tgaHeader.width && tgaHeader.height && tgaHeader.width > 0 && tgaHeader.height > 0) {
                         return true;