00001 #ifndef __GXBITMAPLAND_H
00002 #define __GXBITMAPLAND_H
00003
00004
00005 #include "GXStandardDefines.h"
00006 #include "GXLand.h"
00007 #include "GXLandValue.h"
00008 #include "GXSquareTemplate.h"
00009
00010
00011
00012
00013 #define CGXBITMAP_TEXTURE_COUNT 1
00014
00015 typedef enum _GXBITMAPLAND_TYPE
00016 {
00017 GXBLAND_COLORMAP=0,
00018
00019 } GXBITMAPLAND_TYPE;
00020
00021
00022
00023 class CGXBitmapLand
00024 {
00025 public:
00026 CGXBitmapLand();
00027 virtual ~CGXBitmapLand();
00028
00029 virtual bool InitFromBitmaps(CGXDeviceContainer* pDevice,
00030 char* szColorBitMap,
00031 char* szHeightBitMap,
00032 float fSideSize,
00033 float fNormalAmplitude,
00034 float fHeightAmplitude,
00035 UINT uVertexSideSize);
00036
00037 virtual bool InitFromSquares(CGXDeviceContainer* pDevice,
00038 CGXSquare<float>* pHeights,
00039 CGXSquare<D3DXCOLOR>* pColors,
00040 float fSideSize,
00041 float fNormalAmplitude,
00042 float fHeightAmplitude,
00043 UINT uVertexSideSize);
00044
00045
00046 virtual bool SaveToStream(IStream* pStream);
00047 virtual bool LoadFromStream(CGXDeviceContainer* pDevice,
00048 IStream* pStream,
00049 UINT uVertexSideSize);
00050
00051 virtual bool UpdateGeometry(D3DXVECTOR3* pCamera, float fSideSize);
00052
00053 virtual bool DrawPrimtive();
00054
00055 virtual bool GetValueAtPos(GXVertex* pVert);
00056
00057 virtual float GetHeightAtPos(float fX, float fY);
00058
00059 virtual void OnDeviceLost();
00060 virtual bool OnReset();
00061
00062 public:
00063 inline IDirect3DTexture8* GetTextureMap(GXBITMAPLAND_TYPE Type)
00064 {
00065 return (m_rgpTextureMaps[Type]);
00066 }
00067
00068
00069 protected:
00070 CGXLand m_Land;
00071 CGXDeviceContainer* m_pDevice;
00072 IDirect3DTexture8* m_rgpTextureMaps[CGXBITMAP_TEXTURE_COUNT];
00073 float m_fSideSize;
00074 CGXSquare<SGXLandValue> m_HeightValues;
00075
00076
00077 protected:
00078 virtual void Cleanup();
00079 virtual bool InitLand(UINT uVertexSideSize);
00080 virtual bool LoadHeightValuesFromBitmap(IDirect3DTexture8* pTexture);
00081
00082 };
00083
00084
00085 void GXVertexUpdate(GXVertex* pVert, void* pBitmapLand);
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099 #endif