22 #ifndef _HEIGHTMAP_HH_
23 #define _HEIGHTMAP_HH_
37 class TerrainGlobalOptions;
46 class GzTerrainMatGen;
74 public:
double GetHeight(
double _x,
double _y,
double _z = 1000);
86 double _outsideRadius,
double _insideRadius,
87 double _weight = 0.1);
99 double _outsideRadius,
double _insideRadius,
100 double _weight = 0.1);
112 double _outsideRadius,
double _insideRadius,
113 double _weight = 0.1);
125 double _outsideRadius,
double _insideRadius,
126 double _weight = 0.1);
131 public:
double GetAvgHeight(Ogre::Vector3 _pos,
double _brushSize);
160 private:
void ModifyTerrain(Ogre::Vector3 _pos,
double _outsideRadius,
161 double _insideRadius,
double _weight,
162 const std::string &_op);
166 private:
bool InitBlendMaps(Ogre::Terrain *_terrain);
169 private:
void ConfigureTerrainDefaults();
174 private:
void DefineTerrain(
int _x,
int _y);
178 private:
void SetupShadows(
bool _enabled);
190 private:
unsigned int dataSize;
196 private: Ogre::TerrainGlobalOptions *terrainGlobals;
199 private: Ogre::TerrainGroup *terrainGroup;
202 private:
bool terrainsImported;
205 private: std::vector<std::string> diffuseTextures;
208 private: std::vector<std::string> normalTextures;
211 private: std::vector<double> worldSizes;
214 private: std::vector<double> blendHeight;
217 private: std::vector<double> blendFade;
220 private: std::vector<float> heights;
239 public Ogre::TerrainMaterialGeneratorA::SM2Profile
242 public:
SM2Profile(Ogre::TerrainMaterialGenerator *_parent,
243 const Ogre::String &_name,
const Ogre::String &_desc);
248 public: Ogre::MaterialPtr
generate(
const Ogre::Terrain *_terrain);
251 const Ogre::Terrain *_terrain);
253 public:
void UpdateParams(
const Ogre::MaterialPtr &_mat,
254 const Ogre::Terrain *_terrain);
257 const Ogre::Terrain *_terrain);
259 protected:
virtual void addTechnique(
const Ogre::MaterialPtr &_mat,
260 const Ogre::Terrain *_terrain, TechniqueType _tt);
264 public Ogre::TerrainMaterialGeneratorA::SM2Profile::ShaderHelperGLSL
267 const SM2Profile *_prof,
const Ogre::Terrain *_terrain,
271 const SM2Profile *_prof,
const Ogre::Terrain *_terrain,
275 const Ogre::MaterialPtr &_mat,
276 const Ogre::Terrain *_terrain,
bool _compositeMap);
279 const Ogre::Terrain *_terrain, TechniqueType _tt,
280 Ogre::StringUtil::StrStreamType &_outStream);
283 const Ogre::Terrain *_terrain, TechniqueType _tt,
284 Ogre::StringUtil::StrStreamType &_outStream);
287 const SM2Profile *_prof,
const Ogre::Terrain *_terrain,
289 Ogre::StringUtil::StrStreamType &_outStream);
292 const Ogre::Terrain *_terrain, TechniqueType _tt,
293 const Ogre::HighLevelGpuProgramPtr &_prog);
296 unsigned int _texCoordStart,
const SM2Profile *_prof,
297 const Ogre::Terrain *_terrain, TechniqueType _tt,
298 Ogre::StringUtil::StrStreamType &_outStream);
301 const SM2Profile *_prof,
const Ogre::Terrain *_terrain,
303 Ogre::StringUtil::StrStreamType &_outStream);
306 const Ogre::Terrain *_terrain,
308 Ogre::StringUtil::StrStreamType &_outStream);
311 const Ogre::Terrain *_terrain, TechniqueType tt,
313 Ogre::StringUtil::StrStreamType &_outStream);
316 const Ogre::Terrain *_terrain,
318 Ogre::StringUtil::StrStreamType &_outStream);
321 Ogre::uint *_texCoord, Ogre::uint *_sampler,
322 const SM2Profile *_prof,
const Ogre::Terrain *_terrain,
324 Ogre::StringUtil::StrStreamType &_outStream);
328 const Ogre::Terrain *_terrain,
330 Ogre::StringUtil::StrStreamType &_outStream);
333 const Ogre::Terrain *_terrain, TechniqueType _tt,
334 Ogre::StringUtil::StrStreamType &_outStream);
338 const Ogre::Terrain *_terrain,
340 Ogre::StringUtil::StrStreamType &_outStream);
343 const Ogre::Terrain *_terrain, TechniqueType _tt,
344 const Ogre::GpuProgramParametersSharedPtr &_params);
346 private: Ogre::String GetChannel(Ogre::uint _idx);
352 public Ogre::TerrainMaterialGeneratorA::SM2Profile::ShaderHelperCg
355 const SM2Profile *_prof,
const Ogre::Terrain *_terrain,
359 const SM2Profile *_prof,
const Ogre::Terrain *_terrain,
363 const Ogre::Terrain *_terrain, TechniqueType _tt,
364 Ogre::StringUtil::StrStreamType &_outStream);
367 const Ogre::Terrain *_terrain, TechniqueType _tt,
368 Ogre::StringUtil::StrStreamType &_outStream);
371 const SM2Profile *_prof,
const Ogre::Terrain *_terrain,
373 Ogre::StringUtil::StrStreamType &_outStream);
376 const Ogre::Terrain *_terrain, TechniqueType _tt,
377 const Ogre::HighLevelGpuProgramPtr &_prog);
380 unsigned int _texCoordStart,
const SM2Profile *_prof,
381 const Ogre::Terrain *_terrain, TechniqueType _tt,
382 Ogre::StringUtil::StrStreamType &_outStream);
385 const SM2Profile *_prof,
const Ogre::Terrain *_terrain,
387 Ogre::StringUtil::StrStreamType &_outStream);