From 6c27538343192467348f23a9b9c6491cf4d96b56 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Wed, 27 Feb 2019 22:26:06 -0800 Subject: [PATCH] Editor: Removed gammaInput/gammaOutput settings and set gammaOutput true by default. --- editor/examples/arkanoid.app.json | 2 -- editor/examples/camera.app.json | 2 -- editor/examples/particles.app.json | 2 -- editor/examples/pong.app.json | 2 -- editor/examples/shaders.app.json | 2 -- editor/js/Config.js | 2 -- editor/js/Editor.js | 2 -- editor/js/Sidebar.Project.js | 33 +++++------------------------- editor/js/Strings.js | 4 ---- editor/js/Viewport.js | 1 + editor/js/libs/app.js | 3 +-- 11 files changed, 7 insertions(+), 48 deletions(-) diff --git a/editor/examples/arkanoid.app.json b/editor/examples/arkanoid.app.json index cd08f7b9b78c94..02c4090a85957d 100644 --- a/editor/examples/arkanoid.app.json +++ b/editor/examples/arkanoid.app.json @@ -3,8 +3,6 @@ "type": "App" }, "project": { - "gammaInput": true, - "gammaOutput": true, "shadows": true, "vr": false }, diff --git a/editor/examples/camera.app.json b/editor/examples/camera.app.json index 79f4bfd4213b8f..e6de7466600ad9 100644 --- a/editor/examples/camera.app.json +++ b/editor/examples/camera.app.json @@ -3,8 +3,6 @@ "type": "App" }, "project": { - "gammaInput": true, - "gammaOutput": true, "shadows": true, "vr": false }, diff --git a/editor/examples/particles.app.json b/editor/examples/particles.app.json index e8a9347875038b..d9c1da0fb33fd1 100644 --- a/editor/examples/particles.app.json +++ b/editor/examples/particles.app.json @@ -3,8 +3,6 @@ "type": "App" }, "project": { - "gammaInput": true, - "gammaOutput": true, "shadows": true, "vr": false }, diff --git a/editor/examples/pong.app.json b/editor/examples/pong.app.json index cd06eec9c7c0d7..bb7a2cbc360058 100644 --- a/editor/examples/pong.app.json +++ b/editor/examples/pong.app.json @@ -3,8 +3,6 @@ "type": "App" }, "project": { - "gammaInput": true, - "gammaOutput": true, "shadows": true, "vr": false }, diff --git a/editor/examples/shaders.app.json b/editor/examples/shaders.app.json index b0881a4b543718..91922d2ba234fa 100755 --- a/editor/examples/shaders.app.json +++ b/editor/examples/shaders.app.json @@ -3,8 +3,6 @@ "type": "App" }, "project": { - "gammaInput": true, - "gammaOutput": true, "shadows": true, "vr": false }, diff --git a/editor/js/Config.js b/editor/js/Config.js index 8f4af901c186b7..68094fbeef495c 100644 --- a/editor/js/Config.js +++ b/editor/js/Config.js @@ -17,8 +17,6 @@ var Config = function () { 'project/renderer': 'WebGLRenderer', 'project/renderer/antialias': true, - 'project/renderer/gammaInput': false, - 'project/renderer/gammaOutput': false, 'project/renderer/shadows': true, 'project/vr': false, diff --git a/editor/js/Editor.js b/editor/js/Editor.js index 899b827cf04211..9c45f92625aca3 100644 --- a/editor/js/Editor.js +++ b/editor/js/Editor.js @@ -535,8 +535,6 @@ Editor.prototype = { metadata: {}, project: { - gammaInput: this.config.getKey( 'project/renderer/gammaInput' ), - gammaOutput: this.config.getKey( 'project/renderer/gammaOutput' ), shadows: this.config.getKey( 'project/renderer/shadows' ), vr: this.config.getKey( 'project/vr' ) }, diff --git a/editor/js/Sidebar.Project.js b/editor/js/Sidebar.Project.js index 61dbd2463db4dc..4e4627a7829b86 100644 --- a/editor/js/Sidebar.Project.js +++ b/editor/js/Sidebar.Project.js @@ -119,45 +119,22 @@ Sidebar.Project = function ( editor ) { } ); rendererPropertiesRow.add( rendererShadows ); - rendererPropertiesRow.add( new UI.Break() ); - - // Renderer / Gamma input - - var rendererGammaInput = new UI.THREE.Boolean( config.getKey( 'project/renderer/gammaInput' ), strings.getKey( 'sidebar/project/gammainput' ) ).onChange( function () { - - config.setKey( 'project/renderer/gammaInput', this.getValue() ); - updateRenderer(); - - } ); - rendererPropertiesRow.add( rendererGammaInput ); - - // Renderer / Gamma output - - var rendererGammaOutput = new UI.THREE.Boolean( config.getKey( 'project/renderer/gammaOutput' ), strings.getKey( 'sidebar/project/gammaoutput' ) ).onChange( function () { - - config.setKey( 'project/renderer/gammaOutput', this.getValue() ); - updateRenderer(); - - } ); - rendererPropertiesRow.add( rendererGammaOutput ); - container.add( rendererPropertiesRow ); // function updateRenderer() { - createRenderer( rendererType.getValue(), rendererAntialias.getValue(), rendererShadows.getValue(), rendererGammaInput.getValue(), rendererGammaOutput.getValue() ); + createRenderer( rendererType.getValue(), rendererAntialias.getValue() ); } - function createRenderer( type, antialias, shadows, gammaIn, gammaOut ) { + function createRenderer( type, antialias, shadows ) { rendererPropertiesRow.setDisplay( type === 'WebGLRenderer' ? '' : 'none' ); - var renderer = new rendererTypes[ type ]( { antialias: antialias} ); - renderer.gammaInput = gammaIn; - renderer.gammaOutput = gammaOut; + var renderer = new rendererTypes[ type ]( { antialias: antialias } ); + if ( shadows && renderer.shadowMap ) { renderer.shadowMap.enabled = true; @@ -169,7 +146,7 @@ Sidebar.Project = function ( editor ) { } - createRenderer( config.getKey( 'project/renderer' ), config.getKey( 'project/renderer/antialias' ), config.getKey( 'project/renderer/shadows' ), config.getKey( 'project/renderer/gammaInput' ), config.getKey( 'project/renderer/gammaOutput' ) ); + createRenderer( config.getKey( 'project/renderer' ), config.getKey( 'project/renderer/antialias' ), config.getKey( 'project/renderer/shadows' ) ); return container; diff --git a/editor/js/Strings.js b/editor/js/Strings.js index 29e946ae74fcf5..509293133711b2 100644 --- a/editor/js/Strings.js +++ b/editor/js/Strings.js @@ -236,8 +236,6 @@ var Strings = function ( config ) { 'sidebar/project/renderer': 'Renderer', 'sidebar/project/antialias': 'antialias', 'sidebar/project/shadows': 'shadows', - 'sidebar/project/gammainput': 'γ input', - 'sidebar/project/gammaoutput': 'γ output', 'sidebar/settings': 'Settings', 'sidebar/settings/language': 'Language', @@ -485,8 +483,6 @@ var Strings = function ( config ) { 'sidebar/project/renderer': '渲染器', 'sidebar/project/antialias': '抗锯齿', 'sidebar/project/shadows': '阴影', - 'sidebar/project/gammainput': 'γ输入', - 'sidebar/project/gammaoutput': 'γ输出', 'sidebar/settings': '设置', 'sidebar/settings/language': '语言', diff --git a/editor/js/Viewport.js b/editor/js/Viewport.js index 3b08832a60af9f..a7adb42a20c284 100644 --- a/editor/js/Viewport.js +++ b/editor/js/Viewport.js @@ -312,6 +312,7 @@ var Viewport = function ( editor ) { renderer.autoClear = false; renderer.autoUpdateScene = false; + renderer.gammaOutput = true; renderer.setPixelRatio( window.devicePixelRatio ); renderer.setSize( container.dom.offsetWidth, container.dom.offsetHeight ); diff --git a/editor/js/libs/app.js b/editor/js/libs/app.js index 4ee529ce8d8a84..bbc4a06701ad9c 100644 --- a/editor/js/libs/app.js +++ b/editor/js/libs/app.js @@ -21,13 +21,12 @@ var APP = { this.load = function ( json ) { renderer = new THREE.WebGLRenderer( { antialias: true } ); + renderer.gammaOutput = true; renderer.setClearColor( 0x000000 ); renderer.setPixelRatio( window.devicePixelRatio ); var project = json.project; - if ( project.gammaInput ) renderer.gammaInput = true; - if ( project.gammaOutput ) renderer.gammaOutput = true; if ( project.shadows ) renderer.shadowMap.enabled = true; if ( project.vr ) renderer.vr.enabled = true;