Procházet zdrojové kódy

Merge pull request #1419 from sebavan/HighlightLayerExcludeList

Highlight layer exclude list
David Catuhe před 8 roky
rodič
revize
0287f72e80
2 změnil soubory, kde provedl 14 přidání a 6 odebrání
  1. 13 5
      src/Layer/babylon.highlightlayer.ts
  2. 1 1
      src/babylon.scene.ts

+ 13 - 5
src/Layer/babylon.highlightlayer.ts

@@ -45,6 +45,11 @@
          * Alpha blending mode used to apply the blur. Default is combine.
          */
         alphaBlendingMode?: number
+
+        /**
+         * The camera attached to the layer.
+         */
+        camera?: Camera;
     }
 
     /**
@@ -148,11 +153,6 @@
         public outerGlow: boolean = true;
 
         /**
-         * Helps enabling disabling the highlight depending on the layers being rendered.
-         */
-        public layerMask = 0xFFFFFFFF;
-
-        /**
          * Specifies the horizontal size of the blur.
          */
         public set blurHorizontalSize(value: number) {
@@ -181,6 +181,13 @@
         }
 
         /**
+         * Gets the camera attached to the layer.
+         */
+        public get camera(): Camera {
+            return this._options.camera;
+        }
+
+        /**
          * An event triggered when the highlight layer has been disposed.
          * @type {BABYLON.Observable}
          */
@@ -306,6 +313,7 @@
                 false,
                 true,
                 Engine.TEXTURETYPE_UNSIGNED_INT);
+            this._mainTexture.activeCamera = this._options.camera;
             this._mainTexture.wrapU = Texture.CLAMP_ADDRESSMODE;
             this._mainTexture.wrapV = Texture.CLAMP_ADDRESSMODE;
             this._mainTexture.anisotropicFilteringLevel = 1;

+ 1 - 1
src/babylon.scene.ts

@@ -2055,7 +2055,7 @@
             if (this.highlightLayers && this.highlightLayers.length > 0) {
                 for (let i = 0; i < this.highlightLayers.length; i++) {
                     let 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;