85f2b475e0a02e8e916383c963ea25f77339cc3d.svn-base 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import * as THREE from 'three'
  2. import { analysis } from '../business/statusManagement'
  3. export default function (gl, scene, camera) {
  4. let renderer = threeLayer.getThreeRenderer()
  5. global.scene = scene
  6. // camera.add(new THREE.PointLight(0xffffff))
  7. // // camera.far = 60000
  8. // camera.updateProjectionMatrix()
  9. // map.setPitch(60)
  10. /*
  11. var ground = new THREE.Mesh( new THREE.PlaneGeometry( 10000,10000,2,2 ), new THREE.MeshLambertMaterial({ color:0xffff00, side:THREE.DoubleSide, }))
  12. ground.name = "ground";
  13. ground.position.set(10030408, -46147088, 5.999996185302734);
  14. ground.receiveShadow = true;
  15. ground.castShadow = true
  16. scene.add(ground);
  17. var box = new THREE.Mesh(new THREE.BoxGeometry(1000, 1000, 1000), new THREE.MeshLambertMaterial({ color: 0xff0000 }));
  18. box.position.set(10030208, -46146088, -1000.01798629760742);
  19. box.castShadow = true;
  20. scene.add(box);
  21. let directionalLight = new THREE.DirectionalLight(0xffffff, 10);
  22. directionalLight.position.set(10030808, -46146088, -2100);
  23. directionalLight.castShadow = true;
  24. directionalLight.shadow.camera.near = 100;
  25. directionalLight.shadow.camera.far = 10000;
  26. directionalLight.shadow.camera.left = -10000;
  27. directionalLight.shadow.camera.bottom = -10000;
  28. directionalLight.shadow.camera.right = 10000;
  29. directionalLight.shadow.camera.top = 10000;
  30. directionalLight.target = box;
  31. scene.add(directionalLight);
  32. let helper = new THREE.DirectionalLightHelper(directionalLight);
  33. helper.scale.set(1000,1000,1000)
  34. scene.add(helper);
  35. */
  36. let ambientLight = new THREE.AmbientLight( 0x262321, 1)
  37. scene.add(ambientLight)
  38. let frontLight = new THREE.DirectionalLight( 0xffffff, 0.2 );
  39. frontLight.position.set(1,0,0)
  40. scene.add( new THREE.DirectionalLightHelper(frontLight) )
  41. scene.add( frontLight );
  42. let backLight = new THREE.DirectionalLight( 0xffffff, 0.2);
  43. backLight.position.set(-1,0,0)
  44. scene.add( new THREE.DirectionalLightHelper(backLight) )
  45. scene.add( backLight );
  46. let sunLight = new THREE.DirectionalLight( 0xf2fee7, 1 );
  47. sunLight.position.set(80,0,-80).normalize();
  48. sunLight.castShadow = true;
  49. scene.add( sunLight );
  50. map.setPitch(analysis().pitch)
  51. renderer.shadowMapEnabled = true;
  52. renderer.shadowMapSoft = true;
  53. }