RigsofRods
Soft-body Physics Simulation
Data Structures | Public Member Functions | Private Member Functions | Private Attributes
Hydrax::Module::ProjectedGrid Class Reference

Hydrax projected grid module. More...

#include <ProjectedGrid.h>

+ Inheritance diagram for Hydrax::Module::ProjectedGrid:
+ Collaboration diagram for Hydrax::Module::ProjectedGrid:

Data Structures

struct  Options
 Struct wich contains Hydrax projected grid module options. More...
 

Public Member Functions

 ProjectedGrid (Hydrax *h, Noise::Noise *n, const Ogre::Plane &BasePlane, const MaterialManager::NormalMode &NormalMode)
 Constructor. More...
 
 ProjectedGrid (Hydrax *h, Noise::Noise *n, const Ogre::Plane &BasePlane, const MaterialManager::NormalMode &NormalMode, const Options &Options)
 Constructor. More...
 
 ~ProjectedGrid ()
 Destructor. More...
 
void create ()
 Create. More...
 
void remove ()
 Remove. More...
 
void update (const Ogre::Real &timeSinceLastFrame)
 Call it each frame. More...
 
void setOptions (const Options &Options)
 Set options. More...
 
void saveCfg (Ogre::String &Data)
 Save config. More...
 
bool loadCfg (Ogre::ConfigFile &CfgFile)
 Load config. More...
 
float getHeigth (const Ogre::Vector2 &Position)
 Get the current heigth at a especified world-space point. More...
 
const OptionsgetOptions () const
 Get current options. More...
 
- Public Member Functions inherited from Hydrax::Module::Module
 Module (const Ogre::String &Name, Noise::Noise *n, const Mesh::Options &MeshOptions, const MaterialManager::NormalMode &NormalMode)
 Constructor. More...
 
virtual ~Module ()
 Destructor. More...
 
void setNoise (Noise::Noise *Noise, GPUNormalMapManager *g=0, const bool &DeleteOldNoise=true)
 Set noise. More...
 
const Ogre::String & getName () const
 Get module name. More...
 
const bool & isCreated () const
 Is created() called? More...
 
virtual const bool _createGeometry (Mesh *mMesh) const
 Create geometry in module(If special geometry is needed) More...
 
const MaterialManager::NormalModegetNormalMode () const
 Get the normal generation mode. More...
 
const Mesh::OptionsgetMeshOptions () const
 Get the mesh options for this module. More...
 
Noise::NoisegetNoise ()
 Get the Hydrax::Noise module pointer. More...
 

Private Member Functions

void _calculeNormals ()
 Calcule current normals. More...
 
void _performChoppyWaves ()
 Perform choppy waves. More...
 
bool _renderGeometry (const Ogre::Matrix4 &m, const Ogre::Matrix4 &_viewMat, const Ogre::Vector3 &WorldPos)
 Render geometry. More...
 
Ogre::Vector4 _calculeWorldPosition (const Ogre::Vector2 &uv, const Ogre::Matrix4 &m, const Ogre::Matrix4 &_viewMat)
 Calcule world position. More...
 
bool _getMinMax (Ogre::Matrix4 *range)
 Get min/max. More...
 
void _setDisplacementAmplitude (const float &Amplitude)
 Set displacement amplitude. More...
 

Private Attributes

void * mVertices
 Vertex pointer (Mesh::POS_NORM_VERTEX or Mesh::POS_VERTEX) More...
 
Mesh::POS_NORM_VERTEXmVerticesChoppyBuffer
 Use it to store vertex positions when choppy displacement is enabled. More...
 
Ogre::Vector4 t_corners0
 For corners. More...
 
Ogre::Vector4 t_corners1
 
Ogre::Vector4 t_corners2
 
Ogre::Vector4 t_corners3
 
Ogre::Matrix4 mRange
 Range matrix. More...
 
Ogre::Plane mBasePlane
 Planes. More...
 
Ogre::Plane mUpperBoundPlane
 
Ogre::Plane mLowerBoundPlane
 
Ogre::Camera * mProjectingCamera
 Cameras. More...
 
Ogre::Camera * mRenderingCamera
 
Ogre::Camera * mTmpRndrngCamera
 
Ogre::Vector3 mNormal
 Normal and position. More...
 
Ogre::Vector3 mPos
 
Ogre::Vector3 mLastPosition
 Last camera position, orientation. More...
 
Ogre::Quaternion mLastOrientation
 
bool mLastMinMax
 
Options mOptions
 Our projected grid options. More...
 
HydraxmHydrax
 Our Hydrax pointer. More...
 

Additional Inherited Members

- Protected Attributes inherited from Hydrax::Module::Module
Ogre::String mName
 Module name. More...
 
Noise::NoisemNoise
 Noise generator pointer. More...
 
Mesh::Options mMeshOptions
 Module mesh options. More...
 
MaterialManager::NormalMode mNormalMode
 Normal map generation mode. More...
 
bool mCreated
 Is create() called? More...
 

Detailed Description

Hydrax projected grid module.

Definition at line 50 of file ProjectedGrid.h.

Constructor & Destructor Documentation

◆ ProjectedGrid() [1/2]

Hydrax::Module::ProjectedGrid::ProjectedGrid ( Hydrax h,
Noise::Noise n,
const Ogre::Plane &  BasePlane,
const MaterialManager::NormalMode NormalMode 
)

Constructor.

Parameters
hHydrax manager pointer
nHydrax noise module
BasePlaneNoise base plane
NormalModeSwitch between MaterialManager::NM_VERTEX and Materialmanager::NM_RTT

Definition at line 58 of file ProjectedGrid.cpp.

◆ ProjectedGrid() [2/2]

Hydrax::Module::ProjectedGrid::ProjectedGrid ( Hydrax h,
Noise::Noise n,
const Ogre::Plane &  BasePlane,
const MaterialManager::NormalMode NormalMode,
const Options Options 
)

Constructor.

Parameters
hHydrax manager pointer
nHydrax noise module
BasePlaneNoise base plane
NormalModeSwitch between MaterialManager::NM_VERTEX and Materialmanager::NM_RTT
OptionsPerlin options

Definition at line 73 of file ProjectedGrid.cpp.

+ Here is the call graph for this function:

◆ ~ProjectedGrid()

Hydrax::Module::ProjectedGrid::~ProjectedGrid ( )

Destructor.

Definition at line 89 of file ProjectedGrid.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ _calculeNormals()

void Hydrax::Module::ProjectedGrid::_calculeNormals ( )
private

Calcule current normals.

Definition at line 507 of file ProjectedGrid.cpp.

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

◆ _calculeWorldPosition()

Ogre::Vector4 Hydrax::Module::ProjectedGrid::_calculeWorldPosition ( const Ogre::Vector2 &  uv,
const Ogre::Matrix4 &  m,
const Ogre::Matrix4 &  _viewMat 
)
private

Calcule world position.

Parameters
uvuv
mRange
_viewMatView matrix
Returns
The position in homogenous coordinates

Definition at line 620 of file ProjectedGrid.cpp.

+ Here is the caller graph for this function:

◆ _getMinMax()

bool Hydrax::Module::ProjectedGrid::_getMinMax ( Ogre::Matrix4 *  range)
private

Get min/max.

Parameters
rangeRange
Returns
true if it's in min/max

Definition at line 645 of file ProjectedGrid.cpp.

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

◆ _performChoppyWaves()

void Hydrax::Module::ProjectedGrid::_performChoppyWaves ( )
private

Perform choppy waves.

Definition at line 542 of file ProjectedGrid.cpp.

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

◆ _renderGeometry()

bool Hydrax::Module::ProjectedGrid::_renderGeometry ( const Ogre::Matrix4 &  m,
const Ogre::Matrix4 &  _viewMat,
const Ogre::Vector3 &  WorldPos 
)
private

Render geometry.

Parameters
mRange
_viewMatView matrix
WorldPosOrigin world position
Returns
true if it's sucesfful

Definition at line 372 of file ProjectedGrid.cpp.

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

◆ _setDisplacementAmplitude()

void Hydrax::Module::ProjectedGrid::_setDisplacementAmplitude ( const float &  Amplitude)
private

Set displacement amplitude.

Parameters
AmplitudeAmplitude to set

Definition at line 832 of file ProjectedGrid.cpp.

+ Here is the caller graph for this function:

◆ create()

void Hydrax::Module::ProjectedGrid::create ( )
virtual

Create.

Reimplemented from Hydrax::Module::Module.

Definition at line 137 of file ProjectedGrid.cpp.

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

◆ getHeigth()

float Hydrax::Module::ProjectedGrid::getHeigth ( const Ogre::Vector2 &  Position)
virtual

Get the current heigth at a especified world-space point.

Parameters
PositionX/Z World position
Returns
Heigth at the given position in y-World coordinates, if it's outside of the water return -1

Reimplemented from Hydrax::Module::Module.

Definition at line 838 of file ProjectedGrid.cpp.

+ Here is the call graph for this function:

◆ getOptions()

const Options& Hydrax::Module::ProjectedGrid::getOptions ( ) const
inline

Get current options.

Returns
Current options

Definition at line 204 of file ProjectedGrid.h.

◆ loadCfg()

bool Hydrax::Module::ProjectedGrid::loadCfg ( Ogre::ConfigFile &  CfgFile)
virtual

Load config.

Returns
True if is the correct module config

Reimplemented from Hydrax::Module::Module.

Definition at line 222 of file ProjectedGrid.cpp.

+ Here is the call graph for this function:

◆ remove()

void Hydrax::Module::ProjectedGrid::remove ( )
virtual

Remove.

Reimplemented from Hydrax::Module::Module.

Definition at line 171 of file ProjectedGrid.cpp.

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

◆ saveCfg()

void Hydrax::Module::ProjectedGrid::saveCfg ( Ogre::String &  Data)
virtual

Save config.

Parameters
DataString reference

Reimplemented from Hydrax::Module::Module.

Definition at line 209 of file ProjectedGrid.cpp.

+ Here is the call graph for this function:

◆ setOptions()

void Hydrax::Module::ProjectedGrid::setOptions ( const Options Options)

Set options.

Parameters
OptionsOptions

Definition at line 96 of file ProjectedGrid.cpp.

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

◆ update()

void Hydrax::Module::ProjectedGrid::update ( const Ogre::Real &  timeSinceLastFrame)
virtual

Call it each frame.

Parameters
timeSinceLastFrameTime since last frame(delta)

Reimplemented from Hydrax::Module::Module.

Definition at line 244 of file ProjectedGrid.cpp.

+ Here is the call graph for this function:

Field Documentation

◆ mBasePlane

Ogre::Plane Hydrax::Module::ProjectedGrid::mBasePlane
private

Planes.

Definition at line 258 of file ProjectedGrid.h.

◆ mHydrax

Hydrax* Hydrax::Module::ProjectedGrid::mHydrax
private

Our Hydrax pointer.

Definition at line 279 of file ProjectedGrid.h.

◆ mLastMinMax

bool Hydrax::Module::ProjectedGrid::mLastMinMax
private

Definition at line 273 of file ProjectedGrid.h.

◆ mLastOrientation

Ogre::Quaternion Hydrax::Module::ProjectedGrid::mLastOrientation
private

Definition at line 272 of file ProjectedGrid.h.

◆ mLastPosition

Ogre::Vector3 Hydrax::Module::ProjectedGrid::mLastPosition
private

Last camera position, orientation.

Definition at line 271 of file ProjectedGrid.h.

◆ mLowerBoundPlane

Ogre::Plane Hydrax::Module::ProjectedGrid::mLowerBoundPlane
private

Definition at line 260 of file ProjectedGrid.h.

◆ mNormal

Ogre::Vector3 Hydrax::Module::ProjectedGrid::mNormal
private

Normal and position.

Definition at line 268 of file ProjectedGrid.h.

◆ mOptions

Options Hydrax::Module::ProjectedGrid::mOptions
private

Our projected grid options.

Definition at line 276 of file ProjectedGrid.h.

◆ mPos

Ogre::Vector3 Hydrax::Module::ProjectedGrid::mPos
private

Definition at line 268 of file ProjectedGrid.h.

◆ mProjectingCamera

Ogre::Camera* Hydrax::Module::ProjectedGrid::mProjectingCamera
private

Cameras.

Definition at line 263 of file ProjectedGrid.h.

◆ mRange

Ogre::Matrix4 Hydrax::Module::ProjectedGrid::mRange
private

Range matrix.

Definition at line 255 of file ProjectedGrid.h.

◆ mRenderingCamera

Ogre::Camera * Hydrax::Module::ProjectedGrid::mRenderingCamera
private

Definition at line 264 of file ProjectedGrid.h.

◆ mTmpRndrngCamera

Ogre::Camera * Hydrax::Module::ProjectedGrid::mTmpRndrngCamera
private

Definition at line 265 of file ProjectedGrid.h.

◆ mUpperBoundPlane

Ogre::Plane Hydrax::Module::ProjectedGrid::mUpperBoundPlane
private

Definition at line 259 of file ProjectedGrid.h.

◆ mVertices

void* Hydrax::Module::ProjectedGrid::mVertices
private

Vertex pointer (Mesh::POS_NORM_VERTEX or Mesh::POS_VERTEX)

Definition at line 246 of file ProjectedGrid.h.

◆ mVerticesChoppyBuffer

Mesh::POS_NORM_VERTEX* Hydrax::Module::ProjectedGrid::mVerticesChoppyBuffer
private

Use it to store vertex positions when choppy displacement is enabled.

Definition at line 249 of file ProjectedGrid.h.

◆ t_corners0

Ogre::Vector4 Hydrax::Module::ProjectedGrid::t_corners0
private

For corners.

Definition at line 252 of file ProjectedGrid.h.

◆ t_corners1

Ogre::Vector4 Hydrax::Module::ProjectedGrid::t_corners1
private

Definition at line 252 of file ProjectedGrid.h.

◆ t_corners2

Ogre::Vector4 Hydrax::Module::ProjectedGrid::t_corners2
private

Definition at line 252 of file ProjectedGrid.h.

◆ t_corners3

Ogre::Vector4 Hydrax::Module::ProjectedGrid::t_corners3
private

Definition at line 252 of file ProjectedGrid.h.


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