提交 ec5926a7 编写于 作者: M Mr.doob

Docs: Implemented scene.environment in material browser

上级 f9a36387
......@@ -29,6 +29,7 @@
import * as THREE from '../../build/three.module.js';
import * as DAT from '../../examples/jsm/libs/dat.gui.module.js';
import { RoomEnvironment } from '../../examples/jsm/environments/RoomEnvironment.js';
const constants = {
......@@ -650,6 +651,12 @@
guiMaterial( gui, mesh, material, geometry );
guiMeshStandardMaterial( gui, mesh, material, geometry );
// only use scene environment
light1.visible = false;
light2.visible = false;
light3.visible = false;
return material;
break;
......@@ -660,6 +667,12 @@
guiMaterial( gui, mesh, material, geometry );
guiMeshPhysicalMaterial( gui, mesh, material, geometry );
// only use scene environment
light1.visible = false;
light2.visible = false;
light3.visible = false;
return material;
break;
......@@ -704,17 +717,22 @@
const gui = new DAT.GUI();
const renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.outputEncoding = THREE.sRGBEncoding;
document.body.appendChild( renderer.domElement );
const environment = new RoomEnvironment();
const pmremGenerator = new THREE.PMREMGenerator( renderer );
const scene = new THREE.Scene();
scene.background = new THREE.Color( 0x444444 );
scene.environment = pmremGenerator.fromScene( environment ).texture;
const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 10, 50 );
camera.position.z = 30;
const renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );
const ambientLight = new THREE.AmbientLight( 0x000000 );
scene.add( ambientLight );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册