//
// Tools_SectionBoundingBox_Object.h
//
// Created by Richard Rice - 16/07/2004
// 
// Copyright (C) 2004 Rebellion, All Rights Reserved.
//


#ifdef ASURA_USE_PRAGMA_ONCE
    #pragma once
#endif

#ifndef _TOOLS_SECTIONBOUNDINGBOX_OBJECT_H_
#define _TOOLS_SECTIONBOUNDINGBOX_OBJECT_H_

#include "Core/Asura_String.h"
#include "Objects/Tools_Object.h"

class Asura_Hierarchy_Skin;


class Tools_SectionBoundingBox_Object : public Tools_Object
{
	public :
		Tools_SectionBoundingBox_Object(Asura_Hierarchy_Skin* pxSkin,int iSection);
//		~Tools_SectionBoundingBox_Object();

		const char* GetName(){return m_xName.GetString();}
		const char* GetTypeDescription(){return "Section BB";}

		virtual void Render();
		virtual void UpdateWhileSelected();
		virtual void PrintInfo(float& x,float& y);
		virtual void OnSelection();
		virtual void OnDeselection();
		virtual bool CanBeDestroyed(){return false;}
		virtual bool CanBeMoved(){return false;}

		void UpdatePosition(const Asura_Vector_3& xPos,const Asura_Matrix_3x3& xMat);

		virtual bool ObjectIsInLOS(const Asura_Vector_3& xAlpha, const Asura_Vector_3& xBeta, float& fLowest);


	private :
		void CreateOverlay();
		void DeleteOverlay();

		static void _Reset(){s_pxThis->Reset();}
		void Reset();

		static void _DisableBox(){s_pxThis->DisableBox();}
		void DisableBox();

		static bool IsEnabled_BBEdit() {return !s_pxThis->m_bShowCollisionMesh;}

		//data
		Asura_String m_xName;
		Asura_Hierarchy_Skin* m_pxSkin;
		int m_iSection;

		Asura_Bounding_Box m_xBox;
		bool m_bManualBox;
		bool m_bValid;
		bool m_bMinChanged;
		bool m_bMaxChanged;
		bool m_bChanged;
		bool m_bCollisionMesh; //true if this section has a collision mesh instead
		bool m_bShowCollisionMesh;

		enum VolumeFace
		{
			FACE_NONE = -1,
			FACE_MIN_X,
			FACE_MAX_X,
			FACE_MIN_Y,
			FACE_MAX_Y,
			FACE_MIN_Z,
			FACE_MAX_Z,
            FACE_END_ENUM
		};

		enum VolumeFace m_eSelectedFace;



		//static data for overlay
		static Asura_Vector_2 s_xOverlayPosition;
		static Tools_SectionBoundingBox_Object* s_pxThis;

};


#endif //_TOOLS_SECTIONBOUNDINGBOX_OBJECT_H_
