#pragma once #include #include "K3DTypes.h" #include "KViewport.h" #include "SGameAvatarAddOnMgr.h" class K3DRenderDevice; class SGameCircleShadowPrimitive; namespace { LPCSTR SHADOW_TEXTURE_NAME = "shadow_avatar_low.dds"; const int SHADOW_SEGMENT_COUNT = 2; const int SHADOW_SEGMENET_INDEX_COUNT = (SHADOW_SEGMENT_COUNT - 1) * (SHADOW_SEGMENT_COUNT - 1) * 2; } class SCircleShadowCommonInfo { private: K3DTexture* m_pTexture; K3DINDEXED_WATER* m_pIndexed; SCircleShadowCommonInfo() { // Index Initialize m_pIndexed = new K3DINDEXED_WATER[SHADOW_SEGMENET_INDEX_COUNT]; K3DINDEXED_WATER* pIndexed = m_pIndexed; for(int h = 0; h < (SHADOW_SEGMENT_COUNT-1); h++) { for( int w = 0; w < (SHADOW_SEGMENT_COUNT-1); w++) { pIndexed->a = (WORD)((SHADOW_SEGMENT_COUNT*h)+w); pIndexed->b = (WORD)((SHADOW_SEGMENT_COUNT*h)+w+1); pIndexed->c = (WORD)((SHADOW_SEGMENT_COUNT*(h+1))+w); pIndexed++; pIndexed->a = (WORD)((SHADOW_SEGMENT_COUNT*h)+w+1); pIndexed->b = (WORD)((SHADOW_SEGMENT_COUNT*(h+1))+w+1); pIndexed->c = (WORD)((SHADOW_SEGMENT_COUNT*(h+1))+w); pIndexed++; } } NX3LoadPack loadpack; loadpack.Init(); m_pTexture = KTextureManager::GetManager()->GetTexture( SHADOW_TEXTURE_NAME, &loadpack, true, KTextureManager::GetManager()->GetMipMapBiasLevel() ); m_pTexture->AddRef(); } public: static SCircleShadowCommonInfo& GetInstance(); ~SCircleShadowCommonInfo() { Destroy(); } void Destroy() { SAFE_RELEASE( m_pTexture ); SAFE_DELETE_ARRAY( m_pIndexed ); } public: const K3DINDEXED_WATER* GetCircleShadowIndexBuffer() { return m_pIndexed; } K3DTexture* GetCircleShadowTexture() { return m_pTexture; } }; class SGameCircleShadowFX : public SGameAvatarAddOnMgr { public: SGameCircleShadowFX(); virtual ~SGameCircleShadowFX(); void Initialize(); void Render( class KViewportObject** ppViewportList, int nViewportCount ); void Refresh(); private: SGameCircleShadowPrimitive* m_pPrimitive; K3DBLENDEDBUMPVERTEX* m_pVertex; float m_fScale; float m_fWidthLength; float m_fHeightLength; float m_fWidthCenter; float m_fHeightCenter; K3DVector m_vPos; };