RigsofRods
Soft-body Physics Simulation
Data Structures | Public Member Functions | Private Member Functions | Private Attributes
SkyX::MeshManager Class Reference

#include <MeshManager.h>

+ Collaboration diagram for SkyX::MeshManager:

Data Structures

struct  VERTEX
 Vertex struct. More...
 

Public Member Functions

 MeshManager (SkyX *s)
 Constructor. More...
 
 ~MeshManager ()
 Destructor. More...
 
void create ()
 Create our water mesh, geometry, entity, etc... More...
 
void remove ()
 Remove all resources. More...
 
void updateGeometry (Ogre::Camera *cam)
 Update geometry. More...
 
Ogre::MeshPtr getMesh ()
 Get mesh. More...
 
Ogre::SubMesh * getSubMesh ()
 Get sub mesh. More...
 
Ogre::Entity * getEntity ()
 Get entity. More...
 
const Ogre::String & getMaterialName () const
 Get material name. More...
 
void setMaterialName (const Ogre::String &MaterialName)
 Set mesh material. More...
 
Ogre::HardwareVertexBufferSharedPtr & getHardwareVertexBuffer ()
 Get hardware vertex buffer reference. More...
 
Ogre::HardwareIndexBufferSharedPtr & getHardwareIndexBuffer ()
 Get hardware index buffer reference. More...
 
Ogre::SceneNode * getSceneNode ()
 Get the Ogre::SceneNode pointer where Hydrax mesh is attached. More...
 
const bool & isCreated () const
 Is _createGeometry() called? More...
 
void setGeometryParameters (const int &Steps, const int &Circles)
 Set geometry parameters. More...
 
const int & getSteps () const
 Get number of steps. More...
 
const int & getCircles () const
 Get number of circles. More...
 
void setUnderHorizonParams (const int &UnderHorizonCircles=15, const bool &UnderHorizonFading=true, const Ogre::Real &UnderHorizonFadingExponent=1, const Ogre::Real &UnderHorizonFadingMultiplier=2)
 Set under-horizon rendering params. More...
 
const int & getUnderHorizonCircles () const
 Get under-horizon circles. More...
 
const bool & getUnderHorizonFading () const
 Get under-horizon fading. More...
 
const Ogre::Real & getUnderHorizonFadingExponent () const
 Get under-horizon exponent fading. More...
 
const Ogre::Real & getUnderHorizonFadingMultiplier () const
 Get under-horizon fading multiplier. More...
 
void setRadiusMultiplier (const Ogre::Real &RadiusMultiplier)
 Set radius multiplier. More...
 
const float getSkydomeRadius (Ogre::Camera *c) const
 Get skydome radius. More...
 

Private Member Functions

void _createGeometry ()
 Create geometry. More...
 

Private Attributes

bool mCreated
 Has been create() already called? More...
 
Ogre::MeshPtr mMesh
 Ogre::MeshPtr. More...
 
Ogre::SubMesh * mSubMesh
 Ogre::Submesh pointer. More...
 
Ogre::Entity * mEntity
 Ogre::Entity pointer. More...
 
Ogre::HardwareVertexBufferSharedPtr mVertexBuffer
 Vertex buffer. More...
 
Ogre::HardwareIndexBufferSharedPtr mIndexBuffer
 Index buffer. More...
 
VERTEXmVertices
 Vertices. More...
 
int mCircles
 Circles. More...
 
int mSteps
 Steps. More...
 
int mUnderHorizonCircles
 Under-horizon rendering. More...
 
bool mUnderHorizonFading
 Under-horizon fading. More...
 
Ogre::Real mUnderHorizonFadingExponent
 Under-horizon exponent fading (1=linear fading) More...
 
Ogre::Real mUnderHorizonFadingMultiplier
 Under-horizon fading multiplier: opacity = saturate(pow(opacity,fading_exp)*fading_multiplier) More...
 
Ogre::Real mRadiusMultiplier
 Radius multiplier. More...
 
Ogre::SceneNode * mSceneNode
 Ogre::SceneNode pointer. More...
 
Ogre::String mMaterialName
 Material name. More...
 
SkyXmSkyX
 Main SkyX pointer. More...
 

Detailed Description

Definition at line 33 of file MeshManager.h.

Constructor & Destructor Documentation

◆ MeshManager()

SkyX::MeshManager::MeshManager ( SkyX s)

Constructor.

Parameters
sParent SkyX pointer

Definition at line 30 of file MeshManager.cpp.

◆ ~MeshManager()

SkyX::MeshManager::~MeshManager ( )

Destructor.

Definition at line 51 of file MeshManager.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ _createGeometry()

void SkyX::MeshManager::_createGeometry ( )
private

Create geometry.

Definition at line 221 of file MeshManager.cpp.

+ Here is the caller graph for this function:

◆ create()

void SkyX::MeshManager::create ( )

Create our water mesh, geometry, entity, etc...

Remarks
Call it after setMaterialName()

Definition at line 82 of file MeshManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCircles()

const int& SkyX::MeshManager::getCircles ( ) const
inline

Get number of circles.

Returns
Number of circles

Definition at line 159 of file MeshManager.h.

◆ getEntity()

Ogre::Entity* SkyX::MeshManager::getEntity ( )
inline

Get entity.

Returns
Entity

Definition at line 92 of file MeshManager.h.

◆ getHardwareIndexBuffer()

Ogre::HardwareIndexBufferSharedPtr& SkyX::MeshManager::getHardwareIndexBuffer ( )
inline

Get hardware index buffer reference.

Returns
Ogre::HardwareIndexBufferSharedPtr reference

Definition at line 121 of file MeshManager.h.

◆ getHardwareVertexBuffer()

Ogre::HardwareVertexBufferSharedPtr& SkyX::MeshManager::getHardwareVertexBuffer ( )
inline

Get hardware vertex buffer reference.

Returns
Ogre::HardwareVertexBufferSharedPtr reference

Definition at line 113 of file MeshManager.h.

◆ getMaterialName()

const Ogre::String& SkyX::MeshManager::getMaterialName ( ) const
inline

Get material name.

Returns
Material name

Definition at line 100 of file MeshManager.h.

◆ getMesh()

Ogre::MeshPtr SkyX::MeshManager::getMesh ( )
inline

Get mesh.

Returns
Mesh

Definition at line 76 of file MeshManager.h.

◆ getSceneNode()

Ogre::SceneNode* SkyX::MeshManager::getSceneNode ( )
inline

Get the Ogre::SceneNode pointer where Hydrax mesh is attached.

Returns
Ogre::SceneNode*

Definition at line 129 of file MeshManager.h.

◆ getSkydomeRadius()

const float SkyX::MeshManager::getSkydomeRadius ( Ogre::Camera *  c) const

Get skydome radius.

Parameters
cCamera
Returns
Skydome radius relative to the given camera

Definition at line 360 of file MeshManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSteps()

const int& SkyX::MeshManager::getSteps ( ) const
inline

Get number of steps.

Returns
Number of steps

Definition at line 151 of file MeshManager.h.

◆ getSubMesh()

Ogre::SubMesh* SkyX::MeshManager::getSubMesh ( )
inline

Get sub mesh.

Returns
Sub mesh

Definition at line 84 of file MeshManager.h.

◆ getUnderHorizonCircles()

const int& SkyX::MeshManager::getUnderHorizonCircles ( ) const
inline

Get under-horizon circles.

Returns
Under-horizon circles

Definition at line 180 of file MeshManager.h.

◆ getUnderHorizonFading()

const bool& SkyX::MeshManager::getUnderHorizonFading ( ) const
inline

Get under-horizon fading.

Returns
Under-horizon fading

Definition at line 188 of file MeshManager.h.

◆ getUnderHorizonFadingExponent()

const Ogre::Real& SkyX::MeshManager::getUnderHorizonFadingExponent ( ) const
inline

Get under-horizon exponent fading.

Returns
under-horizon exponent fading

Definition at line 196 of file MeshManager.h.

◆ getUnderHorizonFadingMultiplier()

const Ogre::Real& SkyX::MeshManager::getUnderHorizonFadingMultiplier ( ) const
inline

Get under-horizon fading multiplier.

Returns
Under-horizon fading multiplier

Definition at line 204 of file MeshManager.h.

◆ isCreated()

const bool& SkyX::MeshManager::isCreated ( ) const
inline

Is _createGeometry() called?

Returns
true if created() have been already called

Definition at line 137 of file MeshManager.h.

+ Here is the caller graph for this function:

◆ remove()

void SkyX::MeshManager::remove ( )

Remove all resources.

Definition at line 56 of file MeshManager.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setGeometryParameters()

void SkyX::MeshManager::setGeometryParameters ( const int &  Steps,
const int &  Circles 
)

Set geometry parameters.

Parameters
StepsSphere number of steps
CirclesSpehere number of circes

Definition at line 322 of file MeshManager.cpp.

+ Here is the call graph for this function:

◆ setMaterialName()

void SkyX::MeshManager::setMaterialName ( const Ogre::String &  MaterialName)

Set mesh material.

Parameters
MaterialNameThe material name

Definition at line 350 of file MeshManager.cpp.

◆ setRadiusMultiplier()

void SkyX::MeshManager::setRadiusMultiplier ( const Ogre::Real &  RadiusMultiplier)
inline

Set radius multiplier.

Parameters
RadiusMultiplierRadius multiplier
Remarks
Radius multiplier in [0,1] range Radius = CameraFarClipDistance * RadiusMultiplier

Definition at line 214 of file MeshManager.h.

◆ setUnderHorizonParams()

void SkyX::MeshManager::setUnderHorizonParams ( const int &  UnderHorizonCircles = 15,
const bool &  UnderHorizonFading = true,
const Ogre::Real &  UnderHorizonFadingExponent = 1,
const Ogre::Real &  UnderHorizonFadingMultiplier = 2 
)

Set under-horizon rendering params.

Remarks
In an ideal situation, you only must see the avobe horizon sky due to the fact that the terrain/water must be 'infinite' and the under-horizont sky part is hide. But, infinite terrain/water is not always implemented in games and 3d apps in general, so... in order to get a good-looking sky, SkyX provides an approach to render realistic under-horizont sky.
Parameters
UnderHorizonCirclesNumber of circles of SkyX::MeshManager::mCircles reserved for the under-horizont geometry part, 0 means not under-horizon rendering
UnderHorizonFadingtrue/false to fade or not the under-horizon sky
UnderHorizonFadingExponentExponent of the fading, pow(vertex_angle, exp), 1=linear
UnderHorizonFadingMultiplierFading multiplier, opacity = saturate(pow(opacity,fading_exp)*fading_multiplier)

Definition at line 334 of file MeshManager.cpp.

+ Here is the call graph for this function:

◆ updateGeometry()

void SkyX::MeshManager::updateGeometry ( Ogre::Camera *  cam)

Update geometry.

Parameters
camCamera

Definition at line 117 of file MeshManager.cpp.

+ Here is the call graph for this function:

Field Documentation

◆ mCircles

int SkyX::MeshManager::mCircles
private

Circles.

Definition at line 249 of file MeshManager.h.

◆ mCreated

bool SkyX::MeshManager::mCreated
private

Has been create() already called?

Definition at line 231 of file MeshManager.h.

◆ mEntity

Ogre::Entity* SkyX::MeshManager::mEntity
private

Ogre::Entity pointer.

Definition at line 238 of file MeshManager.h.

◆ mIndexBuffer

Ogre::HardwareIndexBufferSharedPtr SkyX::MeshManager::mIndexBuffer
private

Index buffer.

Definition at line 243 of file MeshManager.h.

◆ mMaterialName

Ogre::String SkyX::MeshManager::mMaterialName
private

Material name.

Definition at line 269 of file MeshManager.h.

◆ mMesh

Ogre::MeshPtr SkyX::MeshManager::mMesh
private

Ogre::MeshPtr.

Definition at line 234 of file MeshManager.h.

◆ mRadiusMultiplier

Ogre::Real SkyX::MeshManager::mRadiusMultiplier
private

Radius multiplier.

Definition at line 263 of file MeshManager.h.

◆ mSceneNode

Ogre::SceneNode* SkyX::MeshManager::mSceneNode
private

Ogre::SceneNode pointer.

Definition at line 266 of file MeshManager.h.

◆ mSkyX

SkyX* SkyX::MeshManager::mSkyX
private

Main SkyX pointer.

Definition at line 272 of file MeshManager.h.

◆ mSteps

int SkyX::MeshManager::mSteps
private

Steps.

Definition at line 251 of file MeshManager.h.

◆ mSubMesh

Ogre::SubMesh* SkyX::MeshManager::mSubMesh
private

Ogre::Submesh pointer.

Definition at line 236 of file MeshManager.h.

◆ mUnderHorizonCircles

int SkyX::MeshManager::mUnderHorizonCircles
private

Under-horizon rendering.

Definition at line 254 of file MeshManager.h.

◆ mUnderHorizonFading

bool SkyX::MeshManager::mUnderHorizonFading
private

Under-horizon fading.

Definition at line 256 of file MeshManager.h.

◆ mUnderHorizonFadingExponent

Ogre::Real SkyX::MeshManager::mUnderHorizonFadingExponent
private

Under-horizon exponent fading (1=linear fading)

Definition at line 258 of file MeshManager.h.

◆ mUnderHorizonFadingMultiplier

Ogre::Real SkyX::MeshManager::mUnderHorizonFadingMultiplier
private

Under-horizon fading multiplier: opacity = saturate(pow(opacity,fading_exp)*fading_multiplier)

Definition at line 260 of file MeshManager.h.

◆ mVertexBuffer

Ogre::HardwareVertexBufferSharedPtr SkyX::MeshManager::mVertexBuffer
private

Vertex buffer.

Definition at line 241 of file MeshManager.h.

◆ mVertices

VERTEX* SkyX::MeshManager::mVertices
private

Vertices.

Definition at line 246 of file MeshManager.h.


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