Particle.h
上传用户:cydong117
上传日期:2009-11-10
资源大小:638k
文件大小:11k
- /******************************************************************************************************************
-
- 葛碘疙:
-
- 累己磊:
- 累己老:
-
- [老磊][荐沥磊] : 荐沥 郴侩
-
- *******************************************************************************************************************/
- #ifndef _CPARTICLE_H
- #define _CPARTICLE_H
- #define _RAND_FLOAT ((FLOAT)(rand()%1000)/1000.0f)
- /******************************************************************************************************************
- CParticle Class
- *******************************************************************************************************************/
- class CParticle
- {
- public:
- //------------------------------------------------------------------------------------------------------------------
- // 涝磊包访 沥焊.
- WORD m_wLife; // 荐疙.
- WORD m_wCurrLife; // 泅犁荐疙.
- D3DVECTOR m_vecPos; // 谅钎.
- D3DVECTOR m_vecOldPos; // 谅钎 焊包.
- D3DVECTOR m_vecVel; // 加档.
- D3DVECTOR m_vecAccel; // 啊加档.
- D3DVECTOR m_vecLocalForce; // 颇萍努俊 俺喊 康氢阑 林绰 塞.
- FLOAT m_fMass; // 龙樊.
- FLOAT m_fSize; // 农扁.
- BOOL m_bIsDead; // 颇萍努狼 粮犁咯何.
- BYTE m_bRed, m_bGreen, m_bBlue; // 祸.
- BYTE m_bOpa;
- FLOAT m_fOriSize; // 贸澜农扁.
- BYTE m_bFstRed, m_bFstGreen, m_bFstBlue; // 颇萍努 积己矫痢狼祸.
- BYTE m_bEndRed, m_bEndGreen, m_bEndBlue; // 颇萍努 辆丰矫痢狼祸.
- //------------------------------------------------------------------------------------------------------------------
- //------------------------------------------------------------------------------------------------------------------
- // 涝磊 Frame包访 沥焊.
- WORD m_wDelay; // Animation Delay.
- WORD m_wCurrDelay;
- WORD m_wCurrFrame;
- //------------------------------------------------------------------------------------------------------------------
- public:
- __inline CParticle()
- {
- Init();
- }
- __inline VOID Init()
- {
- m_wLife = 0;
- m_vecPos = D3DVECTOR(0, 0, 0);
- m_vecOldPos = D3DVECTOR(0, 0, 0);
- m_vecVel = D3DVECTOR(0, 0, 0);
- m_vecAccel = D3DVECTOR(0, 0, 0);
- m_vecLocalForce = D3DVECTOR(0, 0, 0);
- m_fMass = 0.0f;
- m_fSize = 0.0f;
- m_fOriSize = 0.0f;
- m_bIsDead = TRUE;
- m_bRed = m_bGreen = m_bBlue = 255;
- m_bFstRed = m_bFstGreen = m_bFstBlue = 255;
- m_bEndRed = m_bEndGreen = m_bEndBlue = 255;
- m_wDelay = 0;
- m_wCurrDelay = 0;
- m_wCurrFrame = 0;
- m_wCurrLife = 0;
- m_bOpa = 255;
- }
- };
- /******************************************************************************************************************
- CParticleSystem Class
- 颇萍努 包府 Base Class
- *******************************************************************************************************************/
- class CParticleSystem
- {
- protected:
- // FLOAT m_fAirFiction; // 傍扁付蔓俺荐.(官恩.)
- // D3DVECTOR m_vecEnvironment; // 涝磊俊 累侩窍绰 券版函荐(吝仿, 官恩).
- D3DVECTOR m_vecBounding[2]; // 面倒眉农康开 汲沥.
- WORD m_wNum; // 涝磊狼 肮荐.
- CParticle* m_pxParticle; // 涝磊 俺眉.
- D3DVERTEX m_avShape[4]; // Vertex.
- FLOAT m_fDeltaTime;
- public:
- D3DVECTOR m_vecEnvironment; // 涝磊俊 累侩窍绰 券版函荐(吝仿, 官恩).
- FLOAT m_fAirFiction; // 傍扁付蔓俺荐.(官恩.)
- CParticleSystem();
- ~CParticleSystem();
- VOID UpdateAirFiction(WORD wNum); // 傍扁付蔓拌荐 利侩.
- VOID UpdateMove(WORD wNum); // 吝仿厘 利侩.
- VOID UpdateCrash(WORD wNum); // 面倒馆惯仿 利侩.
- __inline VOID SetEnvFactor(FLOAT fAirFriction = -0.05f,
- D3DVECTOR vecEnvironment = D3DVECTOR(0, 300, 0),
- D3DVECTOR vecMinBound = D3DVECTOR(0, 0, 0),
- D3DVECTOR vecMaxBound = D3DVECTOR(0, 0, 0))
- {
- m_fAirFiction = fAirFriction;
- m_vecEnvironment = vecEnvironment;
- m_vecBounding[0] = vecMinBound;
- m_vecBounding[1] = vecMaxBound;
- }
- virtual VOID InitSystem();
- virtual VOID SetupSystem(WORD wCnt = 200);
- virtual VOID DestroySystem();
- virtual VOID LoadTextr() = 0;
- virtual HRESULT RenderSystem(LPDIRECT3DDEVICE7 lpDevice) = 0;
- virtual VOID UpdateSystem(INT nLoopTime, D3DVECTOR vecGenPos) = 0;
- virtual VOID SetParticleDefault(WORD wNum, D3DVECTOR vecGenPos) = 0;
- };
- /******************************************************************************************************************
- CSnow Class
- *******************************************************************************************************************/
- #define _MAX_SNOWFRAME 1
- class CSnow : public CParticleSystem
- {
- private:
- CHAR m_szSnowFile[_MAX_SNOWFRAME][MAX_PATH];
- FLOAT m_fWidth, m_fGround;
- public:
- CSnow();
- ~CSnow();
- virtual VOID LoadTextr();
- virtual VOID InitSystem();
- virtual VOID DestroySystem();
- virtual VOID SetupSystem(WORD wCnt = 500, FLOAT fWidth = 800, FLOAT fGround = 600);
- virtual HRESULT RenderSystem(LPDIRECT3DDEVICE7 lpDevice);
- virtual VOID UpdateSystem(INT nLoopTime, D3DVECTOR vecGenPos = D3DVECTOR(0.0f, 0.0f, 0.0f));
- virtual VOID SetParticleDefault(WORD wNum, D3DVECTOR vecGenPos = D3DVECTOR(0.0f, 0.0f, 0.0f));
- };
- /******************************************************************************************************************
- CRain Class
- *******************************************************************************************************************/
- #define _MAX_RAINFRAME 1
- #define _MAX_RAINDROPFRAME 5
- class CRain : public CParticleSystem
- {
- private:
- CHAR m_pszRainFile[_MAX_RAINFRAME][MAX_PATH];
- CHAR m_pszRainDropFile[_MAX_RAINDROPFRAME][MAX_PATH];
- FLOAT m_fWidth, m_fGround;
- BYTE m_bRainIntensity; // 厚狼碍档.
- public:
- BYTE m_bGenCnt;
- CRain();
- ~CRain();
- virtual VOID LoadTextr();
- virtual VOID InitSystem();
- virtual VOID DestroySystem();
- virtual VOID SetupSystem(WORD wCnt = 400, FLOAT fWidth = 800, FLOAT fGround = 600);
- virtual HRESULT RenderSystem(LPDIRECT3DDEVICE7 lpDevice);
- virtual VOID UpdateSystem(INT nLoopTime, D3DVECTOR vecGenPos = D3DVECTOR(0.0f, 0.0f, 0.0f));
- virtual VOID SetParticleDefault(WORD wNum, D3DVECTOR vecGenPos = D3DVECTOR(0.0f, 0.0f, 0.0f));
- };
- /******************************************************************************************************************
- CFly Class
- 朝酒啊绰 屈怕狼 Praticle包府.(蜡己狼 部府)
- *******************************************************************************************************************/
- #define _MAX_FLYFRAME 10
- class CFly : public CParticleSystem
- {
- private:
- CHAR m_pszFlyFile[_MAX_FLYFRAME][MAX_PATH];
- BYTE m_bGenCnt;
- public:
- CFly();
- ~CFly();
-
- virtual VOID LoadTextr();
- virtual VOID InitSystem();
- virtual VOID DestroySystem();
- virtual VOID SetupSystem(WORD wCnt = 100);
- virtual HRESULT RenderSystem(LPDIRECT3DDEVICE7 lpDevice);
- virtual VOID UpdateSystem(INT nLoopTime, D3DVECTOR vecGenPos);
- virtual VOID SetParticleDefault(WORD wNum, D3DVECTOR vecGenPos);
- };
- /******************************************************************************************************************
- CBoom
- 气惯 屈怕狼 Praticle包府.
- *******************************************************************************************************************/
- #define _MAX_BOOMFRAME 10
- class CBoom : public CParticleSystem
- {
- private:
- CHAR m_pszBoomFile[_MAX_BOOMFRAME][MAX_PATH];
- SHORT m_shPartNum;
- public:
- CBoom();
- ~CBoom();
-
- virtual VOID LoadTextr();
- virtual VOID InitSystem();
- virtual VOID DestroySystem();
- virtual VOID SetupSystem(WORD wCnt = 1000);
- virtual HRESULT RenderSystem(LPDIRECT3DDEVICE7 lpDevice);
- VOID SetBoomParticle(D3DVECTOR vecGenPos);
- virtual VOID UpdateSystem(INT nLoopTime, D3DVECTOR vecGenPos = D3DVECTOR(0, 0, 0));
- virtual VOID SetParticleDefault(WORD wNum, D3DVECTOR vecGenPos);
- };
- /******************************************************************************************************************
- CFlyingTail
- 朝酒啊绰 屈怕狼 Praticle包府.
- *******************************************************************************************************************/
- #define _MAX_FLYTAILFRAME 10
- class CFlyingTail : public CParticleSystem
- {
- private:
- CHAR m_pszFlyingTailFile[_MAX_FLYTAILFRAME][MAX_PATH];
- SHORT m_shPartNum;
- public:
- CFlyingTail();
- ~CFlyingTail();
-
- virtual VOID LoadTextr();
- virtual VOID InitSystem();
- virtual VOID DestroySystem();
- virtual VOID SetupSystem(WORD wCnt = 500);
- virtual HRESULT RenderSystem(LPDIRECT3DDEVICE7 lpDevice);
- VOID SetFlyTailParticle(D3DVECTOR vecGenPos);
- virtual VOID UpdateSystem(INT nLoopTime, D3DVECTOR vecGenPos = D3DVECTOR(0, 0, 0));
- virtual VOID SetParticleDefault(WORD wNum, D3DVECTOR vecGenPos);
- };
- /******************************************************************************************************************
- CSmoke
- *******************************************************************************************************************/
- #define _MAX_SMOKEFRAME 1
- class CSmoke : public CParticleSystem
- {
- private:
- CHAR m_pszSmokeFile[_MAX_SMOKEFRAME][MAX_PATH];
- SHORT m_shPartNum;
- public:
- CSmoke();
- ~CSmoke();
-
- virtual VOID LoadTextr();
- virtual VOID InitSystem();
- virtual VOID DestroySystem();
- virtual VOID SetupSystem(WORD wCnt = 100);
- virtual HRESULT RenderSystem(LPDIRECT3DDEVICE7 lpDevice);
- VOID SetSmokeParticle(D3DVECTOR vecGenPos);
- virtual VOID UpdateSystem(INT nLoopTime, D3DVECTOR vecGenPos = D3DVECTOR(0, 0, 0));
- virtual VOID SetParticleDefault(WORD wNum, D3DVECTOR vecGenPos);
- };
- /******************************************************************************************************************
- CElec
- 傈扁 颇厘 Praticle包府.
- *******************************************************************************************************************/
- #define _MAX_ELECFRAME 1
- #define _MAX_ELEC_NODEX 2
- #define _MAX_ELEC_NODEY 10
- #define _ELEC_INDICES _MAX_ELEC_NODEX*_MAX_ELEC_NODEY*3*2
- #define _ELEC_VERTICES (_MAX_ELEC_NODEX+1)*(_MAX_ELEC_NODEY+1)
- class CElec
- {
- private:
- CHAR m_szElecFile[_MAX_ELECFRAME][MAX_PATH];
- SHORT m_shPosX, m_shPosY;
- SHORT m_shDstPosX, m_shDstPosY;
- FLOAT m_fSize;
- FLOAT m_fRadian;
- D3DVERTEX m_avElec[_MAX_ELEC_NODEY+1][_MAX_ELEC_NODEX+1];
- D3DVERTEX m_avSaveElec[_MAX_ELEC_NODEY+1][_MAX_ELEC_NODEX+1];
- // D3DLVERTEX m_avElec[_MAX_ELEC_NODE+1][2];
- WORD m_pwElecIndices[_ELEC_INDICES];
- public:
- CElec();
- ~CElec();
- VOID LoadTextr();
- VOID InitElec();
- VOID DestroyElec();
- VOID SetupElec();
- VOID UpdateElec(SHORT shPosX, SHORT shPosY, SHORT shDstPosX, SHORT shDstPosY);
- HRESULT RenderElec(LPDIRECT3DDEVICE7 lpDevice);
- };
- #endif // _CPARTICLE_H