/**
*
* \file Tools_Mode_BillboardPlants.h
*
* Created by Andrew Weinkove - 05/12/2002
*
* Copyright (C) 2002 Rebellion, All Rights Reserved.
*
**/

#ifdef ASURA_USE_PRAGMA_ONCE
    #pragma once
#endif

#ifndef __TOOLS_MODE_BILLBOARDPLANTS_H__
#define __TOOLS_MODE_BILLBOARDPLANTS_H__

#include "Tools_Mode.h"
#include "Core/Asura_Handle.h"
#include "Misc/Tools_Polygon_Selection.h"
#include "Misc/list_tem.hpp"

///////////////////////////////////////////////////////////////////////////////////////
#ifdef ASURA_USE_BILLBOARD_PLANTS
class Tools_Mode_BillboardPlants : public Tools_Mode
{
	public:

		Tools_Mode_BillboardPlants()
		{
			Initialise();
		}
		~Tools_Mode_BillboardPlants()
		{
			Shutdown();
		}

		void Initialise(void);
		void Shutdown(void);
		void PreSave();
		void QuickSave(void);
		void PostSave();
		void Update(void);
		void Render(void);
		void RenderUI(void);
		bool IsModified() {return true;}
		void RenderPlant();

		// Plant collision testing.
		static bool TestForCollisions();
		static bool DoesPlantHitEnvironment(const Asura_Vector_3& xPosition, const unsigned uPlantType);

	private:
		static void HandleKeyboard(void);

		static void TogglePlantEditOverlay(void);
		static void ToggleScatterOverlay();
		static void TogglePlantPlacementOverlay();
		static bool PlantEditOverlayIsOn(void);
		static bool ScatterOverlayIsOn(void);
		static bool PlantPlacementOverlayIsOn();
		static void CreatePlantEditOverlay(void);
		static void CreateScatterOverlay(void);
		static void CreatePlantPlacementOverlay();

		// Plant edit functions
		static void ChangeSelection();
		static void CreateNewTemplate();
		static void DeleteCurrentTemplate();
		static void SetCurrentTemplate(class Asura_BillboardPlant_Template *pxTemplate);
		static void RenameCurrentTemplate();
		static void ChangeTexture();
		static void SaveTemplates();
		static Asura_BillboardPlant_Template *GetCurrentTemplate();

		// Plant placement functions
		static void ChangePlacementSelection();
		static void Create();
		static void SelectAllOfType();
		static void SelectAllPlants();
		static void DeleteSelectedPlantsThatCollide();

		// Plant scatter functions
		static void ChangeScatterSelection();
		static void Randomise();
		static void Accept();
		static void Reject();

		// Object\entity creation\destruction
		static void CreateToolsObjects();
		static void RemoveBillboardBatches();
		static void CreateBillboardBatches();
		static void RemoveToolsObjects();

		///////////////////////////
		//data
		static Asura_Handle s_iMenuHandle;
		static bool s_bPlantEditOverlayOpen;
		static bool s_bScatterOverlayOpen;
		static bool s_bPlantPlacementOverlayOpen;
		static Asura_Vector_2 s_xPlantEditOverlayPosition;
		static Asura_Vector_2 s_xScatterOverlayPosition;
		static Asura_Vector_2 s_xPlantPlacementOverlayPosition;
		static Asura_BillboardPlant_Template *s_pxCurrentTemplate;
		static bool s_bViewMaxDistortion;
		static bool s_bKeepInFrontOfCamera;
		static bool s_bTestForCollisions;
		static Asura_Vector_3 s_xCamPosForPlantRender;
		static Asura_Matrix_3x3 s_xOriForPlantRender;
		static unsigned s_uPlantPlacementSelection;
		static unsigned s_uPlantScatterSelection;
		static float s_fNumberToScatter;
		static float s_fScatterClumpiness;
};
#endif //ASURA_USE_BILLBOARD_PLANTS

#endif//__TOOLS_MODE_BILLBOARDPLANTS_H__
