//
// Asura_ShadowDecal_System_Internal.h
//
// Created by KJFL - 31 March 2005
//
// Copyright (C) 2005 Rebellion, All Rights Reserved.
//

#ifdef ASURA_USE_PRAGMA_ONCE
#pragma once
#endif

#ifndef __ASURA_SHADOWDECAL_SYSTEM_INTERNAL_H__
#define __ASURA_SHADOWDECAL_SYSTEM_INTERNAL_H__


#include "Physics/Asura_Physics_EnvironmentCache.h"
class Asura_Animation;

class Asura_ShadowDecal_Vertex
{
	public:

		Asura_Vector_3	m_xPosition;
		float			m_fU;
		float			m_fV;
};

class Asura_ShadowDecal_Cache
{
	public:

		Asura_ShadowDecal_Cache()
		{
			Reset();
		}

		void Update( const Asura_Bounding_Box& xBB, const Asura_Animation* pxAnim );

		void Reset( void )
		{
			m_pxAnimation = 0;
			m_uFrameStamp = 0;
			m_xEnvCache.Reset();
		}

		bool IsCacheForAnimation( const Asura_Animation* pxAnim ) const
		{
			return (pxAnim == m_pxAnimation);
		} 

		u_int GetFrameStamp( void ) const
		{
			return m_uFrameStamp;
		}

	private:
		static u_int ClipPolyToPlane(Asura_ShadowDecal_Vertex* pxInVertices, u_int uNumberOfVertices, Asura_ShadowDecal_Vertex* pxOutVertices, const Asura_Vector_3& xPlaneNormal, const float fPlaneConstant);


		const Asura_Animation*			m_pxAnimation;
		u_int							m_uFrameStamp;

		Asura_Physics_EnvironmentCache	m_xEnvCache;


};


#endif//__ASURA_SHADOWDECAL_SYSTEM_INTERNAL_H__
