Przeglądaj źródła

Editor: Added modelviewer environment.

Mr.doob 4 lat temu
rodzic
commit
b2dde29456
3 zmienionych plików z 9 dodań i 1 usunięć
  1. 2 1
      editor/js/Sidebar.Scene.js
  2. 5 0
      editor/js/Viewport.js
  3. 2 0
      editor/sw.js

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

@@ -216,7 +216,8 @@ function SidebarScene( editor ) {
 	var environmentType = new UISelect().setOptions( {
 	var environmentType = new UISelect().setOptions( {
 
 
 		'None': '',
 		'None': '',
-		'Background': 'Background'
+		'Background': 'Background',
+		'ModelViewer': 'ModelViewer'
 
 
 	} ).setWidth( '150px' );
 	} ).setWidth( '150px' );
 	environmentType.setValue( 'None' );
 	environmentType.setValue( 'None' );

+ 5 - 0
editor/js/Viewport.js

@@ -15,6 +15,8 @@ import { SetPositionCommand } from './commands/SetPositionCommand.js';
 import { SetRotationCommand } from './commands/SetRotationCommand.js';
 import { SetRotationCommand } from './commands/SetRotationCommand.js';
 import { SetScaleCommand } from './commands/SetScaleCommand.js';
 import { SetScaleCommand } from './commands/SetScaleCommand.js';
 
 
+import { RoomEnvironment } from '../../examples/jsm/environments/RoomEnvironment.js';
+
 function Viewport( editor ) {
 function Viewport( editor ) {
 
 
 	var signals = editor.signals;
 	var signals = editor.signals;
@@ -603,6 +605,9 @@ function Viewport( editor ) {
 			case 'Background':
 			case 'Background':
 				scene.environment = pmremTexture;
 				scene.environment = pmremTexture;
 				break;
 				break;
+			case 'ModelViewer':
+				scene.environment = pmremGenerator.fromScene( new RoomEnvironment() ).texture;
+				break;
 
 
 		}
 		}
 
 

+ 2 - 0
editor/sw.js

@@ -52,6 +52,8 @@ const assets = [
 	'../examples/jsm/curves/NURBSCurve.js',
 	'../examples/jsm/curves/NURBSCurve.js',
 	'../examples/jsm/curves/NURBSUtils.js',
 	'../examples/jsm/curves/NURBSUtils.js',
 
 
+	'../examples/jsm/environments/RoomEnvironment.js',
+
 	'../examples/jsm/exporters/ColladaExporter.js',
 	'../examples/jsm/exporters/ColladaExporter.js',
 	'../examples/jsm/exporters/DRACOExporter.js',
 	'../examples/jsm/exporters/DRACOExporter.js',
 	'../examples/jsm/exporters/GLTFExporter.js',
 	'../examples/jsm/exporters/GLTFExporter.js',