DebugEnvironment.js 1.3 KB

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