#version 3.7;

#declare Radiosity = true;
#declare PlaceMountains = true;
#declare DebugOutput = true;
#declare PlaceCrater = true;
#declare PlaceAxes = false;//Should be set to 'false' for final rendering
#declare PlaceKameriSpaceShip = true;

global_settings{
	assumed_gamma 1.0
	max_trace_level 16
	#if( Radiosity )
		#default{ finish{ ambient 0 } }
		radiosity{
				pretrace_start 64 / image_width
				pretrace_end 2 / image_width
				error_bound 0.2
				minimum_reuse 0.01
				nearest_count 9
				count 800
				recursion_limit 1
				always_sample off
				low_error_factor 0.7
				gray_threshold 0
				brightness 1
				normal on
				media on
		}
	#end
}

#declare BuildingAddCoord = < 7, 1.5, 7 >;
#declare RadarTowerCoords = < 12, 0, 28 >;
#declare EntranceBuildingMove = < -4, 0, 16 > + BuildingAddCoord;
#declare GreenHouseBuildingMove = < 19, 0, 17 > + BuildingAddCoord;
#declare PylonsYPos = -1.5;

#include "includes/debug/debugMacros.inc"
#include "includes/colorsMercenaires.inc"
#include "includes/texturesMercenaires.inc"
#include "includes/textures.inc"
#include "includes/ground.inc"
#include "includes/isoSurfaces.inc"
#include "includes/icoSphereGeom.inc"
#include "includes/sky.inc"
#include "includes/crater.inc"
#include "includes/greenHouse.inc"
#include "includes/radarTower.inc"
#include "includes/entranceBuilding.inc"
#include "includes/pylon.inc"
#include "includes/entranceSas.inc"
#include "includes/entranceStairs.inc"
#include "includes/bigBuilding.inc"
#include "includes/hangar.inc"
#include "includes/barrelObj.inc"
#include "includes/oxygenBottle.inc"
#include "includes/spaceCrate1.inc"
#include "includes/fuelReserve.inc"

#if( PlaceKameriSpaceShip )
	#declare ModelsSubDir = "includes/3dModels/";
	#include concat( ModelsSubDir, "kameriLandedMat.inc" )
	#include concat( ModelsSubDir, "kameriLandedGeom.inc" )
#end

#if( DebugOutput )
	ObjectSizeCout(CompleteEntranceBld, "Complete Entrance Bld")
	ObjectSizeCout(CompleteGreenHouse, "Green House")
	ObjectBoundariesCout(CompleteEntranceBld, "Complete Entrance Bld")
	ObjectBoundariesCout(CompleteGreenHouse, "Green House")
#end

camera{
	location < -10, 7, -7 > 
	look_at < 5, 4.5, 7 >
	right image_width / image_height * x
	up y
	sky y
	direction z
}

light_source{ < -1, 2, -2 > * 1000 color srgb 1 }

object{ CompleteGreenHouse translate GreenHouseBuildingMove }

union{
	#for( It, 0, GH_SideNum - 1 )
		object{ CompletePylon translate < GH_EffectiveRadiusLength - PYL_BasePylonRadius, PylonsYPos, 0 > rotate 360 / GH_SideNum * It * y }
	#end	
	translate GreenHouseBuildingMove
}

object{ CompleteRadarTower translate RadarTowerCoords + BuildingAddCoord }
object{ CompletePylon translate RadarTowerCoords + BuildingAddCoord + < -4 + PYL_BasePylonRadius, -1.5, -4 + PYL_BasePylonRadius > }
object{ CompletePylon translate RadarTowerCoords + BuildingAddCoord + < -4 + PYL_BasePylonRadius, -1.5, 4 - PYL_BasePylonRadius > }
object{ CompletePylon translate RadarTowerCoords + BuildingAddCoord + < 4 - PYL_BasePylonRadius, -1.5, -4 + PYL_BasePylonRadius > }
object{ CompletePylon translate RadarTowerCoords + BuildingAddCoord + < 4 - PYL_BasePylonRadius, -1.5, 4 - PYL_BasePylonRadius > }

object{ CompleteEntranceBld translate EntranceBuildingMove }

object{ HF_Ground translate < GroundScale * 0.4, 0, GroundScale * 0.4> }

#if( PlaceMountains )
	//Mountains from left to right order
	object{ WornMountain1 rotate 165 * y translate < 45, -1, 170 > }
	object{ WornMountain2 translate < 75, -1, 110 > } 
	object{ WornMountain1 translate < 145, -1, 100 > }
	object{ WornMountain2 rotate 270 * y translate < 185, -1, 80 > }
	object{ WornMountain2 rotate 195 * y translate < 160, -1, 30 > }
#end

#if( PlaceCrater )
	object{ IsoCrater scale 2.5 translate < -4, 0.203, 13 >}
	object{ IsoCrater scale 2 translate < 4, 0.203, 4 >}
	object{ IsoCrater scale 4 translate < 0, 0.203, 40 > }
#end

union{
	object{ CompletePylon translate < -2.5, PylonsYPos, -2.5 > }
	object{ CompletePylon translate < -2.5, PylonsYPos, 2.5 > }
	object{ CompletePylon translate < 2.5, PylonsYPos, -2.5 > }
	object{ CompletePylon translate < 2.5, PylonsYPos, 2.5 > }
	translate EntranceBuildingMove
}

object{ EntSas_Side }
object{ EntSas_Door }

object{ ST_CompleteStair }

object{ CompleteBigBuilding translate < 75, 0, 45 > }

object{ HangarStructure translate < 65, 0, 6 > }

#if( PlaceAxes )
	union{
		cylinder{ 0, < 1, 0, 0 >, 0.2 pigment{ color srgb < 1, 0, 0 > } }
		cylinder{ 0, < 0, 0, 1 >, 0.2 pigment{ color srgb < 0, 0, 1 > } }
		cylinder{ 0, < 0, 1, 0 >, 0.2 pigment{ color srgb < 0, 1, 0 > } }
		translate 4 * y
	}
#end

#if( PlaceKameriSpaceShip )
	object{ KameriExplorerLanded 
		translate -( KameriExplorerLandedMax + KameriExplorerLandedMin ) / 2 * < 1, 0, 1 >
		translate (-12.5075 + 0.5 ) * y
		rotate 78 * y 
		scale 0.065
		translate < 69.5, 0, 7.5 > 
	}
#end

MakeBlueBarrel( 1.1, < 62.5, 0.5 * 0.475, 12.5 > )//Barrel in the hangar
MakeBlueBarrel( 1.1, < 64.5, 0.5 * 0.475, 14.5 > )//Barrel in the hangar
MakeBlueBarrel( 1.1, < 65, 0, 6 > + vrotate(< 12, 0, 12 >, < 0, HangarYRotate, 0 >) ) //Barrel near the fuel reserve

object{ FuelReserve rotate HangarYRotate * y translate < 65, 4, 6 > + vrotate(< 20, 0, 12 >, < 0, HangarYRotate, 0 >) }

object{ OxygenBottle scale 0.6 rotate 90 * y translate < 7, 0.5 * 0.475, -4 > }

object{ OxygenBottle scale 0.6 translate < 60.5, 0.5 * 0.475, 11 > }

object{ SpCr1_CompleteCrateWithCover rotate -45 * y translate < 15.5, 0.5 * 0.475, -3 > }

object{ SpCr1_CompleteCoverWithAttachs rotate 180 * x rotate -15 * y translate < 0, SpCr1_CoverHeight + 0.125, 1 > }

object{ SpCr1_ContainBox translate < 2, 0.125, -2 > }