Bladeren bron

Merge remote-tracking branch 'refs/remotes/BabylonJS/master' into OcclusionQueries

# Conflicts:
#	dist/preview release/babylon.d.ts
#	dist/preview release/babylon.js
#	dist/preview release/babylon.module.d.ts
#	dist/preview release/babylon.worker.js
#	dist/preview
release/customConfigurations/minimalGLTFViewer/babylon.d.ts
#	dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js
#	dist/preview
release/customConfigurations/minimalGLTFViewer/babylon.module.d.ts
#	dist/preview release/loaders/babylon.objFileLoader.min.js
DESKTOP-QJU4N0L\mityh 8 jaren geleden
bovenliggende
commit
4af547596d

+ 8 - 12
dist/preview release/babylon.max.js

@@ -67149,8 +67149,10 @@ var BABYLON;
             // Alpha test
             if (material && material.needAlphaTesting()) {
                 var alphaTexture = material.getAlphaTestTexture();
-                this._effect.setTexture("diffuseSampler", alphaTexture);
-                this._effect.setMatrix("diffuseMatrix", alphaTexture.getTextureMatrix());
+                if (alphaTexture) {
+                    this._effect.setTexture("diffuseSampler", alphaTexture);
+                    this._effect.setMatrix("diffuseMatrix", alphaTexture.getTextureMatrix());
+                }
             }
             engine.setZOffset(-this.zOffset);
             mesh._processRendering(subMesh, this._effect, BABYLON.Material.TriangleFillMode, batch, hardwareInstancedRendering, function (isInstance, world) { _this._effect.setMatrix("world", world); });
@@ -69872,7 +69874,7 @@ var BABYLON;
 (function (BABYLON) {
     var FramingBehavior = (function () {
         function FramingBehavior() {
-            this._mode = FramingBehavior.IgnoreBoundsSizeMode;
+            this._mode = FramingBehavior.FitFrustumSidesMode;
             this._radiusScale = 1.0;
             this._positionY = 0;
             this._defaultElevation = 0.3;
@@ -70064,13 +70066,10 @@ var BABYLON;
          * Targets the given mesh and updates zoom level accordingly.
          * @param mesh  The mesh to target.
          * @param radius Optional. If a cached radius position already exists, overrides default.
-         * @param applyToLowerLimit Optional. Indicates if the calculated target radius should be applied to the
-         *		camera's lower radius limit too.
          * @param framingPositionY Position on mesh to center camera focus where 0 corresponds bottom of its bounding box and 1, the top
          * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh
          */
-        FramingBehavior.prototype.zoomOnMesh = function (mesh, radius, applyToLowerLimit, framingPositionY, focusOnOriginXZ) {
-            if (applyToLowerLimit === void 0) { applyToLowerLimit = true; }
+        FramingBehavior.prototype.zoomOnMesh = function (mesh, radius, framingPositionY, focusOnOriginXZ) {
             if (focusOnOriginXZ === void 0) { focusOnOriginXZ = false; }
             if (framingPositionY == null) {
                 framingPositionY = this._positionY;
@@ -70095,17 +70094,14 @@ var BABYLON;
                 var delta = 0.1;
                 if (this._mode === FramingBehavior.FitFrustumSidesMode) {
                     var position = this._calculateLowerRadiusFromModelBoundingSphere(mesh);
-                    this._attachedCamera.lowerRadiusLimit = position - delta;
+                    this._attachedCamera.lowerRadiusLimit = mesh.getBoundingInfo().boundingSphere.radiusWorld + this._attachedCamera.minZ;
                     radius = position;
                 }
                 else if (this._mode === FramingBehavior.IgnoreBoundsSizeMode) {
                     radius = this._calculateLowerRadiusFromModelBoundingSphere(mesh);
+                    this._attachedCamera.lowerRadiusLimit = this._attachedCamera.minZ;
                 }
             }
-            if (applyToLowerLimit) {
-                this._attachedCamera.lowerRadiusLimit = mesh.getBoundingInfo().boundingSphere.radiusWorld;
-                ;
-            }
             // transition to new radius
             if (!this._radiusTransition) {
                 this._radiusTransition = BABYLON.Animation.CreateAnimation("radius", BABYLON.Animation.ANIMATIONTYPE_FLOAT, 60, FramingBehavior.EasingFunction);

+ 4 - 10
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -49847,7 +49847,7 @@ var BABYLON;
 (function (BABYLON) {
     var FramingBehavior = (function () {
         function FramingBehavior() {
-            this._mode = FramingBehavior.IgnoreBoundsSizeMode;
+            this._mode = FramingBehavior.FitFrustumSidesMode;
             this._radiusScale = 1.0;
             this._positionY = 0;
             this._defaultElevation = 0.3;
@@ -50039,13 +50039,10 @@ var BABYLON;
          * Targets the given mesh and updates zoom level accordingly.
          * @param mesh  The mesh to target.
          * @param radius Optional. If a cached radius position already exists, overrides default.
-         * @param applyToLowerLimit Optional. Indicates if the calculated target radius should be applied to the
-         *		camera's lower radius limit too.
          * @param framingPositionY Position on mesh to center camera focus where 0 corresponds bottom of its bounding box and 1, the top
          * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh
          */
-        FramingBehavior.prototype.zoomOnMesh = function (mesh, radius, applyToLowerLimit, framingPositionY, focusOnOriginXZ) {
-            if (applyToLowerLimit === void 0) { applyToLowerLimit = true; }
+        FramingBehavior.prototype.zoomOnMesh = function (mesh, radius, framingPositionY, focusOnOriginXZ) {
             if (focusOnOriginXZ === void 0) { focusOnOriginXZ = false; }
             if (framingPositionY == null) {
                 framingPositionY = this._positionY;
@@ -50070,17 +50067,14 @@ var BABYLON;
                 var delta = 0.1;
                 if (this._mode === FramingBehavior.FitFrustumSidesMode) {
                     var position = this._calculateLowerRadiusFromModelBoundingSphere(mesh);
-                    this._attachedCamera.lowerRadiusLimit = position - delta;
+                    this._attachedCamera.lowerRadiusLimit = mesh.getBoundingInfo().boundingSphere.radiusWorld + this._attachedCamera.minZ;
                     radius = position;
                 }
                 else if (this._mode === FramingBehavior.IgnoreBoundsSizeMode) {
                     radius = this._calculateLowerRadiusFromModelBoundingSphere(mesh);
+                    this._attachedCamera.lowerRadiusLimit = this._attachedCamera.minZ;
                 }
             }
-            if (applyToLowerLimit) {
-                this._attachedCamera.lowerRadiusLimit = mesh.getBoundingInfo().boundingSphere.radiusWorld;
-                ;
-            }
             // transition to new radius
             if (!this._radiusTransition) {
                 this._radiusTransition = BABYLON.Animation.CreateAnimation("radius", BABYLON.Animation.ANIMATIONTYPE_FLOAT, 60, FramingBehavior.EasingFunction);

+ 8 - 0
dist/preview release/loaders/babylon.objFileLoader.js

@@ -76,6 +76,11 @@ var BABYLON;
                         //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);
+                        material.emissiveColor = BABYLON.Color3.FromArray(color);
+                    }
                     else if (key === "ns") {
                         //value = "Integer"
                         material.specularPower = value;
@@ -173,6 +178,9 @@ var BABYLON;
          * @return The Texture
          */
         MTLFileLoader._getTexture = function (rootUrl, value, scene) {
+            if (!value) {
+                return null;
+            }
             var url = rootUrl;
             // Load from input file.
             if (rootUrl === "file:") {

+ 8 - 0
loaders/src/OBJ/babylon.objFileLoader.ts

@@ -82,6 +82,10 @@ module BABYLON {
                     //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);
+                    material.emissiveColor = BABYLON.Color3.FromArray(color);
                 } else if (key === "ns") {
 
                     //value = "Integer"
@@ -164,6 +168,10 @@ module BABYLON {
          * @return The Texture
          */
         private static _getTexture(rootUrl: string, value: string, scene: Scene): Texture {
+            if (!value) {
+                return null;
+            }
+
             var url = rootUrl;
             // Load from input file.
             if (rootUrl === "file:") {

+ 4 - 9
src/Behaviors/Cameras/babylon.framingBehavior.ts

@@ -4,7 +4,7 @@ module BABYLON {
             return "Framing";
         }
 
-        private _mode = FramingBehavior.IgnoreBoundsSizeMode;
+        private _mode = FramingBehavior.FitFrustumSidesMode;
         private _radiusScale = 1.0;
         private _positionY = 0;
         private _defaultElevation = 0.3;
@@ -201,12 +201,10 @@ module BABYLON {
 		 * Targets the given mesh and updates zoom level accordingly.
 		 * @param mesh  The mesh to target.
 		 * @param radius Optional. If a cached radius position already exists, overrides default.
-		 * @param applyToLowerLimit Optional. Indicates if the calculated target radius should be applied to the
-		 *		camera's lower radius limit too.
 		 * @param framingPositionY Position on mesh to center camera focus where 0 corresponds bottom of its bounding box and 1, the top
 		 * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh
 		 */
-		public zoomOnMesh(mesh: AbstractMesh, radius?: number, applyToLowerLimit: boolean = true, framingPositionY?: number, focusOnOriginXZ: boolean = false): void {
+		public zoomOnMesh(mesh: AbstractMesh, radius?: number, framingPositionY?: number, focusOnOriginXZ: boolean = false): void {
 			if (framingPositionY == null) {
 				framingPositionY = this._positionY;
 			}
@@ -236,17 +234,14 @@ module BABYLON {
 				let delta = 0.1;
 				if (this._mode === FramingBehavior.FitFrustumSidesMode) {
 					let position = this._calculateLowerRadiusFromModelBoundingSphere(mesh);
-					this._attachedCamera.lowerRadiusLimit = position - delta;
+					this._attachedCamera.lowerRadiusLimit = mesh.getBoundingInfo().boundingSphere.radiusWorld + this._attachedCamera.minZ;
 					radius = position;
 				} else if (this._mode === FramingBehavior.IgnoreBoundsSizeMode) {
 					radius = this._calculateLowerRadiusFromModelBoundingSphere(mesh);
+					this._attachedCamera.lowerRadiusLimit = this._attachedCamera.minZ;
 				}
 			}
 
-			if (applyToLowerLimit) {
-				this._attachedCamera.lowerRadiusLimit = mesh.getBoundingInfo().boundingSphere.radiusWorld;;
-			}
-
 			// transition to new radius
 			if (!this._radiusTransition) {
 				this._radiusTransition = Animation.CreateAnimation("radius", Animation.ANIMATIONTYPE_FLOAT, 60, FramingBehavior.EasingFunction);

+ 5 - 3
src/Rendering/babylon.outlineRenderer.ts

@@ -38,14 +38,16 @@
             // Alpha test
             if (material && material.needAlphaTesting()) {
                 var alphaTexture = material.getAlphaTestTexture();
-                this._effect.setTexture("diffuseSampler", alphaTexture);
-                this._effect.setMatrix("diffuseMatrix", alphaTexture.getTextureMatrix());
+                if (alphaTexture) {
+                    this._effect.setTexture("diffuseSampler", alphaTexture);
+                    this._effect.setMatrix("diffuseMatrix", alphaTexture.getTextureMatrix());
+                }
             }
 
             engine.setZOffset(-this.zOffset);
 
             mesh._processRendering(subMesh, this._effect, Material.TriangleFillMode, batch, hardwareInstancedRendering,
-                (isInstance, world) => { this._effect.setMatrix("world", world)});
+                (isInstance, world) => { this._effect.setMatrix("world", world) });
 
             engine.setZOffset(0);
         }