00001 #ifndef __GXWATER 00002 #define __GXWATER 00003 00004 #include "GXStandardDefines.h" 00005 #include "GXLand.h" 00006 00007 class CGXWater 00008 { 00009 public: 00010 CGXWater(); 00011 ~CGXWater(); 00012 00013 bool Init(CGXDeviceContainer* pDevice, 00014 float fSideSize, 00015 UINT uSideSize); 00016 00017 bool DrawPrimitive(); 00018 00019 00020 void SetColor(DWORD dwNewColor); 00021 DWORD GetColor(); 00022 00023 void SetMatrices(D3DXMATRIX* pViewMatrix, D3DXMATRIX* pProjectionMatrix); 00024 void SetEyePos(D3DXVECTOR3* pEyePos); 00025 00026 inline float GetWaterLevel() 00027 { 00028 return m_fWaterLevel; 00029 } 00030 00031 bool SetWaterLevel(float fLevel); 00032 00033 00034 void GetReflectionMatrix(D3DXMATRIX* pInOut); 00035 00036 void SetReflectionTexture(IDirect3DTexture8* pTexture); 00037 00038 IDirect3DTexture8* GetReflectionTexture(); 00039 00040 00041 void GetClipPlane(float* pOut);//pOut=array of 4 floats 00042 00043 00044 protected: 00045 void Cleanup(); 00046 00047 bool InitShader(); 00048 00049 00050 00051 protected: 00052 DWORD m_dwColor; 00053 CGXDeviceContainer* m_pDevice; 00054 00055 IDirect3DTexture8* m_pReflectionTexture;//not created by this object, only referenced 00056 00057 00058 DWORD m_dwShader; 00059 00060 CGXLand m_Water; 00061 00062 00063 D3DXMATRIX m_mViewMatrix;//todo, see if you can store this concatanted 00064 D3DXMATRIX m_mProjectionMatrix; 00065 00066 D3DXVECTOR4 m_vEyePos; 00067 00068 00069 float m_fWaterLevel; 00070 float m_fSideSize; 00071 }; 00072 00073 00074 00075 00076 void GXWaterCallBack(GXVertex*, void*); 00077 00078 00079 00080 00081 #endif