Преглед изворни кода

Editor: Add support for `Scene.backgroundIntensity`. (#25216)

* ObjectLoader: Honor Scene.backgroundIntensity.

* Editor: Add support for Scene.backgroundIntensity.

* Editor: Update max value of backgroundIntensity.
Michael Herzog пре 2 година
родитељ
комит
351bfc6387
4 измењених фајлова са 10 додато и 2 уклоњено
  1. 1 0
      editor/js/Editor.js
  2. 6 1
      editor/js/Sidebar.Scene.js
  3. 2 1
      editor/js/Viewport.js
  4. 1 0
      src/loaders/ObjectLoader.js

+ 1 - 0
editor/js/Editor.js

@@ -137,6 +137,7 @@ Editor.prototype = {
 		this.scene.environment = scene.environment;
 		this.scene.fog = scene.fog;
 		this.scene.backgroundBlurriness = scene.backgroundBlurriness;
+		this.scene.backgroundIntensity = scene.backgroundIntensity;
 
 		this.scene.userData = JSON.parse( JSON.stringify( scene.userData ) );
 

+ 6 - 1
editor/js/Sidebar.Scene.js

@@ -192,6 +192,9 @@ function SidebarScene( editor ) {
 	const backgroundBlurriness = new UINumber( 0 ).setWidth( '40px' ).setRange( 0, 1 ).onChange( onBackgroundChanged );
 	backgroundEquirectRow.add( backgroundBlurriness );
 
+	const backgroundIntensity = new UINumber( 1 ).setWidth( '40px' ).setRange( 0, Infinity ).onChange( onBackgroundChanged );
+	backgroundEquirectRow.add( backgroundIntensity );
+
 	container.add( backgroundEquirectRow );
 
 	function onBackgroundChanged() {
@@ -201,7 +204,8 @@ function SidebarScene( editor ) {
 			backgroundColor.getHexValue(),
 			backgroundTexture.getValue(),
 			backgroundEquirectangularTexture.getValue(),
-			backgroundBlurriness.getValue()
+			backgroundBlurriness.getValue(),
+			backgroundIntensity.getValue()
 		);
 
 	}
@@ -396,6 +400,7 @@ function SidebarScene( editor ) {
 					backgroundType.setValue( 'Equirectangular' );
 					backgroundEquirectangularTexture.setValue( scene.background );
 					backgroundBlurriness.setValue( scene.backgroundBlurriness );
+					backgroundIntensity.setValue( scene.backgroundIntensity );
 
 				} else {
 

+ 2 - 1
editor/js/Viewport.js

@@ -481,7 +481,7 @@ function Viewport( editor ) {
 
 	// background
 
-	signals.sceneBackgroundChanged.add( function ( backgroundType, backgroundColor, backgroundTexture, backgroundEquirectangularTexture, backgroundBlurriness ) {
+	signals.sceneBackgroundChanged.add( function ( backgroundType, backgroundColor, backgroundTexture, backgroundEquirectangularTexture, backgroundBlurriness, backgroundIntensity ) {
 
 		switch ( backgroundType ) {
 
@@ -514,6 +514,7 @@ function Viewport( editor ) {
 					backgroundEquirectangularTexture.mapping = THREE.EquirectangularReflectionMapping;
 					scene.background = backgroundEquirectangularTexture;
 					scene.backgroundBlurriness = backgroundBlurriness;
+					scene.backgroundIntensity = backgroundIntensity;
 
 				}
 

+ 1 - 0
src/loaders/ObjectLoader.js

@@ -784,6 +784,7 @@ class ObjectLoader extends Loader {
 				}
 
 				if ( data.backgroundBlurriness !== undefined ) object.backgroundBlurriness = data.backgroundBlurriness;
+				if ( data.backgroundIntensity !== undefined ) object.backgroundIntensity = data.backgroundIntensity;
 
 				break;