DebugEnvironment.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import * as THREE from '../../../build/three.module.js';
  2. class DebugEnvironment extends THREE.Scene {
  3. constructor() {
  4. super();
  5. const geometry = new THREE.BoxGeometry();
  6. geometry.deleteAttribute( 'uv' );
  7. const roomMaterial = new THREE.MeshStandardMaterial( { metalness: 0, side: THREE.BackSide } );
  8. const room = new THREE.Mesh( geometry, roomMaterial );
  9. room.scale.setScalar( 10 );
  10. this.add( room );
  11. const mainLight = new THREE.PointLight( 0xffffff, 50, 0, 2 );
  12. this.add( mainLight );
  13. const material1 = new THREE.MeshLambertMaterial( { color: 0xff0000, emissive: 0xffffff, emissiveIntensity: 10 } );
  14. const light1 = new THREE.Mesh( geometry, material1 );
  15. light1.position.set( - 5, 2, 0 );
  16. light1.scale.set( 0.1, 1, 1 );
  17. this.add( light1 );
  18. const material2 = new THREE.MeshLambertMaterial( { color: 0x00ff00, emissive: 0xffffff, emissiveIntensity: 10 } );
  19. const light2 = new THREE.Mesh( geometry, material2 );
  20. light2.position.set( 0, 5, 0 );
  21. light2.scale.set( 1, 0.1, 1 );
  22. this.add( light2 );
  23. const material3 = new THREE.MeshLambertMaterial( { color: 0x0000ff, emissive: 0xffffff, emissiveIntensity: 10 } );
  24. const light3 = new THREE.Mesh( geometry, material3 );
  25. light3.position.set( 2, 1, 5 );
  26. light3.scale.set( 1.5, 2, 0.1 );
  27. this.add( light3 );
  28. }
  29. }
  30. export { DebugEnvironment };