import * as THREE from 'three'
import { threeLayer } from './initScene3D'
import { analysis } from '../business/statusManagement'

let setCount = 0

export default function (gl, scene, camera) {
  let renderer = threeLayer.getThreeRenderer()
  
  global.scene = scene

  let ambientLight = new THREE.AmbientLight( 0x262321, 0.3)
  scene.add(ambientLight)

  
  let frontLight = new THREE.DirectionalLight( 0xffffff,  0.2);
  frontLight.position.set(0,1,0)
  scene.add( new THREE.DirectionalLightHelper(frontLight) )
  scene.add( frontLight );


  let backLight = new THREE.DirectionalLight( 0xffffff,  0.1);
  backLight.position.set(0,0,1)
  scene.add( new THREE.DirectionalLightHelper(backLight) )
  scene.add( backLight );

  

  let sunLight = new THREE.DirectionalLight( 0xf2fee7, 0.6 );
  sunLight.position.set(80,0,-80).normalize();
  sunLight.castShadow = true;
  scene.add( sunLight );
  

 
 

  renderer.shadowMapEnabled = true;
  renderer.shadowMapSoft = true;

  if (++setCount === 1) {
    map.setPitch(analysis().pitch)
  }
}