Просмотр исходного кода

Addition of "isForeground" property.

Addition of "isForeground" to AdvancedDynamicTexture, 
allowing easy on-the-go switch between rendering in foreground and background.

Useful when working with multiple GUI's in a single AdvancedDynamicTexture.
e.g. out-of-game GUI rendered in background to allow rendering 3d models infront of the GUI, 
and in-game GUI rendered in foreground.
aWeirdo 7 лет назад
Родитель
Сommit
b9ea3c9b1d
1 измененных файлов с 12 добавлено и 1 удалено
  1. 12 1
      gui/src/advancedDynamicTexture.ts

+ 12 - 1
gui/src/advancedDynamicTexture.ts

@@ -113,6 +113,17 @@ module BABYLON.GUI {
 
             this._focusedControl = control;
         }
+        
+        public get isForeground(): boolean {
+            return (!this.layer.isBackground);
+        }
+
+        public set isForeground(value: boolean) {
+            if (this.layer.isBackground === !value) {
+                return;
+            }
+            this.layer.isBackground = !value;
+        }   
        
         constructor(name: string, width = 0, height = 0, scene: Nullable<Scene>, generateMipMaps = false, samplingMode = Texture.NEAREST_SAMPLINGMODE) {
             super(name, {width: width, height: height}, scene, generateMipMaps, samplingMode, Engine.TEXTUREFORMAT_RGBA);
@@ -507,4 +518,4 @@ module BABYLON.GUI {
             return result;
         }
     }    
-}
+}