David Catuhe 8 years ago
parent
commit
e4a8643a17

File diff suppressed because it is too large
+ 23 - 23
dist/preview release/babylon.core.js


File diff suppressed because it is too large
+ 6481 - 6477
dist/preview release/babylon.d.ts


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


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


File diff suppressed because it is too large
+ 24 - 24
dist/preview release/babylon.noworker.js


+ 11 - 4
src/Layer/babylon.highlightlayer.js

@@ -57,10 +57,6 @@ var BABYLON;
              */
             this.outerGlow = true;
             /**
-             * Helps enabling disabling the highlight depending on the layers being rendered.
-             */
-            this.layerMask = 0xFFFFFFFF;
-            /**
              * An event triggered when the highlight layer has been disposed.
              * @type {BABYLON.Observable}
              */
@@ -173,6 +169,16 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(HighlightLayer.prototype, "camera", {
+            /**
+             * Gets the camera attached to the layer.
+             */
+            get: function () {
+                return this._options.camera;
+            },
+            enumerable: true,
+            configurable: true
+        });
         /**
          * Creates the render target textures and post processes used in the highlight layer.
          */
@@ -186,6 +192,7 @@ var BABYLON;
                 width: this._mainTextureDesiredSize.width,
                 height: this._mainTextureDesiredSize.height
             }, this._scene, false, true, BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT);
+            this._mainTexture.activeCamera = this._options.camera;
             this._mainTexture.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
             this._mainTexture.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
             this._mainTexture.anisotropicFilteringLevel = 1;

+ 2 - 2
src/Materials/babylon.shaderMaterial.js

@@ -108,7 +108,7 @@ var BABYLON;
             this._matrices2x2[name] = value;
             return this;
         };
-        ShaderMaterial.prototype.setVector3Array = function (name, value) {
+        ShaderMaterial.prototype.setArray3 = function (name, value) {
             this._checkUniform(name);
             this._vectors3Arrays[name] = value;
             return this;
@@ -392,7 +392,7 @@ var BABYLON;
             }
             // Vector3Array
             for (name in source.vectors3Arrays) {
-                material.setVector3Array(name, source.vectors3Arrays[name]);
+                material.setArray3(name, source.vectors3Arrays[name]);
             }
             return material;
         };

+ 15 - 30
src/Math/babylon.math.js

@@ -1542,36 +1542,21 @@ var BABYLON;
         };
         Quaternion.prototype.toEulerAnglesToRef = function (result, order) {
             if (order === void 0) { order = "YZX"; }
-            var heading, attitude, bank;
-            var x = this.x, y = this.y, z = this.z, w = this.w;
-            switch (order) {
-                case "YZX":
-                    var test = x * y + z * w;
-                    if (test > 0.499) {
-                        heading = 2 * Math.atan2(x, w);
-                        attitude = Math.PI / 2;
-                        bank = 0;
-                    }
-                    if (test < -0.499) {
-                        heading = -2 * Math.atan2(x, w);
-                        attitude = -Math.PI / 2;
-                        bank = 0;
-                    }
-                    if (isNaN(heading)) {
-                        var sqx = x * x;
-                        var sqy = y * y;
-                        var sqz = z * z;
-                        heading = Math.atan2(2 * y * w - 2 * x * z, 1 - 2 * sqy - 2 * sqz); // Heading
-                        attitude = Math.asin(2 * test); // attitude
-                        bank = Math.atan2(2 * x * w - 2 * y * z, 1 - 2 * sqx - 2 * sqz); // bank
-                    }
-                    break;
-                default:
-                    throw new Error("Euler order " + order + " not supported yet.");
-            }
-            result.y = heading;
-            result.z = attitude;
-            result.x = bank;
+            var qx = this.x;
+            var qy = this.y;
+            var qz = this.z;
+            var qw = this.w;
+            var xsqr = qx * qx;
+            var t0 = -2.0 * (xsqr + qy * qy) + 1.0;
+            var t1 = 2.0 * (qz * qx + qw * qy);
+            var t2 = -2.0 * (qz * qy - qw * qx);
+            var t3 = 2.0 * (qx * qy + qw * qz);
+            var t4 = -2.0 * (qz * qz + xsqr) + 1.0;
+            t2 = t2 > 1.0 ? 1.0 : t2;
+            t2 = t2 < -1.0 ? -1.0 : t2;
+            result.x = Math.asin(t2);
+            result.z = Math.atan2(t3, t4);
+            result.y = Math.atan2(t1, t0);
             return this;
         };
         ;

+ 1 - 1
src/babylon.scene.js

@@ -1735,7 +1735,7 @@ var BABYLON;
             if (this.highlightLayers && this.highlightLayers.length > 0) {
                 for (var i = 0; i < this.highlightLayers.length; i++) {
                     var highlightLayer = this.highlightLayers[i];
-                    if ((highlightLayer.layerMask & camera.layerMask) && highlightLayer.shouldRender()) {
+                    if ((!highlightLayer.camera || camera == highlightLayer.camera) && highlightLayer.shouldRender()) {
                         renderhighlights = true;
                         this._engine.setStencilBuffer(true);
                         break;