	var Scene = (function() {
	var lerp = function(s, e, p) {
		return s - ((s - e) * p);
	}


	return {
		id: getIdForLastLoadedScript(),
		load: function()
		{
			this.scene = new THREE.Scene();

//			var light = new THREE.HemisphereLight( 0xff7a81, 0x000000, .5 );
			var light = new THREE.HemisphereLight( 0xffffff, 0x000000, .9 );
			light.position.y = 100;
			light.position.z = -100;
			light.position.x = -100;

			this.scene.add( light );

		//	this.axishelper = new THREE.AxisHelper(5); this.scene.add(this.axishelper);

			var sola = new THREE.DirectionalLight( 0x777777, 1);
			sola.color.setHSL( 0.1, 0.7, 0.7);
			sola.castShadow = true;
			sola.shadowDarkness = 0.5;
			//sola.shadowCameraVisible = true;
			sola.position.set(100,100,100);
			sola.shadowCameraNear = 0;
			sola.shadowCameraFar = 300;

			var d = 1000;
			sola.shadowCameraLeft = -d;
			sola.shadowCameraRight = d;
			sola.shadowCameraTop = d;
			sola.shadowCameraBottom = -d;
			sola.shadowMapWidth = 2048;
			sola.shadowMapHeight = 2048;
			//this.scene.add( new THREE.DirectionalLightHelper(sola, 0.2) );

			this.scene.add(sola);

			var mat = new THREE.MeshLambertMaterial({
					ambient: 0x999999,
					color: 0x11aF44,
					emissive: 0x001100,
					shading: THREE.FlatShading
					//wireframe: true
				});

			var ground = new THREE.Mesh(
				new THREE.BoxGeometry( 1000, .1, 1000 ),
				mat
			);

			ground.receiveShadow = true;
			this.scene.add(ground);

			this.composer = new THREE.EffectComposer(renderer);

			this.camera = new THREE.PerspectiveCamera(45, 16/9, 0.1, 1000);
			this.camera.position.set(-100, 100, -100);
			this.camera.lookAt(new THREE.Vector3(0, 0, 0));

			controls = new THREE.OrbitControls( this.camera );
			controls.addEventListener( 'change', render );
			/*
			var axisHelper = new THREE.AxisHelper( 5 );
			this.scene.add( axisHelper );
			*/
			this.busk = new Array();
			for(i=0;i<10;i++){
				for(j=0;j<10;j++){
				/*	var busk = gief_busk(i+j*10); */
				  this.busk[j+i*10] = new THREE.Busk();
					this.busk[j+i*10].position.x = 20*i-50+Math.random()*10;
					this.busk[j+i*10].position.z = 20*j-50+Math.random()*10;
					this.busk[j+i*10].scale.z = 1+Math.random();
					this.scene.add(this.busk[j+i*10]);
				}
			}
			this.cloud = new THREE.Cloud();
			this.cloud.position.y = 40;
			this.scene.add(this.cloud);

			this.renderPass = new THREE.RenderPass(this.scene, this.camera);
			this.composer.addPass(this.renderPass);

			this.composer.addPass(final_pass);
		},

		render: function(time, percent)
		{
//			this.camera.position.set(0, 10, lerp(-30,-40,percent*10));
			for (var i=0; i < this.busk.length; i++) {

				//this.busk[i].scale.z = percent;
				this.busk[i].setAge(percent);
			}
			this.cloud.position.x = -20+getVal('var1');
			renderer.shadowMapEnabled = true;
			renderer.shadowMapType = THREE.PCFSoftShadowMap;
			this.composer.render();
		}
	};
})();

var scenes = scenes || [];
scenes[Scene.id] = Scene;
