Code viewer for World: Light Test World
// These 3 have default values, so this section is optional:

AB.clockTick       = 33;    

	// Speed of run: Step every n milliseconds. Default 100.
	
AB.maxSteps        = 1000000;    

	// Length of run: Maximum length of run in steps. Default 1000.

AB.screenshotStep  = 50;   


const SKYCOLOR 	= 0x6495ED;
const MAXPOS                = 4000 ;                                 
const startRadiusConst	 	= MAXPOS * 0.5 ;		// distance from centre to start the camera at
const maxRadiusConst 		= MAXPOS * 5 ;		// maximum distance from camera we will render things
const objectsize 	= 40;
function World() { 

	// Optional declaration:
	// If endCondition is declared, runs will check for endCondition true and then terminate.
	// If not declared, runs will make no such check.
	
	this.endCondition = false;				  


	// Optional functions:
	// The following function declarations are optional.
	// If not declared, nothing happens and the run continues.
	
	this.newRun = function()
	{
		// Code for Three.js initial drawing of objects.
		// Should include one of:
	 	// threeworld.init2d ( arguments ); 	
	 	threeworld.init3d ( startRadiusConst, maxRadiusConst, SKYCOLOR  ); 
	 	 // can adjust renderer:
    	threeworld.renderer.shadowMap.enabled = true;
    	threeworld.renderer.shadowMap.type = THREE.PCFSoftShadowMap;
    	threeworld.renderer.domElement.style.position = "relative";
        threeworld.renderer.shadowMapSoft = true;
    	
    	//Light
    	var spotLight = new THREE.SpotLight( 0xffffff, 2 );
		spotLight.position.set( 0, 120, 0 );
		spotLight.penumbra = 0.05;
		spotLight.decay = 2;
		spotLight.distance = 200;
		spotLight.castShadow = true;
		spotLight.shadow.mapSize.width = 1024;
		spotLight.shadow.mapSize.height = 1024;
		spotLight.shadow.camera.near = 10;
		spotLight.shadow.camera.far = 200;
		threeworld.scene.add( spotLight );
		
        //Ground & Cube
        var material = new THREE.MeshPhongMaterial( { color: 0x808080, dithering: true } );
		var geometry = new THREE.PlaneBufferGeometry( 2000, 2000 );
		var mesh = new THREE.Mesh( geometry, material );
		mesh.position.set( 0, - 1, 0 );
		mesh.rotation.x = - Math.PI * 0.5;
		mesh.castShadow = true;
		mesh.receiveShadow = true;
		threeworld.scene.add( mesh );
		
		var material2 = new THREE.MeshPhongMaterial( { color: 0x4080ff, dithering: true } );
		var geometry2 = new THREE.BoxBufferGeometry( objectsize, objectsize, objectsize );
		var mesh2 = new THREE.Mesh( geometry2, material2);
		mesh2.position.set( 0, 70, 0 );
		mesh2.castShadow = true;
		threeworld.scene.add( mesh2 );
	};


	this.nextStep = function()		 
	{
		// Code for Three.js re-drawing of objects.  
		
		if ( false)	   // Optional: Check for condition that will end the run early.
		{
			this.endCondition = true;	// This will end the run. 
		}
	};


	this.endRun = function()
	{
	};

}