//
// Asura_Frustum_Planes.h
//
// Created by KJFL - 10 January 2008
//
// Copyright (C) 2008 Rebellion, All Rights Reserved.
//

#ifdef ASURA_USE_PRAGMA_ONCE
    #pragma once
#endif

#ifndef __ASURA_FRUSTUM_PLANES_H__
#define __ASURA_FRUSTUM_PLANES_H__

#include "Core/Asura_Maths.h"

class Asura_Frustum_Planes
{
	public:

		Asura_Frustum_Planes(){}
		virtual ~Asura_Frustum_Planes(){}

		void PositionChanged(const Asura_Vector_3& xNewPos)
		{
		for(u_int u = 0; u < 5; u++)
			m_afPlaneConstant[u] = m_axPlaneNormal[u] * xNewPos;
		}

		const Asura_Vector_3& GetPlaneNormal( u_int uIndex ) const
		{
			return m_axPlaneNormal[uIndex];
		}

		void SetPlaneNormal(u_int uIndex, const Asura_Vector_3& xNormal)
		{
			m_axPlaneNormal[uIndex] = xNormal;
		}

		const Asura_Vector_3& GetAbsPlaneNormal( u_int uIndex ) const
		{
			return m_axAbsPlaneNormal[uIndex];
		}

		void DoAbsPlaneNormal(u_int uIndex)
		{
			m_axAbsPlaneNormal[uIndex] = Asura_Vector_3( Asura_Maths::Abs(m_axPlaneNormal[uIndex].x), 
														 Asura_Maths::Abs(m_axPlaneNormal[uIndex].y), 
														 Asura_Maths::Abs(m_axPlaneNormal[uIndex].z) );
		}

		float GetPlaneConstant( u_int uIndex ) const
		{
			return m_afPlaneConstant[uIndex];
		}

		void SetPlaneConstant(u_int uIndex , float fConst)
		{
			m_afPlaneConstant[uIndex] = fConst;
		}


	private:
	
		Asura_Vector_3 m_axPlaneNormal[5];
		Asura_Vector_3 m_axAbsPlaneNormal[5];
		float m_afPlaneConstant[5];
};

#endif
