//
// Asura_EffectVolume_Effect.h
//
// Created by Emil Popovic - 15/12/2008
// 
// Copyright (C) 2008 Rebellion, All Rights Reserved.
//

#ifdef ASURA_USE_PRAGMA_ONCE
#pragma once
#endif

#ifndef __ASURA_EFFECTVOLUME_EFFECT_H__
#define __ASURA_EFFECTVOLUME_EFFECT_H__


#include "Rendering\Asura_Fog.h"

class Asura_EffectVolume_EffectState;


const Asura_Hash_ID uEFFECTVOLUME_EFFECT_UNDEFINED	= 0xECF2C1F9;	// Asura_Guid("EFFECT_VOLUME_EFFECT_UNDEFINED")
const Asura_Hash_ID uEFFECTVOLUME_EFFECT_FOG		= 0xABAB24E5;	// Asura_Guid("EFFECT_VOLUME_EFFECT_FOG")
const Asura_Hash_ID uEFFECTVOLUME_EFFECT_FSFX		= 0xC9BB4ED6;	// Asura_Guid("EFFECT_VOLUME_EFFECT_FSFX")

//--------------------------------------------------------------------------------

class Asura_EffectVolume_Effect
{
public:
	Asura_Hash_ID	m_uEffectTypeHash;
	Asura_Hash_ID	m_uBlueprintHash;

	Asura_EffectVolume_Effect( Asura_Hash_ID uEffectTypeHash )
		: m_uEffectTypeHash(uEffectTypeHash)
		, m_uBlueprintHash(ASURA_HASH_ID_UNSET)
	{
	}

	virtual ~Asura_EffectVolume_Effect()	{};

	Asura_Hash_ID GetEffectTypeHash() const	{return m_uEffectTypeHash;}

	virtual Asura_EffectVolume_EffectState* CreateEffectState()=0;

	virtual	bool ReadFromChunkStream( Asura_Chunk_Stream& xStream );
	virtual	void WriteToChunkStream( Asura_Chunk_Stream& xStream ) const;

#ifdef ASURA_TOOLS
	virtual void ApplyChangesForTemplateInstance(class Tools_EntityTemplateInstance* pxInstance)	{};
#endif


private:
	static const u_int s_uChunkVersion;	// The version used when reading/writing.


};

//--------------------------------------------------------------------------------

class Asura_EffectVolume_Effect_Fog : public Asura_EffectVolume_Effect
{
public:
	Asura_EffectVolume_Effect_Fog()
		: PARENT(uEFFECTVOLUME_EFFECT_FOG)
	{
	}
	Asura_Fog_Parameters	m_xFogParamteres;

	Asura_Fog_Parameters& GetFogParameters() {return m_xFogParamteres;}
	virtual Asura_EffectVolume_EffectState* CreateEffectState();

	virtual ~Asura_EffectVolume_Effect_Fog()	{};

	virtual	bool ReadFromChunkStream( Asura_Chunk_Stream& xStream );
	virtual	void WriteToChunkStream( Asura_Chunk_Stream& xStream ) const;

#ifdef ASURA_TOOLS
	virtual void ApplyChangesForTemplateInstance(class Tools_EntityTemplateInstance* pxInstance);
#endif

private:
	static const u_int s_uChunkVersion;	// The version used when reading/writing.
	typedef Asura_EffectVolume_Effect PARENT;
};

//--------------------------------------------------------------------------------

#if defined(ASURA_USE_FSFX)

class Asura_FSFXTemplate_Parameters
{
public:
	Asura_Hash_ID	GetTemplateHash()								{	return m_uTemplateHash;				}
	void			SetTemplateHash( Asura_Hash_ID uTemplateHash )	{	m_uTemplateHash = uTemplateHash;	}

	float			GetStrength()									{	return m_fStrength;					}
	void			SetStrength( float fStrength )					{	m_fStrength	= fStrength;			}

	void			Clear();

	bool			ReadFromChunkStream( Asura_Chunk_Stream& xStream );
	void			WriteToChunkStream( Asura_Chunk_Stream& xStream ) const;

	// Constructor
	Asura_FSFXTemplate_Parameters()		{	Clear();	}

private:
	Asura_Hash_ID	m_uTemplateHash;
	float			m_fStrength;

	static const u_int s_uChunkVersion;	// The version used when reading/writing.
};



//--------------------------------------------------------------------------------

class Asura_EffectVolume_Effect_FSFX : public Asura_EffectVolume_Effect
{
public:
	Asura_EffectVolume_Effect_FSFX()
		: PARENT( uEFFECTVOLUME_EFFECT_FSFX )
	{
	}

	virtual Asura_EffectVolume_EffectState* CreateEffectState();
	virtual ~Asura_EffectVolume_Effect_FSFX()	{};


	Asura_FSFXTemplate_Parameters& GetParameters()	{return m_xFSFXTemplateParameters; }

	virtual	bool ReadFromChunkStream( Asura_Chunk_Stream& xStream );
	virtual	void WriteToChunkStream( Asura_Chunk_Stream& xStream ) const;

#ifdef ASURA_TOOLS
	virtual void ApplyChangesForTemplateInstance(class Tools_EntityTemplateInstance* pxInstance);
#endif

private:
	Asura_FSFXTemplate_Parameters	m_xFSFXTemplateParameters;

	static const u_int s_uChunkVersion;	// The version used when reading/writing.
	typedef Asura_EffectVolume_Effect PARENT;

};

#endif	//defined(ASURA_USE_FSFX)

#endif //__ASURA_EFFECTVOLUME_EFFECT_H__