Sfoglia il codice sorgente

Add exposure to gui (#29311)

WestLangley 1 anno fa
parent
commit
7c5ac383c8
1 ha cambiato i file con 16 aggiunte e 16 eliminazioni
  1. 16 16
      examples/webgl_tonemapping.html

+ 16 - 16
examples/webgl_tonemapping.html

@@ -129,10 +129,11 @@
 				window.addEventListener( 'resize', onWindowResize );
 
 				gui = new GUI();
-				const toneMappingFolder = gui.addFolder( 'tone mapping' );
+				const toneMappingFolder = gui.addFolder( 'Tone Mapping' );
 
 				toneMappingFolder.add( params, 'toneMapping', Object.keys( toneMappingOptions ) )
 
+					.name( 'type' )
 					.onChange( function () {
 
 						updateGUI( toneMappingFolder );
@@ -142,7 +143,16 @@
 
 					} );
 
-				const backgroundFolder = gui.addFolder( 'background' );
+				guiExposure = toneMappingFolder.add( params, 'exposure', 0, 2 )
+
+					.onChange( function ( value ) {
+
+						renderer.toneMappingExposure = value;
+						render();
+
+					} );
+
+				const backgroundFolder = gui.addFolder( 'Background' );
 
 				backgroundFolder.add( params, 'blurriness', 0, 1 )
 
@@ -170,23 +180,13 @@
 
 			function updateGUI( folder ) {
 
-				if ( guiExposure !== null ) {
-
-					guiExposure.destroy();
-					guiExposure = null;
-
-				}
-
-				if ( params.toneMapping !== 'None' ) {
-
-					guiExposure = folder.add( params, 'exposure', 0, 2 )
+				if ( params.toneMapping === 'None' ) {
 
-						.onChange( function () {
+					guiExposure.hide();
 
-							renderer.toneMappingExposure = params.exposure;
-							render();
+				} else {
 
-						} );
+					guiExposure.show();
 
 				}
 

粤ICP备19079148号