Browse Source

merge back

David Catuhe 8 years ago
parent
commit
d74b1b8fec
32 changed files with 440 additions and 333 deletions
  1. 17 3
      dist/preview release/babylon.max.js
  2. 27 5
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js
  3. 3 3
      dist/preview release/gui/babylon.gui.min.js
  4. 263 263
      dist/preview release/inspector/babylon.inspector.bundle.js
  5. 3 3
      dist/preview release/inspector/babylon.inspector.min.js
  6. 2 2
      dist/preview release/loaders/babylon.glTF1FileLoader.min.js
  7. 1 1
      dist/preview release/loaders/babylon.glTF2FileLoader.min.js
  8. 2 2
      dist/preview release/loaders/babylon.glTFFileLoader.min.js
  9. 6 6
      dist/preview release/loaders/babylon.objFileLoader.js
  10. 1 1
      dist/preview release/loaders/babylon.objFileLoader.min.js
  11. 6 6
      dist/preview release/loaders/babylonjs.loaders.js
  12. 3 3
      dist/preview release/loaders/babylonjs.loaders.min.js
  13. 1 1
      dist/preview release/materialsLibrary/babylon.customMaterial.min.js
  14. 4 0
      dist/preview release/materialsLibrary/babylon.gridMaterial.d.ts
  15. 10 2
      dist/preview release/materialsLibrary/babylon.gridMaterial.js
  16. 1 1
      dist/preview release/materialsLibrary/babylon.gridMaterial.min.js
  17. 1 1
      dist/preview release/materialsLibrary/babylon.shadowOnlyMaterial.min.js
  18. 1 1
      dist/preview release/materialsLibrary/babylon.waterMaterial.min.js
  19. 10 2
      dist/preview release/materialsLibrary/babylonjs.materials.js
  20. 6 6
      dist/preview release/materialsLibrary/babylonjs.materials.min.js
  21. 4 0
      dist/preview release/materialsLibrary/babylonjs.materials.module.d.ts
  22. 1 1
      dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js
  23. 1 1
      dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js
  24. 1 1
      dist/preview release/postProcessesLibrary/babylonjs.postProcess.min.js
  25. 12 12
      loaders/src/OBJ/babylon.objFileLoader.ts
  26. 10 2
      materialsLibrary/src/grid/babylon.gridmaterial.ts
  27. 2 1
      materialsLibrary/src/grid/grid.fragment.fx
  28. 19 0
      materialsLibrary/test/addgrid.js
  29. 2 0
      src/Materials/Textures/babylon.renderTargetTexture.ts
  30. 5 3
      src/Materials/Textures/babylon.texture.ts
  31. 10 0
      src/Tools/babylon.tools.ts
  32. 5 0
      src/babylon.engine.ts

File diff suppressed because it is too large
+ 17 - 3
dist/preview release/babylon.max.js


File diff suppressed because it is too large
+ 27 - 5
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js


File diff suppressed because it is too large
+ 3 - 3
dist/preview release/gui/babylon.gui.min.js


File diff suppressed because it is too large
+ 263 - 263
dist/preview release/inspector/babylon.inspector.bundle.js


File diff suppressed because it is too large
+ 3 - 3
dist/preview release/inspector/babylon.inspector.min.js


File diff suppressed because it is too large
+ 2 - 2
dist/preview release/loaders/babylon.glTF1FileLoader.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/loaders/babylon.glTF2FileLoader.min.js


File diff suppressed because it is too large
+ 2 - 2
dist/preview release/loaders/babylon.glTFFileLoader.min.js


+ 6 - 6
dist/preview release/loaders/babylon.objFileLoader.js

@@ -55,7 +55,7 @@ var BABYLON;
                     else if (key === "kd") {
                         // Diffuse color (color under white light) using RGB values
                         //value  = "r g b"
-                        color = value.split(delimiter_pattern, 3);
+                        color = value.split(delimiter_pattern, 3).map(parseFloat);
                         //color = [r,g,b]
                         //Set tghe color into the material
                         material.diffuseColor = BABYLON.Color3.FromArray(color);
@@ -63,7 +63,7 @@ var BABYLON;
                     else if (key === "ka") {
                         // Ambient color (color under shadow) using RGB values
                         //value = "r g b"
-                        color = value.split(delimiter_pattern, 3);
+                        color = value.split(delimiter_pattern, 3).map(parseFloat);
                         //color = [r,g,b]
                         //Set tghe color into the material
                         material.ambientColor = BABYLON.Color3.FromArray(color);
@@ -71,23 +71,23 @@ var BABYLON;
                     else if (key === "ks") {
                         // Specular color (color when light is reflected from shiny surface) using RGB values
                         //value = "r g b"
-                        color = value.split(delimiter_pattern, 3);
+                        color = value.split(delimiter_pattern, 3).map(parseFloat);
                         //color = [r,g,b]
                         //Set the color into the material
                         material.specularColor = BABYLON.Color3.FromArray(color);
                     }
                     else if (key === "ke") {
                         // Emissive color using RGB values
-                        color = value.split(delimiter_pattern, 3);
+                        color = value.split(delimiter_pattern, 3).map(parseFloat);
                         material.emissiveColor = BABYLON.Color3.FromArray(color);
                     }
                     else if (key === "ns") {
                         //value = "Integer"
-                        material.specularPower = value;
+                        material.specularPower = parseFloat(value);
                     }
                     else if (key === "d") {
                         //d is dissolve for current material. It mean alpha for BABYLON
-                        material.alpha = value;
+                        material.alpha = parseFloat(value);
                         //Texture
                         //This part can be improved by adding the possible options of texture
                     }

File diff suppressed because it is too large
+ 1 - 1
dist/preview release/loaders/babylon.objFileLoader.min.js


+ 6 - 6
dist/preview release/loaders/babylonjs.loaders.js

@@ -237,7 +237,7 @@ var BABYLON;
                     else if (key === "kd") {
                         // Diffuse color (color under white light) using RGB values
                         //value  = "r g b"
-                        color = value.split(delimiter_pattern, 3);
+                        color = value.split(delimiter_pattern, 3).map(parseFloat);
                         //color = [r,g,b]
                         //Set tghe color into the material
                         material.diffuseColor = BABYLON.Color3.FromArray(color);
@@ -245,7 +245,7 @@ var BABYLON;
                     else if (key === "ka") {
                         // Ambient color (color under shadow) using RGB values
                         //value = "r g b"
-                        color = value.split(delimiter_pattern, 3);
+                        color = value.split(delimiter_pattern, 3).map(parseFloat);
                         //color = [r,g,b]
                         //Set tghe color into the material
                         material.ambientColor = BABYLON.Color3.FromArray(color);
@@ -253,23 +253,23 @@ var BABYLON;
                     else if (key === "ks") {
                         // Specular color (color when light is reflected from shiny surface) using RGB values
                         //value = "r g b"
-                        color = value.split(delimiter_pattern, 3);
+                        color = value.split(delimiter_pattern, 3).map(parseFloat);
                         //color = [r,g,b]
                         //Set the color into the material
                         material.specularColor = BABYLON.Color3.FromArray(color);
                     }
                     else if (key === "ke") {
                         // Emissive color using RGB values
-                        color = value.split(delimiter_pattern, 3);
+                        color = value.split(delimiter_pattern, 3).map(parseFloat);
                         material.emissiveColor = BABYLON.Color3.FromArray(color);
                     }
                     else if (key === "ns") {
                         //value = "Integer"
-                        material.specularPower = value;
+                        material.specularPower = parseFloat(value);
                     }
                     else if (key === "d") {
                         //d is dissolve for current material. It mean alpha for BABYLON
-                        material.alpha = value;
+                        material.alpha = parseFloat(value);
                         //Texture
                         //This part can be improved by adding the possible options of texture
                     }

File diff suppressed because it is too large
+ 3 - 3
dist/preview release/loaders/babylonjs.loaders.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/materialsLibrary/babylon.customMaterial.min.js


+ 4 - 0
dist/preview release/materialsLibrary/babylon.gridMaterial.d.ts

@@ -18,6 +18,10 @@ declare module BABYLON {
          */
         gridRatio: number;
         /**
+         * Allows setting an offset for the grid lines.
+         */
+        gridOffset: Vector3;
+        /**
          * The frequency of thicker lines.
          */
         majorUnitFrequency: number;

File diff suppressed because it is too large
+ 10 - 2
dist/preview release/materialsLibrary/babylon.gridMaterial.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/materialsLibrary/babylon.gridMaterial.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/materialsLibrary/babylon.shadowOnlyMaterial.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/materialsLibrary/babylon.waterMaterial.min.js


File diff suppressed because it is too large
+ 10 - 2
dist/preview release/materialsLibrary/babylonjs.materials.js


File diff suppressed because it is too large
+ 6 - 6
dist/preview release/materialsLibrary/babylonjs.materials.min.js


+ 4 - 0
dist/preview release/materialsLibrary/babylonjs.materials.module.d.ts

@@ -472,6 +472,10 @@ declare module BABYLON {
          */
         gridRatio: number;
         /**
+         * Allows setting an offset for the grid lines.
+         */
+        gridOffset: Vector3;
+        /**
          * The frequency of thicker lines.
          */
         majorUnitFrequency: number;

File diff suppressed because it is too large
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/postProcessesLibrary/babylonjs.postProcess.min.js


+ 12 - 12
loaders/src/OBJ/babylon.objFileLoader.ts

@@ -45,7 +45,7 @@ module BABYLON {
                 key = key.toLowerCase();
 
                 //Get the data following the key
-                var value: any = (pos >= 0) ? line.substring(pos + 1).trim() : "";
+                var value: string = (pos >= 0) ? line.substring(pos + 1).trim() : "";
 
                 //This mtl keyword will create the new material
                 if (key === "newmtl") {
@@ -62,7 +62,7 @@ module BABYLON {
                     // Diffuse color (color under white light) using RGB values
 
                     //value  = "r g b"
-                    color = <number[]>value.split(delimiter_pattern, 3);
+                    color = <number[]>value.split(delimiter_pattern, 3).map(parseFloat);
                     //color = [r,g,b]
                     //Set tghe color into the material
                     material.diffuseColor = BABYLON.Color3.FromArray(color);
@@ -70,7 +70,7 @@ module BABYLON {
                     // Ambient color (color under shadow) using RGB values
 
                     //value = "r g b"
-                    color = <number[]>value.split(delimiter_pattern, 3);
+                    color = <number[]>value.split(delimiter_pattern, 3).map(parseFloat);
                     //color = [r,g,b]
                     //Set tghe color into the material
                     material.ambientColor = BABYLON.Color3.FromArray(color);
@@ -78,21 +78,21 @@ module BABYLON {
                     // Specular color (color when light is reflected from shiny surface) using RGB values
 
                     //value = "r g b"
-                    color = <number[]>value.split(delimiter_pattern, 3);
+                    color = <number[]>value.split(delimiter_pattern, 3).map(parseFloat);
                     //color = [r,g,b]
                     //Set the color into the material
                     material.specularColor = BABYLON.Color3.FromArray(color);
                 } else if (key === "ke") {
                     // Emissive color using RGB values
-                    color = value.split(delimiter_pattern, 3);
+                    color = value.split(delimiter_pattern, 3).map(parseFloat);
                     material.emissiveColor = BABYLON.Color3.FromArray(color);
                 } else if (key === "ns") {
 
                     //value = "Integer"
-                    material.specularPower = value;
+                    material.specularPower = parseFloat(value);
                 } else if (key === "d") {
                     //d is dissolve for current material. It mean alpha for BABYLON
-                    material.alpha = value;
+                    material.alpha = parseFloat(value);
 
                     //Texture
                     //This part can be improved by adding the possible options of texture
@@ -237,11 +237,11 @@ module BABYLON {
             var pathOfFile = BABYLON.Tools.BaseUrl + rootUrl + url;
 
             // Loads through the babylon tools to allow fileInput search.
-            BABYLON.Tools.LoadFile(pathOfFile, 
-                onSuccess, 
-                null, 
-                null, 
-                false, 
+            BABYLON.Tools.LoadFile(pathOfFile,
+                onSuccess,
+                null,
+                null,
+                false,
                 () => { console.warn("Error - Unable to load " + pathOfFile); });
         }
 

+ 10 - 2
materialsLibrary/src/grid/babylon.gridmaterial.ts

@@ -37,6 +37,12 @@ module BABYLON {
         public gridRatio = 1.0;
 
         /**
+         * Allows setting an offset for the grid lines.
+         */
+        @serializeAsColor3()
+        public gridOffset = Vector3.Zero();
+
+        /**
          * The frequency of thicker lines.
          */
         @serialize()
@@ -126,7 +132,7 @@ module BABYLON {
                 var join = defines.toString();
                 subMesh.setEffect(scene.getEngine().createEffect("grid",
                     attribs,
-                    ["projection", "worldView", "mainColor", "lineColor", "gridControl", "vFogInfos", "vFogColor", "world", "view"],
+                    ["projection", "worldView", "mainColor", "lineColor", "gridControl", "gridOffset", "vFogInfos", "vFogColor", "world", "view"],
                     [],
                     join,
                     null,
@@ -166,6 +172,8 @@ module BABYLON {
                 this._activeEffect.setColor3("mainColor", this.mainColor);
                 this._activeEffect.setColor3("lineColor", this.lineColor);
 
+                this._activeEffect.setVector3("gridOffset", this.gridOffset);
+
                 this._gridControl.x = this.gridRatio;
                 this._gridControl.y = Math.round(this.majorUnitFrequency);
                 this._gridControl.z = this.minorUnitVisibility;
@@ -194,7 +202,7 @@ module BABYLON {
 
         public getClassName(): string {
             return "GridMaterial";
-        }             
+        }
 
         public static Parse(source: any, scene: Scene, rootUrl: string): GridMaterial {
             return SerializationHelper.Parse(() => new GridMaterial(source.name, scene), source, scene, rootUrl);

+ 2 - 1
materialsLibrary/src/grid/grid.fragment.fx

@@ -8,6 +8,7 @@ precision highp float;
 uniform vec3 mainColor;
 uniform vec3 lineColor;
 uniform vec4 gridControl;
+uniform vec3 gridOffset;
 
 // Varying
 #ifdef TRANSPARENT
@@ -70,7 +71,7 @@ void main(void) {
     
     // Scale position to the requested ratio.
     float gridRatio = gridControl.x;
-    vec3 gridPos = vPosition / gridRatio;
+    vec3 gridPos = (vPosition + gridOffset) / gridRatio;
     
     // Find the contribution of each coords.
     float x = contributionOnAxis(gridPos.x);

+ 19 - 0
materialsLibrary/test/addgrid.js

@@ -42,6 +42,25 @@ window.prepareGrid = function() {
 	}, function() {
 		return grid.gridRatio;
 	});
+
+	registerRangeUI("grid", "OffsetX", 0, 2, function(value) {
+		grid.gridOffset.x = value;
+	}, function() {
+		return grid.gridOffset.x;
+	});
+    
+  registerRangeUI("grid", "OffsetY", 0, 2, function(value) {
+		grid.gridOffset.y = value;
+	}, function() {
+		return grid.gridOffset.y;
+	});
+    
+  registerRangeUI("grid", "OffsetZ", 0, 2, function(value) {
+		grid.gridOffset.z = value;
+	}, function() {
+		return grid.gridOffset.z;
+	});
+    
     
   registerRangeUI("grid", "MajorUnitFrequency", 1, 10, function(value) {
 		grid.majorUnitFrequency = value;

+ 2 - 0
src/Materials/Textures/babylon.renderTargetTexture.ts

@@ -269,6 +269,8 @@
             } else {
                 this._texture = this.getScene().getEngine().createRenderTargetTexture(size, this._renderTargetOptions);
             }
+
+            this._size = size;
         }
 
         public render(useCameraPostProcess?: boolean, dumpForDebug?: boolean) {

+ 5 - 3
src/Materials/Textures/babylon.texture.ts

@@ -117,6 +117,8 @@
 
             scene = this.getScene();
 
+            scene.getEngine().onBeforeTextureInitObservable.notifyObservers(this);
+
             let load = () => {
                 if (this._onLoadObservable && this._onLoadObservable.hasObservers()) {
                     this.onLoadObservable.notifyObservers(this);
@@ -130,17 +132,17 @@
                 }
             }
 
-            if (!url) {
+            if (!this.url) {
                 this._delayedOnLoad = load;
                 this._delayedOnError = onError;
                 return;
             }
 
-            this._texture = this._getFromCache(url, noMipmap, samplingMode);
+            this._texture = this._getFromCache(this.url, noMipmap, samplingMode);
 
             if (!this._texture) {
                 if (!scene.useDelayedTextureLoading) {
-                    this._texture = scene.getEngine().createTexture(url, noMipmap, invertY, scene, this._samplingMode, load, onError, this._buffer, null, this._format);
+                    this._texture = scene.getEngine().createTexture(this.url, noMipmap, invertY, scene, this._samplingMode, load, onError, this._buffer, null, this._format);
                     if (deleteBuffer) {
                         delete this._buffer;
                     }

File diff suppressed because it is too large
+ 10 - 0
src/Tools/babylon.tools.ts


+ 5 - 0
src/babylon.engine.ts

@@ -559,6 +559,11 @@
          */
         public onCanvasPointerOutObservable = new Observable<Engine>();
 
+        /**
+         * Observable event triggered before each texture is initialized
+         */
+        public onBeforeTextureInitObservable = new Observable<Texture>();
+
         //WebVR
 
         private _vrDisplay: any = undefined;