17 #ifndef _GAZEBO_RENDERING_HEIGHTMAPPRIVATE_HH_
18 #define _GAZEBO_RENDERING_HEIGHTMAPPRIVATE_HH_
22 #include <boost/filesystem.hpp>
24 #include <ignition/math/Vector3.hh>
32 class TerrainGlobalOptions;
56 public Ogre::TerrainMaterialGeneratorA::SM2Profile
59 public:
SM2Profile(Ogre::TerrainMaterialGenerator *_parent,
60 const Ogre::String &_name,
const Ogre::String &_desc);
65 public: Ogre::MaterialPtr
generate(
const Ogre::Terrain *_terrain);
68 const Ogre::Terrain *_terrain);
71 const Ogre::Terrain *_terrain);
74 const Ogre::Terrain *_terrain);
76 protected:
virtual void addTechnique(
const Ogre::MaterialPtr &_mat,
77 const Ogre::Terrain *_terrain, TechniqueType _tt);
80 #pragma clang diagnostic push
81 #pragma clang diagnostic ignored "-Woverloaded-virtual"
82 #endif // ifdef __clang__
88 public Ogre::TerrainMaterialGeneratorA::SM2Profile::ShaderHelperGLSL
91 const SM2Profile *_prof,
const Ogre::Terrain *_terrain,
95 const SM2Profile *_prof,
const Ogre::Terrain *_terrain,
99 const Ogre::MaterialPtr &_mat,
100 const Ogre::Terrain *_terrain,
bool _compositeMap);
103 const Ogre::Terrain *_terrain, TechniqueType _tt,
104 Ogre::StringStream &_outStream);
107 const Ogre::Terrain *_terrain, TechniqueType _tt,
108 Ogre::StringStream &_outStream);
111 const SM2Profile *_prof,
const Ogre::Terrain *_terrain,
113 Ogre::StringStream &_outStream);
116 const Ogre::Terrain *_terrain, TechniqueType _tt,
117 const Ogre::HighLevelGpuProgramPtr &_prog);
120 unsigned int _texCoordStart,
const SM2Profile *_prof,
121 const Ogre::Terrain *_terrain, TechniqueType _tt,
122 Ogre::StringStream &_outStream);
125 const SM2Profile *_prof,
const Ogre::Terrain *_terrain,
127 Ogre::StringStream &_outStream);
130 const Ogre::Terrain *_terrain,
132 Ogre::StringStream &_outStream);
135 const Ogre::Terrain *_terrain, TechniqueType tt,
137 Ogre::StringStream &_outStream);
140 const Ogre::Terrain *_terrain,
142 Ogre::StringStream &_outStream);
145 Ogre::uint *_texCoord, Ogre::uint *_sampler,
146 const SM2Profile *_prof,
const Ogre::Terrain *_terrain,
148 Ogre::StringStream &_outStream);
152 const Ogre::Terrain *_terrain,
154 Ogre::StringStream &_outStream);
157 const Ogre::Terrain *_terrain, TechniqueType _tt,
158 Ogre::StringStream &_outStream);
162 const Ogre::Terrain *_terrain,
164 Ogre::StringStream &_outStream);
167 const Ogre::Terrain *_terrain, TechniqueType _tt,
168 const Ogre::GpuProgramParametersSharedPtr &_params);
170 private: Ogre::String GetChannel(Ogre::uint _idx);
181 public Ogre::TerrainMaterialGeneratorA::SM2Profile::ShaderHelperCg
184 const SM2Profile *_prof,
const Ogre::Terrain *_terrain,
188 const SM2Profile *_prof,
const Ogre::Terrain *_terrain,
192 const Ogre::Terrain *_terrain, TechniqueType _tt,
193 Ogre::StringStream &_outStream);
196 const Ogre::Terrain *_terrain, TechniqueType _tt,
197 Ogre::StringStream &_outStream);
200 const SM2Profile *_prof,
const Ogre::Terrain *_terrain,
202 Ogre::StringStream &_outStream);
205 const Ogre::Terrain *_terrain, TechniqueType _tt,
206 const Ogre::HighLevelGpuProgramPtr &_prog);
209 unsigned int _texCoordStart,
const SM2Profile *_prof,
210 const Ogre::Terrain *_terrain, TechniqueType _tt,
211 Ogre::StringStream &_outStream);
214 const SM2Profile *_prof,
const Ogre::Terrain *_terrain,
216 Ogre::StringStream &_outStream);
224 #pragma clang diagnostic pop
bool terrainsImported
True if the terrain was imported.
Definition: HeightmapPrivate.hh:317
bool useTerrainPaging
Flag that enables/disables the terrain paging.
Definition: HeightmapPrivate.hh:360
virtual void generateVertexProgramSource(const SM2Profile *_prof, const Ogre::Terrain *_terrain, TechniqueType _tt, Ogre::StringStream &_outStream)
int terrainIdx
Used to iterate over all the terrains.
Definition: HeightmapPrivate.hh:357
virtual Ogre::HighLevelGpuProgramPtr generateVertexProgram(const SM2Profile *_prof, const Ogre::Terrain *_terrain, TechniqueType _tt)
Definition: HeightmapPrivate.hh:267
bool unloadProceduralPage(Ogre::Page *, Ogre::PagedWorldSection *)
Give a provider the opportunity to unload page content procedurally.
Definition: HeightmapPrivate.hh:251
std::vector< std::string > diffuseTextures
The diffuse textures.
Definition: HeightmapPrivate.hh:320
virtual void generateVpHeader(const SM2Profile *_prof, const Ogre::Terrain *_terrain, TechniqueType _tt, Ogre::StringStream &_outStream)
Ogre::TerrainPaging * terrainPaging
Type of paging applied.
Definition: HeightmapPrivate.hh:348
static const double loadRadiusFactor
The terrain pages are loaded if the distance from the camera is within the loadRadius.
Definition: HeightmapPrivate.hh:276
void UpdateParamsForCompositeMap(const Ogre::MaterialPtr &_mat, const Ogre::Terrain *_terrain)
static const boost::filesystem::path hashFilename
Hash file name that should be present for every terrain file loaded using paging. ...
Definition: HeightmapPrivate.hh:287
std::vector< std::string > normalTextures
The normal textures.
Definition: HeightmapPrivate.hh:323
virtual void generateVpFooter(const SM2Profile *_prof, const Ogre::Terrain *_terrain, TechniqueType _tt, Ogre::StringStream &_outStream)
void UpdateParams(const Ogre::MaterialPtr &_mat, const Ogre::Terrain *_terrain)
std::vector< double > blendHeight
The material blending heights.
Definition: HeightmapPrivate.hh:329
std::vector< double > worldSizes
The size of the world sections.
Definition: HeightmapPrivate.hh:326
static const unsigned int numTerrainSubdivisions
Number of pieces in which a terrain is subdivided for paging.
Definition: HeightmapPrivate.hh:270
unsigned int dataSize
Size of the heightmap data.
Definition: HeightmapPrivate.hh:305
ScenePtr scene
The scene.
Definition: HeightmapPrivate.hh:299
std::vector< std::vector< float > > subTerrains
Collection of terrains. Every terrain might be paged.
Definition: HeightmapPrivate.hh:354
Shader model 2 profile target.
Definition: HeightmapPrivate.hh:55
GzTerrainMatGen()
Constructor.
virtual void updateVpParams(const SM2Profile *_prof, const Ogre::Terrain *_terrain, TechniqueType _tt, const Ogre::GpuProgramParametersSharedPtr &_params)
virtual ~GzTerrainMatGen()
Destructor.
Ogre::MaterialPtr generate(const Ogre::Terrain *_terrain)
virtual void generateFpDynamicShadowsParams(Ogre::uint *_texCoord, Ogre::uint *_sampler, const SM2Profile *_prof, const Ogre::Terrain *_terrain, TechniqueType _tt, Ogre::StringStream &_outStream)
virtual void generateVpFooter(const SM2Profile *_prof, const Ogre::Terrain *_terrain, TechniqueType _tt, Ogre::StringStream &_outStream)
virtual void defaultVpParams(const SM2Profile *_prof, const Ogre::Terrain *_terrain, TechniqueType _tt, const Ogre::HighLevelGpuProgramPtr &_prog)
virtual void generateVpHeader(const SM2Profile *_prof, const Ogre::Terrain *_terrain, TechniqueType _tt, Ogre::StringStream &_outStream)
std::vector< float > heights
The raw height values received from physics.
Definition: HeightmapPrivate.hh:335
Ogre::TerrainGroup * terrainGroup
Group of terrains.
Definition: HeightmapPrivate.hh:314
Ogre::TerrainGlobalOptions * terrainGlobals
Global options.
Definition: HeightmapPrivate.hh:311
virtual void generateFpLayer(const SM2Profile *_prof, const Ogre::Terrain *_terrain, TechniqueType tt, Ogre::uint _layer, Ogre::StringStream &_outStream)
DummyPageProvider dummyPageProvider
A page provider is needed to use the paging system.
Definition: HeightmapPrivate.hh:341
friend ShaderHelperGLSL
Definition: HeightmapPrivate.hh:175
virtual void generateFpFooter(const SM2Profile *_prof, const Ogre::Terrain *_terrain, TechniqueType tt, Ogre::StringStream &_outStream)
virtual ~SM2Profile()
Destructor.
bool terrainHashChanged
True if the terrain's hash does not match the image's hash.
Definition: HeightmapPrivate.hh:363
void generateFpDynamicShadows(const SM2Profile *_prof, const Ogre::Terrain *_terrain, TechniqueType _tt, Ogre::StringStream &_outStream)
bool loadProceduralPage(Ogre::Page *, Ogre::PagedWorldSection *)
Give a provider the opportunity to load page content procedurally.
Definition: HeightmapPrivate.hh:244
SM2Profile(Ogre::TerrainMaterialGenerator *_parent, const Ogre::String &_name, const Ogre::String &_desc)
Constructor.
virtual void generateVertexProgramSource(const SM2Profile *_prof, const Ogre::Terrain *_terrain, TechniqueType _tt, Ogre::StringStream &_outStream)
virtual void generateVpDynamicShadows(const SM2Profile *_prof, const Ogre::Terrain *_terrain, TechniqueType _tt, Ogre::StringStream &_outStream)
virtual unsigned int generateVpDynamicShadowsParams(unsigned int _texCoordStart, const SM2Profile *_prof, const Ogre::Terrain *_terrain, TechniqueType _tt, Ogre::StringStream &_outStream)
virtual Ogre::HighLevelGpuProgramPtr generateFragmentProgram(const SM2Profile *_prof, const Ogre::Terrain *_terrain, TechniqueType _tt)
static const double holdRadiusFactor
The terrain pages are held in memory but not loaded if they are not ready when the camera is within h...
Definition: HeightmapPrivate.hh:283
virtual void generateVpDynamicShadows(const SM2Profile *_prof, const Ogre::Terrain *_terrain, TechniqueType _tt, Ogre::StringStream &_outStream)
GzTerrainMatGen * gzMatGen
Pointer to the terrain material generator.
Definition: HeightmapPrivate.hh:338
bool prepareProceduralPage(Ogre::Page *, Ogre::PagedWorldSection *)
Give a provider the opportunity to prepare page content procedurally.
Definition: HeightmapPrivate.hh:237
virtual void generateFpHeader(const SM2Profile *_prof, const Ogre::Terrain *_terrain, TechniqueType tt, Ogre::StringStream &_outStream)
virtual void generateFpDynamicShadowsHelpers(const SM2Profile *_prof, const Ogre::Terrain *_terrain, TechniqueType tt, Ogre::StringStream &_outStream)
ignition::math::Vector3d terrainSize
Size of the terrain.
Definition: HeightmapPrivate.hh:302
virtual Ogre::HighLevelGpuProgramPtr generateVertexProgram(const SM2Profile *_prof, const Ogre::Terrain *_terrain, TechniqueType _tt)
static const boost::filesystem::path pagingDirname
Name of the top level directory where all the paging info is stored.
Definition: HeightmapPrivate.hh:291
Ogre::MaterialPtr generateForCompositeMap(const Ogre::Terrain *_terrain)
Ogre::PageManager * pageManager
Central registration point for extension classes, such as the PageStrategy, PageContentFactory.
Definition: HeightmapPrivate.hh:345
boost::shared_ptr< Scene > ScenePtr
Definition: RenderTypes.hh:80
std::vector< double > blendFade
Material blend fade distances.
Definition: HeightmapPrivate.hh:332
friend ShaderHelperCg
Definition: HeightmapPrivate.hh:221
ignition::math::Vector3d terrainOrigin
Origin of the terrain.
Definition: HeightmapPrivate.hh:308
Utility class to help with generating shaders for GLSL.
Definition: HeightmapPrivate.hh:87
virtual void updateParams(const SM2Profile *_prof, const Ogre::MaterialPtr &_mat, const Ogre::Terrain *_terrain, bool _compositeMap)
virtual Ogre::HighLevelGpuProgramPtr generateFragmentProgram(const SM2Profile *_prof, const Ogre::Terrain *_terrain, TechniqueType _tt)
virtual unsigned int generateVpDynamicShadowsParams(unsigned int _texCoordStart, const SM2Profile *_prof, const Ogre::Terrain *_terrain, TechniqueType _tt, Ogre::StringStream &_outStream)
virtual void defaultVpParams(const SM2Profile *_prof, const Ogre::Terrain *_terrain, TechniqueType _tt, const Ogre::HighLevelGpuProgramPtr &_prog)
Definition: HeightmapPrivate.hh:46
virtual void addTechnique(const Ogre::MaterialPtr &_mat, const Ogre::Terrain *_terrain, TechniqueType _tt)
Keeping the CG shader for reference.
Definition: HeightmapPrivate.hh:180
boost::filesystem::path gzPagingDir
When the terrain paging is enabled, the terrain information for every piece of terrain is stored in d...
Definition: HeightmapPrivate.hh:296
virtual void generateFragmentProgramSource(const SM2Profile *_prof, const Ogre::Terrain *_terrain, TechniqueType _tt, Ogre::StringStream &_outStream)
Definition: HeightmapPrivate.hh:233
Ogre::PagedWorld * world
Collection of world content.
Definition: HeightmapPrivate.hh:351
bool unprepareProceduralPage(Ogre::Page *, Ogre::PagedWorldSection *)
Give a provider the opportunity to unprepare page content procedurally.
Definition: HeightmapPrivate.hh:259