DebugEnvironment.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. ( function () {
  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( {
  8. metalness: 0,
  9. side: THREE.BackSide
  10. } );
  11. const room = new THREE.Mesh( geometry, roomMaterial );
  12. room.scale.setScalar( 10 );
  13. this.add( room );
  14. const mainLight = new THREE.PointLight( 0xffffff, 50, 0, 2 );
  15. this.add( mainLight );
  16. const material1 = new THREE.MeshLambertMaterial( {
  17. color: 0xff0000,
  18. emissive: 0xffffff,
  19. emissiveIntensity: 10
  20. } );
  21. const light1 = new THREE.Mesh( geometry, material1 );
  22. light1.position.set( - 5, 2, 0 );
  23. light1.scale.set( 0.1, 1, 1 );
  24. this.add( light1 );
  25. const material2 = new THREE.MeshLambertMaterial( {
  26. color: 0x00ff00,
  27. emissive: 0xffffff,
  28. emissiveIntensity: 10
  29. } );
  30. const light2 = new THREE.Mesh( geometry, material2 );
  31. light2.position.set( 0, 5, 0 );
  32. light2.scale.set( 1, 0.1, 1 );
  33. this.add( light2 );
  34. const material3 = new THREE.MeshLambertMaterial( {
  35. color: 0x0000ff,
  36. emissive: 0xffffff,
  37. emissiveIntensity: 10
  38. } );
  39. const light3 = new THREE.Mesh( geometry, material3 );
  40. light3.position.set( 2, 1, 5 );
  41. light3.scale.set( 1.5, 2, 0.1 );
  42. this.add( light3 );
  43. }
  44. }
  45. THREE.DebugEnvironment = DebugEnvironment;
  46. } )();