#version 3.7;

#declare Radiosity = true;
#declare PlaceTruck = true;
#declare PlaceJeep = true;
#declare PlaceFlore = true;
#declare PathToGlobalIncludes = "includes/";

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

#declare YardCenterDecal = < -3, 0, 0 >;

#include concat(PathToGlobalIncludes, "colorsMercenaires.inc")
#include concat(PathToGlobalIncludes, "texturesMercenaires.inc")
#include concat(PathToGlobalIncludes, "radiositySky.inc")
#include concat(PathToGlobalIncludes, "objects/rocks.inc")
#include concat(PathToGlobalIncludes, "buildings/warehouse1/parpaing.inc")
#include concat(PathToGlobalIncludes, "buildings/warehouse1/warehouse.inc")
#include concat(PathToGlobalIncludes, "objects/barrelObj.inc")
#include concat(PathToGlobalIncludes, "objects/woodCrate.inc")
#include concat(PathToGlobalIncludes, "affineFunctionSetter.inc")
#include "includes/textures.inc"
#include "includes/fuelReserve.inc"
#include "includes/warehouseSurrounding.inc"
#include "includes/walls.inc"
#include "includes/concreteSlab.inc"
#include "includes/hills.inc"
#include "includes/cameras.inc"//Defines the effective camera
#include "includes/yardFlore.inc"

#if( PlaceFlore )
	#include concat(PathToGlobalIncludes, "povtree/mapleA.inc")
	#include concat(PathToGlobalIncludes, "povtree/mapleF.inc")
	#include concat(PathToGlobalIncludes, "povtree/kapokTree1.inc")
	#include concat(PathToGlobalIncludes, "povtree/kapokTree2.inc")
	#include "includes/forestSurroundings.inc"
#end

#if( PlaceTruck )
	#declare ModelSubDir = concat(PathToGlobalIncludes, "3d models/militaryTruck1/");
	#include concat(PathToGlobalIncludes, "3d models/militaryTruck1/militaryTruckGeom.inc")
	#declare MilitaryTruckCenter = ( max_extent( MilitaryTruck1 ) + min_extent( MilitaryTruck1 ) ) / 2;
	
	object{ MilitaryTruck1 translate < -MilitaryTruckCenter.x, 0.003182473, -MilitaryTruckCenter.z > rotate 140 * y scale 2 / 13 translate < -4, 0, WallMaxExtent.z * 0.5 > }
#end

#if( PlaceJeep )
	#declare ModelSubDir = concat(PathToGlobalIncludes, "3d models/jeep/");
	#include concat(PathToGlobalIncludes, "3d models/jeep/jeep_POV_geom.inc")
	#declare JeepCenter = ( max_extent( Jeep ) + min_extent( Jeep ) ) / 2;
	
	object{ Jeep translate < -JeepCenter.x, -1e-6, -JeepCenter.z > rotate 90 * y scale 0.5 translate < -2, 0, -4 > + YardCenterDecal }
#end

camera{ FinalCamera }

light_source{ < 10, 30, -2 > * 100 color srgb < 1, 1, 0.95 > }

MakeSky( color srgb < 0.8, 0.8, 1 >, color srgb < 143 / 255, 195 / 255, 251 /255 >, < 1, 1, 0.95 > * 2 )

PlaceRock2( transform{ rotate 164 * y translate < -7.25 + WallEntranceXDecal + 2, 0, NorthAfterFarRoadZStart - ( WallE_Entrance_I.u - 1 - WallA_Entrance_I.u ) - 8 > }, pigment{ RockPigment }, 7 )

PlaceRock2( transform{ translate < -7.5 + WallEntranceXDecal + 2, 0, NorthAfterFarRoadZStart - ( WallE_Entrance_I.u - 1 - WallA_Entrance_I.u ) - 38 > }, pigment{ RockPigment }, 7.1 )

union{
	object{ NewWarehouse }

	object{ NewFuelReserve translate < -1.5, -min_extent( NewFuelReserve ).y, FuelVatZDistance > }

	object{ NewBlueBarrel translate < -0.75, 0, min_extent( NewFuelReserve ).z + FuelVatZDistance - ScaledBlueBarrelSize.z > } 
	object{ NewBlueBarrel translate < -0.75 - ScaledBlueBarrelSize.x * 1.5, 0, min_extent( NewFuelReserve ).z + FuelVatZDistance - ScaledBlueBarrelSize.z * 1.25 > } 
	object{ NewBlueBarrel translate < -0.75 - ScaledBlueBarrelSize.x * 3, 0, min_extent( NewFuelReserve ).z + FuelVatZDistance - ScaledBlueBarrelSize.z > } 

	object{ NewBlueBarrel translate < max_extent( NewWarehouse ).x + ScaledBlueBarrelSize.x, 0, min_extent( NewWarehouse ).z - ScaledBlueBarrelSize.z > }

	object{ NewCrate translate < NewCrateXPos, 0, min_extent( NewWarehouse ).z + ScaledCrateSize.z * 2 > }
	object{ NewCrate translate < NewCrateXPos + 0.05, 0, min_extent( NewWarehouse ).z + ScaledCrateSize.z * 3 > }
	object{ NewCrate translate < NewCrateXPos + 0.025, 0, min_extent( NewWarehouse ).z + ScaledCrateSize.z * 4 > }
	object{ NewCrate translate < NewCrateXPos, ScaledCrateSize.y, min_extent( NewWarehouse ).z + ScaledCrateSize.z * 3 * 0.85 > }
	object{ NewCrate translate < NewCrateXPos, ScaledCrateSize.y, min_extent( NewWarehouse ).z + ScaledCrateSize.z * 4 * 0.95 > }
	translate YardCenterDecal
}

object{ WallA }
object{ WallB }
object{ WallC }
object{ WallD }
object{ WallE }

PlaceConcreteSlabsAroundWarehouse()

PlaceConcreteSlabsForRoad()

PlaceConcreteSlabsForFarRoad()

object{ EastGroundA }
object{ EastGroundB }
object{ SouthGroundC }
object{ WestGroundB }
object{ WestGroundA }
object{ NorthGroundA }
object{ West2_GroundA }

#if( PlaceFlore )
	PlaceSmallTrees( 2.5, 0.25, 2.5 )
	PlaceKapokTrees(West2_GroundA, 8, 0.2, 8 )
	PlaceKapokTrees(NorthGroundB, 8, 0.2, 8 )
	
	PlantYardTree(MapleA, transform{ scale 3.5 rotate 45 * y }, < -20, 0, -2 > )
	PlantYardTree(MapleF, transform{ scale 3.25 rotate 180 * y }, < -8, 0, -6 > )
	PlantYardTree(MapleF, transform{ scale 3 rotate 270 * y }, < 4, 0, FuelVatZDistance > )
#end

#declare WestA_LinearHillMin = < -HillsTotalWidth / 2, FlatEarthLevel, -HillsTotalDepth / 2 >;
#declare WestA_LinearHillMax = < -HillsTotalWidth / 2 + RockHillWidth, IsoHillsTop, WallA_Entrance_I.v + ExitRoadLength >;

MakeLinearCrackledHill( transform{ translate CrackleHillsLevel * y rotate 90 * y translate < 0, 0, ExitRoadLength > },
									WestA_LinearHillMin, WestA_LinearHillMax, 4, 159 )

#debug "Rendering 'warehouse1' scene.\n"