#pragma once #include "EffectInstance.h" class CEffectManager : public CScreen, public CSingleton { public: enum EEffectType { EFFECT_TYPE_NONE = 0, EFFECT_TYPE_PARTICLE = 1, EFFECT_TYPE_ANIMATION_TEXTURE = 2, EFFECT_TYPE_MESH = 3, EFFECT_TYPE_SIMPLE_LIGHT = 4, EFFECT_TYPE_MAX_NUM = 4, }; typedef std::map TEffectDataMap; typedef std::map TEffectInstanceMap; public: CEffectManager(); virtual ~CEffectManager(); void Destroy(); void UpdateSound(); void Update(); void Render(); void GetInfo(std::string* pstInfo); bool IsAliveEffect(DWORD dwInstanceIndex); // Register BOOL RegisterEffect(const char * c_szFileName,bool isExistDelete=false,bool isNeedCache=false); BOOL RegisterEffect2(const char * c_szFileName, DWORD* pdwRetCRC, bool isNeedCache=false); void DeleteAllInstances(); // Usage int CreateEffect(DWORD dwID, const D3DXVECTOR3 & c_rv3Position, const D3DXVECTOR3 & c_rv3Rotation); int CreateEffect(const char * c_szFileName, const D3DXVECTOR3 & c_rv3Position, const D3DXVECTOR3 & c_rv3Rotation); void CreateEffectInstance(DWORD dwInstanceIndex, DWORD dwID); BOOL SelectEffectInstance(DWORD dwInstanceIndex); bool DestroyEffectInstance(DWORD dwInstanceIndex); void DeactiveEffectInstance(DWORD dwInstanceIndex); void SetEffectTextures(DWORD dwID, std::vector textures); void SetEffectInstancePosition(const D3DXVECTOR3 & c_rv3Position); void SetEffectInstanceRotation(const D3DXVECTOR3 & c_rv3Rotation); void SetEffectInstanceGlobalMatrix(const D3DXMATRIX & c_rmatGlobal); void ShowEffect(); void HideEffect(); // Temporary function DWORD GetRandomEffect(); int GetEmptyIndex(); bool GetEffectData(DWORD dwID, CEffectData ** ppEffect); bool GetEffectData(DWORD dwID, const CEffectData ** c_ppEffect); // Area¿¡ Á÷Á¢ Âï´Â Effect¿ë ÇÔ¼ö... EffectInstanceÀÇ Pointer¸¦ ¹ÝȯÇÑ´Ù. // EffectManager ³»ºÎ EffectInstanceMapÀ» ÀÌ¿ëÇÏÁö ¾Ê´Â´Ù. void CreateUnsafeEffectInstance(DWORD dwEffectDataID, CEffectInstance ** ppEffectInstance); bool DestroyUnsafeEffectInstance(CEffectInstance * pEffectInstance); int GetRenderingEffectCount(); protected: void __Initialize(); void __DestroyEffectInstanceMap(); void __DestroyEffectCacheMap(); void __DestroyEffectDataMap(); protected: bool m_isDisableSortRendering; TEffectDataMap m_kEftDataMap; TEffectInstanceMap m_kEftInstMap; TEffectInstanceMap m_kEftCacheMap; CEffectInstance * m_pSelectedEffectInstance; };