22 #ifndef _HEIGHTMAP_HH_
23 #define _HEIGHTMAP_HH_
27 #include <boost/filesystem.hpp>
37 class TerrainGlobalOptions;
46 class GzTerrainMatGen;
108 public:
double GetHeight(
double _x,
double _y,
double _z = 1000);
120 double _outsideRadius,
double _insideRadius,
121 double _weight = 0.1);
133 double _outsideRadius,
double _insideRadius,
134 double _weight = 0.1);
146 double _outsideRadius,
double _insideRadius,
147 double _weight = 0.1);
159 double _outsideRadius,
double _insideRadius,
160 double _weight = 0.1);
165 public:
double GetAvgHeight(Ogre::Vector3 _pos,
double _brushSize);
191 public:
void SplitHeights(
const std::vector<float> &_heightmap,
int _n,
192 std::vector<std::vector<float> > &_v);
201 private:
void ModifyTerrain(Ogre::Vector3 _pos,
double _outsideRadius,
202 double _insideRadius,
double _weight,
203 const std::string &_op);
207 private:
bool InitBlendMaps(Ogre::Terrain *_terrain);
210 private:
void ConfigureTerrainDefaults();
215 private:
void DefineTerrain(
int _x,
int _y);
219 private:
void SetupShadows(
bool _enabled);
225 private: boost::filesystem::path pagingPath;
231 private:
static const double LoadRadiusFactor;
238 private:
static const double HoldRadiusFactor;
250 private:
unsigned int dataSize;
256 private: Ogre::TerrainGlobalOptions *terrainGlobals;
259 private: Ogre::TerrainGroup *terrainGroup;
262 private:
bool terrainsImported;
265 private: std::vector<std::string> diffuseTextures;
268 private: std::vector<std::string> normalTextures;
271 private: std::vector<double> worldSizes;
274 private: std::vector<double> blendHeight;
277 private: std::vector<double> blendFade;
280 private: std::vector<float> heights;
290 private: Ogre::PageManager *pageManager;
293 private: Ogre::TerrainPaging *terrainPaging;
296 private: Ogre::PagedWorld *world;
299 private: std::vector<std::vector<float> > subTerrains;
302 private:
int terrainIdx;
305 private:
bool useTerrainPaging;
321 public Ogre::TerrainMaterialGeneratorA::SM2Profile
324 public:
SM2Profile(Ogre::TerrainMaterialGenerator *_parent,
325 const Ogre::String &_name,
const Ogre::String &_desc);
330 public: Ogre::MaterialPtr
generate(
const Ogre::Terrain *_terrain);
333 const Ogre::Terrain *_terrain);
335 public:
void UpdateParams(
const Ogre::MaterialPtr &_mat,
336 const Ogre::Terrain *_terrain);
339 const Ogre::Terrain *_terrain);
341 protected:
virtual void addTechnique(
const Ogre::MaterialPtr &_mat,
342 const Ogre::Terrain *_terrain, TechniqueType _tt);
346 public Ogre::TerrainMaterialGeneratorA::SM2Profile::ShaderHelperGLSL
349 const SM2Profile *_prof,
const Ogre::Terrain *_terrain,
353 const SM2Profile *_prof,
const Ogre::Terrain *_terrain,
357 const Ogre::MaterialPtr &_mat,
358 const Ogre::Terrain *_terrain,
bool _compositeMap);
361 const Ogre::Terrain *_terrain, TechniqueType _tt,
362 Ogre::StringUtil::StrStreamType &_outStream);
365 const Ogre::Terrain *_terrain, TechniqueType _tt,
366 Ogre::StringUtil::StrStreamType &_outStream);
369 const SM2Profile *_prof,
const Ogre::Terrain *_terrain,
371 Ogre::StringUtil::StrStreamType &_outStream);
374 const Ogre::Terrain *_terrain, TechniqueType _tt,
375 const Ogre::HighLevelGpuProgramPtr &_prog);
378 unsigned int _texCoordStart,
const SM2Profile *_prof,
379 const Ogre::Terrain *_terrain, TechniqueType _tt,
380 Ogre::StringUtil::StrStreamType &_outStream);
383 const SM2Profile *_prof,
const Ogre::Terrain *_terrain,
385 Ogre::StringUtil::StrStreamType &_outStream);
388 const Ogre::Terrain *_terrain,
390 Ogre::StringUtil::StrStreamType &_outStream);
393 const Ogre::Terrain *_terrain, TechniqueType tt,
395 Ogre::StringUtil::StrStreamType &_outStream);
398 const Ogre::Terrain *_terrain,
400 Ogre::StringUtil::StrStreamType &_outStream);
403 Ogre::uint *_texCoord, Ogre::uint *_sampler,
404 const SM2Profile *_prof,
const Ogre::Terrain *_terrain,
406 Ogre::StringUtil::StrStreamType &_outStream);
410 const Ogre::Terrain *_terrain,
412 Ogre::StringUtil::StrStreamType &_outStream);
415 const Ogre::Terrain *_terrain, TechniqueType _tt,
416 Ogre::StringUtil::StrStreamType &_outStream);
420 const Ogre::Terrain *_terrain,
422 Ogre::StringUtil::StrStreamType &_outStream);
425 const Ogre::Terrain *_terrain, TechniqueType _tt,
426 const Ogre::GpuProgramParametersSharedPtr &_params);
428 private: Ogre::String GetChannel(Ogre::uint _idx);
434 public Ogre::TerrainMaterialGeneratorA::SM2Profile::ShaderHelperCg
437 const SM2Profile *_prof,
const Ogre::Terrain *_terrain,
441 const SM2Profile *_prof,
const Ogre::Terrain *_terrain,
445 const Ogre::Terrain *_terrain, TechniqueType _tt,
446 Ogre::StringUtil::StrStreamType &_outStream);
449 const Ogre::Terrain *_terrain, TechniqueType _tt,
450 Ogre::StringUtil::StrStreamType &_outStream);
453 const SM2Profile *_prof,
const Ogre::Terrain *_terrain,
455 Ogre::StringUtil::StrStreamType &_outStream);
458 const Ogre::Terrain *_terrain, TechniqueType _tt,
459 const Ogre::HighLevelGpuProgramPtr &_prog);
462 unsigned int _texCoordStart,
const SM2Profile *_prof,
463 const Ogre::Terrain *_terrain, TechniqueType _tt,
464 Ogre::StringUtil::StrStreamType &_outStream);
467 const SM2Profile *_prof,
const Ogre::Terrain *_terrain,
469 Ogre::StringUtil::StrStreamType &_outStream);