00001 /************************************************************************/ 00002 /* Ex Nihlo Engine by Hermanns Christophe */ 00003 /************************************************************************/ 00004 /* This program is free software; you can redistribute it and/or */ 00005 /* modify it under the terms of the GNU General Public License */ 00006 /* as published by the Free Software Foundation; either version 2 */ 00007 /* of the License, or (at your option) any later version. */ 00008 /* */ 00009 /* This program is distributed in the hope that it will be useful, */ 00010 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ 00011 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ 00012 /* */ 00013 /* See the GNU General Public License for more details. */ 00014 /* */ 00015 /* You should have received a copy of the GNU General Public License */ 00016 /* along with this program; if not, write to the Free Software */ 00017 /* Foundation, Inc., 59 Temple Place - Suite 330, */ 00018 /* Boston, MA 02111-1307, USA. */ 00019 /* */ 00020 /* If you use a important part of this code please send me a mail */ 00021 /* I just want to see where my code go thks :) */ 00022 /************************************************************************/ 00023 00024 /************************************************************************/ 00025 /* Contact */ 00026 /************************************************************************/ 00027 /* ExNihilo Website :www.ploksoftware.org */ 00028 /* */ 00029 /* Hermanns Christophe ExNihilo creator and main programmer */ 00030 /* */ 00031 /* Mail : Data@ploksoftware.org */ 00032 /* ICQ : 8030901 */ 00033 /* MSN Messenger : Data_7@hotmail.com */ 00034 /* */ 00035 /* Benjamin Michotte Linux port, webmaster */ 00036 /* */ 00037 /* Mail :binny@ploksoftware.org */ 00038 /* */ 00039 /************************************************************************/ 00040 00041 /************************************************************************/ 00042 /* File Description */ 00043 /************************************************************************/ 00044 /* File Name :ExCHeightMap.h */ 00045 /* */ 00046 /* Star Date :04/07/2003 */ 00047 /* */ 00048 /* Last Update :06/20/2003 */ 00049 /* */ 00050 /* File Description : */ 00051 /* */ 00052 /* For update of this file check : www.ploksoftware.org */ 00053 /************************************************************************/ 00054 00055 #ifndef __EXCHEIGHTMAP_H__ 00056 #define __EXCHEIGHTMAP_H__ 00057 //------------------------------------------------------------------------ 00058 //Includes 00059 //------------------------------------------------------------------------ 00060 #include "ExDefine.h" 00061 //------------------------------------------------------------------------ 00062 #include "Math/ExMath.h" 00063 //------------------------------------------------------------------------ 00064 #include "Manager/ManagerObject/ExManagerTexture.h" 00065 //------------------------------------------------------------------------ 00066 #include "Manager/ExManagerFog.h" 00067 //------------------------------------------------------------------------ 00068 #include "Object/Object3D/ExCObject3D.h" 00069 //------------------------------------------------------------------------ 00070 class ExCHeightMap :public ExCObject3D 00071 { 00072 protected: 00073 //-------------------------------- 00074 // Variable 00075 //-------------------------------- 00076 ExManagerTexture *ManagerTexture; 00077 ExManagerFog *ManagerFog; 00078 00079 BYTE *g_HeightMap; 00080 00081 float g_DetailScale; 00082 std::string m_TextureMap; 00083 00084 int m_MapDetailLevel; 00085 int m_MapResolution; 00086 00087 float m_MapScale; 00088 00089 bool m_Fog; 00090 float m_FogDepthLevel; 00091 00092 float m_Texture2Repetition; 00093 00094 std::vector<std::string> m_VecTexture; 00095 void SetTextureCoord(float CoordU,float CoordV); 00096 00097 float *TabVertices; 00098 float *TabTextures; 00099 00100 void BuildArray(void); 00101 00102 bool m_Array; 00103 00104 void RenderArray(void); 00105 public: 00106 //-------------------------------- 00107 // Constructor // Destructor 00108 //-------------------------------- 00109 ExCHeightMap(void); 00110 ~ExCHeightMap(void); 00111 //-------------------------------- 00112 // Methode 00113 //-------------------------------- 00114 inline void SetManagerTexture(ExManagerTexture * Texture){ManagerTexture=Texture;} 00115 inline void SetManagerFog(ExManagerFog * Fog){ManagerFog=Fog;} 00116 //-------------------------------- 00117 void Draw(void); 00118 void Load(std::string FileName); 00119 void RenderHeightMap(void); 00120 00121 inline void SetTextureMap(std::string FileName){m_TextureMap=FileName;} 00122 void SetTextureLand(unsigned int Number,std::string FileName); 00123 //inline void SetTextureLand2(std::string FileName){m_TextureLand2=FileName;} 00124 00125 00126 inline void SetMapResolution(int Resolution){m_MapResolution=Resolution;} 00127 inline void SetMapDetailLevel(int level){m_MapDetailLevel=level;} 00128 void IncreaseDetailLevel(void); 00129 void DereaseDetailLevel(void); 00130 inline void SetFogState(bool state){m_Fog=state;} 00131 inline bool GetFogState(void){return m_Fog;} 00132 00133 inline void SetFogDepthLevel(float level){m_FogDepthLevel=level;} 00134 void IncreaseFogDepthLevel(void); 00135 void DereaseFogDepthLevel(void); 00136 00137 inline void SetTexture2Repetition(float level){m_Texture2Repetition=level;} 00138 void IncreaseTexture2Repetition(void); 00139 void DereaseTexture2Repetition(void); 00140 00141 00142 // This returns the height (0 to 255) from a heightmap given an X and Y 00143 int Height(int X, int Y); 00144 00145 00146 00147 }; 00148 //------------------------------------------------------------------------ 00149 #endif //__EXMAP_H__