Skip to content

Commit

Permalink
Examples: Introduced DebugEnvironment
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Mar 16, 2021
1 parent d28e6e0 commit 34519f5
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 4 deletions.
42 changes: 42 additions & 0 deletions examples/jsm/environments/DebugEnvironment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import * as THREE from '../../../build/three.module.js';

function DebugEnvironment() {

const envScene = new THREE.Scene();

const geometry = new THREE.BoxGeometry();
geometry.deleteAttribute( 'uv' );
const roomMaterial = new THREE.MeshStandardMaterial( { metalness: 0, side: THREE.BackSide } );
const room = new THREE.Mesh( geometry, roomMaterial );
room.scale.setScalar( 10 );
envScene.add( room );

const mainLight = new THREE.PointLight( 0xffffff, 50, 0, 2 );
envScene.add( mainLight );

const material1 = new THREE.MeshLambertMaterial( { color: 0xff0000, emissive: 0xffffff, emissiveIntensity: 10 } );

const light1 = new THREE.Mesh( geometry, material1 );
light1.position.set( - 5, 2, 0 );
light1.scale.set( 0.1, 1, 1 );
envScene.add( light1 );

const material2 = new THREE.MeshLambertMaterial( { color: 0x00ff00, emissive: 0xffffff, emissiveIntensity: 10 } );

const light2 = new THREE.Mesh( geometry, material2 );
light2.position.set( 0, 5, 0 );
light2.scale.set( 1, 0.1, 1 );
envScene.add( light2 );

const material3 = new THREE.MeshLambertMaterial( { color: 0x0000ff, emissive: 0xffffff, emissiveIntensity: 10 } );

const light3 = new THREE.Mesh( geometry, material3 );
light3.position.set( 2, 1, 5 );
light3.scale.set( 1.5, 2, 0.1 );
envScene.add( light3 );

return envScene;

}

export { DebugEnvironment };
4 changes: 2 additions & 2 deletions examples/webgl_materials_envmaps_hdr.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import { OrbitControls } from './jsm/controls/OrbitControls.js';
import { HDRCubeTextureLoader } from './jsm/loaders/HDRCubeTextureLoader.js';
import { RGBMLoader } from './jsm/loaders/RGBMLoader.js';
import { RoomEnvironment } from './jsm/environments/RoomEnvironment.js';
import { DebugEnvironment } from './jsm/environments/DebugEnvironment.js';

const params = {
envMap: 'HDR',
Expand Down Expand Up @@ -125,7 +125,7 @@
const pmremGenerator = new THREE.PMREMGenerator( renderer );
pmremGenerator.compileCubemapShader();

const envScene = new RoomEnvironment();
const envScene = new DebugEnvironment();
generatedCubeRenderTarget = pmremGenerator.fromScene( envScene );

renderer.setPixelRatio( window.devicePixelRatio );
Expand Down
4 changes: 2 additions & 2 deletions examples/webgl_materials_envmaps_hdr_nodes.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import { OrbitControls } from './jsm/controls/OrbitControls.js';
import { HDRCubeTextureLoader } from './jsm/loaders/HDRCubeTextureLoader.js';
import { RGBMLoader } from './jsm/loaders/RGBMLoader.js';
import { RoomEnvironment } from './jsm/environments/RoomEnvironment.js';
import { DebugEnvironment } from './jsm/environments/DebugEnvironment.js';

import { MeshStandardNodeMaterial } from './jsm/nodes/Nodes.js';

Expand Down Expand Up @@ -134,7 +134,7 @@
const pmremGenerator = new THREE.PMREMGenerator( renderer );
pmremGenerator.compileCubemapShader();

const envScene = new RoomEnvironment();
const envScene = new DebugEnvironment();
generatedCubeRenderTarget = pmremGenerator.fromScene( envScene );

renderer.setPixelRatio( window.devicePixelRatio );
Expand Down

0 comments on commit 34519f5

Please sign in to comment.