浏览代码

//Inspector improvements // Add a fullscreen button in the toolbar // add in the scene tab radio buttons to choose the active camera

Bloadrick 7 年之前
父节点
当前提交
7089588a85

+ 1 - 0
Tools/Gulp/config.json

@@ -1695,6 +1695,7 @@
                     "../../inspector/src/tools/LabelTool.ts",
                     "../../inspector/src/tools/LabelTool.ts",
                     "../../inspector/src/tools/Toolbar.ts",
                     "../../inspector/src/tools/Toolbar.ts",
                     "../../inspector/src/tools/DisposeTool.ts",
                     "../../inspector/src/tools/DisposeTool.ts",
+                    "../../inspector/src/tools/FullscreenTool.ts",
                     "../../inspector/src/tree/TreeItem.ts",
                     "../../inspector/src/tree/TreeItem.ts",
                     "../../inspector/src/treetools/AbstractTreeTool.ts",
                     "../../inspector/src/treetools/AbstractTreeTool.ts",
                     "../../inspector/src/treetools/BoundingBox.ts",
                     "../../inspector/src/treetools/BoundingBox.ts",

+ 18 - 0
inspector/src/tabs/SceneTab.ts

@@ -67,6 +67,24 @@ module INSPECTOR {
                 wireframe.addEventListener('click', () => { this._inspector.scene.forcePointsCloud = false; this._inspector.scene.forceWireframe = true; });
                 wireframe.addEventListener('click', () => { this._inspector.scene.forcePointsCloud = false; this._inspector.scene.forceWireframe = true; });
                 solid.addEventListener('click', () => { this._inspector.scene.forcePointsCloud = false; this._inspector.scene.forceWireframe = false; });
                 solid.addEventListener('click', () => { this._inspector.scene.forcePointsCloud = false; this._inspector.scene.forceWireframe = false; });
 
 
+                // Cameras
+                title = Helpers.CreateDiv('actions-title', this._actions);
+                title.textContent = 'Cameras';
+                let cameraRadioButtons = [];
+                for (let camera of this._inspector.scene.cameras) {
+                    let cameraRadio = Helpers.CreateDiv('action-radio', this._actions);
+                    cameraRadio.textContent = camera.name;
+                    if(this._inspector.scene.activeCamera == camera)
+                    {
+                        cameraRadio.classList.add('active');
+                    }
+                    cameraRadioButtons.push(cameraRadio);
+                    cameraRadio.addEventListener('click', () => { this._inspector.scene.switchActiveCamera(camera);});
+                }
+
+                this._generateRadioAction(cameraRadioButtons);
+                
+
                 // Textures
                 // Textures
                 title = Helpers.CreateDiv('actions-title', this._actions);
                 title = Helpers.CreateDiv('actions-title', this._actions);
                 title.textContent = 'Textures channels';
                 title.textContent = 'Textures channels';

+ 23 - 0
inspector/src/tools/FullscreenTool.ts

@@ -0,0 +1,23 @@
+module INSPECTOR {
+     
+    export class FullscreenTool extends AbstractTool {
+
+        constructor(parent:HTMLElement, inspector:Inspector) {
+            super('fa-expand', parent, inspector, 'Open the scene in fullscreen, press Esc to exit');
+        }
+
+        // Action : refresh the whole panel
+        public action() {
+
+            var elem = document.body;
+
+            function requestFullScreen(element:HTMLElement) {
+                // Supports most browsers and their versions.
+                var requestMethod = element.requestFullscreen || element.webkitRequestFullScreen;
+                requestMethod.call(element);
+            }
+           
+            requestFullScreen(elem);
+        }
+    }
+}

+ 3 - 0
inspector/src/tools/Toolbar.ts

@@ -33,6 +33,9 @@
             if (!this._inspector.popupMode && !Helpers.IsBrowserEdge()) {
             if (!this._inspector.popupMode && !Helpers.IsBrowserEdge()) {
                 this._tools.push(new PopupTool(this._div, this._inspector));
                 this._tools.push(new PopupTool(this._div, this._inspector));
             }
             }
+            // FullScreen
+            this._tools.push(new FullscreenTool(this._div, this._inspector));
+
             // Pause schedule
             // Pause schedule
             this._tools.push(new PauseScheduleTool(this._div, this._inspector));
             this._tools.push(new PauseScheduleTool(this._div, this._inspector));
             
             

+ 15 - 0
inspector/test/index.js

@@ -36,6 +36,21 @@ var Test = (function () {
         var scene = new BABYLON.Scene(this.engine);
         var scene = new BABYLON.Scene(this.engine);
         var canvas = scene.getEngine().getRenderingCanvas();
         var canvas = scene.getEngine().getRenderingCanvas();
 
 
+        var camera = new BABYLON.FreeCamera("Camera", new BABYLON.Vector3(0, 0, 0), scene); 
+        
+        var camera2 = new BABYLON.ArcRotateCamera("Camera2", 0, 0, -0.1, new BABYLON.Vector3(0, 0, 0), scene);
+
+        var camera3 = new BABYLON.ArcRotateCamera("Camera3", 0, 0, -0.1, new BABYLON.Vector3(0, 0, 0), scene);
+
+        var camera4 = new BABYLON.ArcRotateCamera("Camera4", 0, 0, -0.1, new BABYLON.Vector3(0, 0, 0), scene);
+
+        var camera5 = new BABYLON.ArcRotateCamera("Camera5", 0, 0, -0.1, new BABYLON.Vector3(0, 0, 0), scene);
+
+        var camera6 = new BABYLON.ArcRotateCamera("Camera6", 0, 0, -0.1, new BABYLON.Vector3(0, 0, 0), scene);
+
+        scene.activeCamera = camera2;
+        
+        camera2.attachControl(canvas);
 
 
         var sceneRoot = new BABYLON.TransformNode("abstractmesh");
         var sceneRoot = new BABYLON.TransformNode("abstractmesh");