voxelTerrain
 All Classes Functions Variables Typedefs Enumerations Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
OgreTile< configType > Class Template Reference

The OgreTile class converts the resulting vertices and indices of the voxel-terrain to the Ogre Hardwarebuffer. The class handles setVisible() when a tile gets cutted because it's too near or too far or a cracks has to get closed. The results of the transvoxel-algorithm for closing the cracks between the lod-tiles get set to submeshes. Every tile contains a Ogre::Mesh, a Ogre::Entity and a Ogre::SceneNode. For more information on how to use ogre3d see http://www.ogre3d.org/docs/manual/ and http://www.ogre3d.org/docs/api/1.9/ . More...

#include <OgreTile.hpp>

Inheritance diagram for OgreTile< configType >:
blub::procedural::voxel::tile::renderer< configType > blub::procedural::voxel::tile::base< renderer< configType > > blub::enableSharedFromThis< renderer< configType > > customOgreTile< configType >

Public Types

typedef configType t_config
 
typedef blub::sharedPointer
< OgreTile< t_config > > 
pointer
 
typedef blub::sharedPointer
< const OgreTile< t_config > > 
constPointer
 
typedef
blub::procedural::voxel::tile::renderer
< t_config > 
t_base
 
typedef
t_config::t_renderer::t_tile * 
t_thiz
 
typedef t_config::t_surface::t_tile t_voxelSurfaceTile
 
typedef
t_base::t_tileData::t_vertices 
t_vertices
 
typedef t_config::t_vertex t_vertex
 
- Public Types inherited from blub::procedural::voxel::tile::renderer< configType >
typedef configType t_config
 
typedef base< renderer
< t_config > > 
t_base
 
typedef
t_config::t_renderer::t_tile * 
t_thiz
 
typedef t_config::t_surface::t_tile t_tileData
 
typedef blub::sharedPointer
< t_tileData > 
t_tileDataPtr
 
- Public Types inherited from blub::procedural::voxel::tile::base< renderer< configType > >
typedef sharedPointer
< renderer< configType > > 
pointer
 
- Public Types inherited from blub::enableSharedFromThis< renderer< configType > >
typedef
std::enable_shared_from_this
< renderer< configType > > 
t_base
 
typedef blub::sharedPointer
< renderer< configType >const > 
t_thisPtrConst
 
typedef blub::sharedPointer
< renderer< configType > > 
t_thisPtr
 

Public Member Functions

virtual ~OgreTile ()
 ~OgreTile desctructor. Calls the static method destroyAllGraphic() to ensure Ogre instances get deleted by the right thread. The graphicDispatcher set by create() must stay valid until after ogre3d shutdown.
 
void setTileData (typename t_base::t_tileDataPtr convertToRenderAble, const blub::axisAlignedBox &aabb)
 
void setVisible (const bool &vis) override
 setVisible sets if a tile should get rendered. All lod-submeshes must not be rendered either. More...
 
void setVisibleLod (const blub::uint16 &indLod, const bool &vis) override
 
- Public Member Functions inherited from blub::procedural::voxel::tile::renderer< configType >
 ~renderer ()
 ~renderer destructor
 
void setTileData (t_tileDataPtr convertToRenderAble, const axisAlignedBox &aabb)
 Implement this method and cast the data to your graphic engine. More...
 
virtual void setVisibleLod (const uint16 &indLod, const bool &vis)
 setVisibleLod sets if one of the 6 crack closing submeshes (for lod) should get rendered. More...
 
const bool & getVisible () const
 getVisible returns if a tile should get rendered. More...
 
const bool & getVisibleLod (const uint16 &indLod)
 getVisibleLod returns if a crack-closing lod-tile should get rendered. More...
 
- Public Member Functions inherited from blub::enableSharedFromThis< renderer< configType > >
t_thisPtrConst getSharedThisPtr () const
 
t_thisPtr getSharedThisPtr ()
 

Static Public Member Functions

static pointer create (Ogre::SceneManager *sc, Ogre::String materialName, blub::async::dispatcher *graphicDispatcher)
 create creates an instance and calls initialise(). More...
 

Protected Member Functions

 OgreTile (Ogre::SceneManager *sc, Ogre::String materialName, blub::async::dispatcher &graphicDispatcher)
 OgreTile constrcutor. More...
 
void initialise ()
 initialise calls createMeshGraphic() on graphic thread. Not called by constructor because getSharedThisPtr() isn't yet available.
 
void createMeshGraphic ()
 createMeshGraphic allocates and initialises an Ogre::Mesh where the vertices and indices will get saved to later.
 
void setTileDataGraphic (blub::sharedPointer< t_voxelSurfaceTile > convertToRenderAble, const blub::axisAlignedBox &aabb)
 setTileDataGraphic convertes a vector of vertices and indices to ogres hardware buffer. More...
 
void setVisibleGraphic (const bool &vis)
 setVisibleGraphic sets the whole tile to visible or invisible. Gets called when tile cutted because too near or too far away. More...
 
void setVisibleLodGraphic (const blub::uint16 &indLod, const bool &vis)
 setVisibleLodGraphic sets a subentity-visibility. Gets called if the neighbour tile has a different LOD. To close the occuring cracks this method gets called. More...
 
void addCustomVertexInformation (Ogre::VertexBufferBinding *binding, const t_vertices &vertices)
 
void addCustomVertexDeclaration (Ogre::VertexDeclaration *decl)
 
constPointer getSharedThisPtr () const
 
pointer getSharedThisPtr ()
 
- Protected Member Functions inherited from blub::procedural::voxel::tile::renderer< configType >
 renderer ()
 renderer constructor.
 
- Protected Member Functions inherited from blub::procedural::voxel::tile::base< renderer< configType > >
 base ()
 base constrcutor.
 

Static Protected Member Functions

static void destroyAllGraphic (Ogre::SceneManager *scene, Ogre::MeshPtr mesh_, Ogre::Entity *entity_, Ogre::SceneNode *node_)
 destroyAllGraphic gets called by destructor - ensures that ogre3d classes get destroyed by the right thread. More...
 

Additional Inherited Members

- Protected Attributes inherited from blub::procedural::voxel::tile::renderer< configType >
bool m_shouldBeVisible
 m_shouldBeVisible saves if tile should get rendered.
 
bool m_lodShouldBeVisible [6]
 saves if crack closing submesh should get rendered.
 

Detailed Description

template<typename configType = blub::procedural::voxel::config>
class OgreTile< configType >

The OgreTile class converts the resulting vertices and indices of the voxel-terrain to the Ogre Hardwarebuffer. The class handles setVisible() when a tile gets cutted because it's too near or too far or a cracks has to get closed. The results of the transvoxel-algorithm for closing the cracks between the lod-tiles get set to submeshes. Every tile contains a Ogre::Mesh, a Ogre::Entity and a Ogre::SceneNode. For more information on how to use ogre3d see http://www.ogre3d.org/docs/manual/ and http://www.ogre3d.org/docs/api/1.9/ .

Examples:
customVertexInformation.cpp, mesh.cpp, noise.cpp, and primitives.cpp.

Constructor & Destructor Documentation

template<typename configType >
OgreTile< configType >::OgreTile ( Ogre::SceneManager *  sc,
Ogre::String  materialName,
blub::async::dispatcher graphicDispatcher 
)
protected

OgreTile constrcutor.

See also
create().

Member Function Documentation

template<typename configType >
OgreTile< configType >::pointer OgreTile< configType >::create ( Ogre::SceneManager *  sc,
Ogre::String  materialName,
blub::async::dispatcher graphicDispatcher 
)
static

create creates an instance and calls initialise().

Parameters
scThe ogre scene. Must not be nullptr;
materialNameThe ogre material-name.
graphicDispatcherOnly the thread that initialised the Ogre::Root may call Ogre methods. The graphicDispatcher must get called on every frame by the ogre thread. Methods that end with Graphic have to get called by this dispatcher.
Returns
returns an instance. Never nullptr.
template<typename configType >
void OgreTile< configType >::destroyAllGraphic ( Ogre::SceneManager *  scene,
Ogre::MeshPtr  mesh_,
Ogre::Entity *  entity_,
Ogre::SceneNode *  node_ 
)
staticprotected

destroyAllGraphic gets called by destructor - ensures that ogre3d classes get destroyed by the right thread.

Parameters
sceneMust not be nullptr.
mesh_Must not be nullptr.
entity_Must not be nullptr.
node_Must not be nullptr.
template<typename configType >
void OgreTile< configType >::setTileDataGraphic ( blub::sharedPointer< t_voxelSurfaceTile >  convertToRenderAble,
const blub::axisAlignedBox aabb 
)
protected

setTileDataGraphic convertes a vector of vertices and indices to ogres hardware buffer.

Parameters
convertToRenderAbleTo convert.
aabbUsed for the meshes aabb and the center gets used as the position for the Ogre::SceneNode.
template<typename configType >
void OgreTile< configType >::setVisible ( const bool &  vis)
overridevirtual

setVisible sets if a tile should get rendered. All lod-submeshes must not be rendered either.

Parameters
vistrue for visible.

Reimplemented from blub::procedural::voxel::tile::renderer< configType >.

template<typename configType >
void OgreTile< configType >::setVisibleGraphic ( const bool &  vis)
protected

setVisibleGraphic sets the whole tile to visible or invisible. Gets called when tile cutted because too near or too far away.

Parameters
vis
template<typename configType >
void OgreTile< configType >::setVisibleLodGraphic ( const blub::uint16 &  indLod,
const bool &  vis 
)
protected

setVisibleLodGraphic sets a subentity-visibility. Gets called if the neighbour tile has a different LOD. To close the occuring cracks this method gets called.

Parameters
indLod
vis

The documentation for this class was generated from the following file: