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

Class wich contains all funtions/variables related to Hydrax water mesh. More...

#include <Mesh.h>

+ Collaboration diagram for Hydrax::Mesh:

Data Structures

struct  Options
 Base Hydrax mesh options. More...
 
struct  POS_NORM_UV_VERTEX
 Vertex struct for position, normals and uv data. More...
 
struct  POS_NORM_VERTEX
 Vertex struct for position and normals data. More...
 
struct  POS_UV_VERTEX
 Vertex struct for position and uv data. More...
 
struct  POS_VERTEX
 Vertex struct for position data. More...
 

Public Types

enum  VertexType { VT_POS_NORM_UV = 0, VT_POS_NORM = 1, VT_POS_UV = 2, VT_POS = 3 }
 Mesh vertex type enum. More...
 

Public Member Functions

 Mesh (Hydrax *h)
 Constructor. More...
 
 ~Mesh ()
 Destructor. More...
 
void setOptions (const Options &Options)
 Update options. More...
 
void setMaterialName (const Ogre::String &MaterialName)
 Set mesh material. More...
 
void create ()
 Create our water mesh, geometry, entity, etc... More...
 
void remove ()
 Remove all resources. More...
 
bool updateGeometry (const int &numVer, void *verArray)
 Update geomtry. More...
 
bool isPointInGrid (const Ogre::Vector2 &Position)
 Get if a Position point is inside of the grid. More...
 
Ogre::Vector2 getGridPosition (const Ogre::Vector2 &Position)
 Get the [0,1] range x/y grid position from a 2D world space x/z point. More...
 
const Ogre::Vector3 getObjectSpacePosition (const Ogre::Vector3 &WorldSpacePosition) const
 Get the object-space position from world-space position. More...
 
const Ogre::Vector3 getWorldSpacePosition (const Ogre::Vector3 &ObjectSpacePosition) const
 Get the world-space position from object-space position. More...
 
Ogre::MeshPtr getMesh ()
 Get mesh. More...
 
Ogre::SubMesh * getSubMesh ()
 Get sub mesh. More...
 
Ogre::Entity * getEntity ()
 Get entity. More...
 
const OptionsgetOptions () const
 Get options. More...
 
const SizegetSize () const
 Get mesh size. More...
 
const VertexTypegetVertexType () const
 Get vertex type return Mesh vertex type. More...
 
const int & getNumFaces () const
 Get number of faces. More...
 
const int & getNumVertices () const
 Get number of vertices. More...
 
const Ogre::String & getMaterialName () const
 Get material name. 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...
 

Private Member Functions

void _createGeometry ()
 Create mesh geometry. More...
 

Private Attributes

Options mOptions
 Mesh options. More...
 
bool mCreated
 Is _createGeometry() called? More...
 
Ogre::MeshPtr mMesh
 Ogre::MeshPtr. More...
 
Ogre::SubMesh * mSubMesh
 Ogre::Submesh pointer. More...
 
Ogre::Entity * mEntity
 Ogre::Entity pointer. More...
 
int mNumFaces
 Number of faces. More...
 
int mNumVertices
 Number of vertices. More...
 
Ogre::HardwareVertexBufferSharedPtr mVertexBuffer
 Vertex buffer. More...
 
Ogre::HardwareIndexBufferSharedPtr mIndexBuffer
 Index buffer. More...
 
Ogre::SceneNode * mSceneNode
 Ogre::SceneNode pointer. More...
 
Ogre::String mMaterialName
 Material name. More...
 
HydraxmHydrax
 Hydrax pointer. More...
 

Detailed Description

Class wich contains all funtions/variables related to Hydrax water mesh.

Definition at line 46 of file Mesh.h.

Member Enumeration Documentation

◆ VertexType

Mesh vertex type enum.

Enumerator
VT_POS_NORM_UV 
VT_POS_NORM 
VT_POS_UV 
VT_POS 

Definition at line 83 of file Mesh.h.

Constructor & Destructor Documentation

◆ Mesh()

Hydrax::Mesh::Mesh ( Hydrax h)

Constructor.

Parameters
hHydrax pointer

Definition at line 32 of file Mesh.cpp.

◆ ~Mesh()

Hydrax::Mesh::~Mesh ( )

Destructor.

Definition at line 47 of file Mesh.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ _createGeometry()

void Hydrax::Mesh::_createGeometry ( )
private

Create mesh geometry.

Definition at line 169 of file Mesh.cpp.

+ Here is the caller graph for this function:

◆ create()

void Hydrax::Mesh::create ( )

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

Remarks
Call it after setMeshOptions() and setMaterialName()

Definition at line 117 of file Mesh.cpp.

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

◆ getEntity()

Ogre::Entity* Hydrax::Mesh::getEntity ( )
inline

Get entity.

Returns
Entity

Definition at line 221 of file Mesh.h.

+ Here is the caller graph for this function:

◆ getGridPosition()

Ogre::Vector2 Hydrax::Mesh::getGridPosition ( const Ogre::Vector2 &  Position)

Get the [0,1] range x/y grid position from a 2D world space x/z point.

Parameters
PositionWorld-space point
Returns
(-1,-1) if the point isn't in the grid.

Definition at line 353 of file Mesh.cpp.

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

◆ getHardwareIndexBuffer()

Ogre::HardwareIndexBufferSharedPtr& Hydrax::Mesh::getHardwareIndexBuffer ( )
inline

Get hardware index buffer reference.

Returns
Ogre::HardwareIndexBufferSharedPtr reference

Definition at line 285 of file Mesh.h.

+ Here is the caller graph for this function:

◆ getHardwareVertexBuffer()

Ogre::HardwareVertexBufferSharedPtr& Hydrax::Mesh::getHardwareVertexBuffer ( )
inline

Get hardware vertex buffer reference.

Returns
Ogre::HardwareVertexBufferSharedPtr reference

Definition at line 277 of file Mesh.h.

+ Here is the caller graph for this function:

◆ getMaterialName()

const Ogre::String& Hydrax::Mesh::getMaterialName ( ) const
inline

Get material name.

Returns
Material name

Definition at line 269 of file Mesh.h.

+ Here is the caller graph for this function:

◆ getMesh()

Ogre::MeshPtr Hydrax::Mesh::getMesh ( )
inline

Get mesh.

Returns
Mesh

Definition at line 205 of file Mesh.h.

◆ getNumFaces()

const int& Hydrax::Mesh::getNumFaces ( ) const
inline

Get number of faces.

Returns
Number of faces

Definition at line 253 of file Mesh.h.

◆ getNumVertices()

const int& Hydrax::Mesh::getNumVertices ( ) const
inline

Get number of vertices.

Returns
Number of vertices

Definition at line 261 of file Mesh.h.

◆ getObjectSpacePosition()

const Ogre::Vector3 Hydrax::Mesh::getObjectSpacePosition ( const Ogre::Vector3 &  WorldSpacePosition) const

Get the object-space position from world-space position.

Parameters
WorldSpacePositionPosition in world coords
Returns
Position in object-space

Definition at line 409 of file Mesh.cpp.

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

◆ getOptions()

const Options& Hydrax::Mesh::getOptions ( ) const
inline

Get options.

Returns
Mesh options

Definition at line 229 of file Mesh.h.

+ Here is the caller graph for this function:

◆ getSceneNode()

Ogre::SceneNode* Hydrax::Mesh::getSceneNode ( )
inline

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

Returns
Ogre::SceneNode*

Definition at line 293 of file Mesh.h.

+ Here is the caller graph for this function:

◆ getSize()

const Size& Hydrax::Mesh::getSize ( ) const
inline

Get mesh size.

Returns
Mesh size

Definition at line 237 of file Mesh.h.

+ Here is the caller graph for this function:

◆ getSubMesh()

Ogre::SubMesh* Hydrax::Mesh::getSubMesh ( )
inline

Get sub mesh.

Returns
Sub mesh

Definition at line 213 of file Mesh.h.

+ Here is the caller graph for this function:

◆ getVertexType()

const VertexType& Hydrax::Mesh::getVertexType ( ) const
inline

Get vertex type return Mesh vertex type.

Definition at line 245 of file Mesh.h.

◆ getWorldSpacePosition()

const Ogre::Vector3 Hydrax::Mesh::getWorldSpacePosition ( const Ogre::Vector3 &  ObjectSpacePosition) const

Get the world-space position from object-space position.

Parameters
ObjectSpacePositionPosition in object coords
Returns
Position in world-space

Definition at line 430 of file Mesh.cpp.

+ Here is the call graph for this function:

◆ isCreated()

const bool& Hydrax::Mesh::isCreated ( ) const
inline

Is _createGeometry() called?

Returns
true if created() have been already called

Definition at line 301 of file Mesh.h.

◆ isPointInGrid()

bool Hydrax::Mesh::isPointInGrid ( const Ogre::Vector2 &  Position)

Get if a Position point is inside of the grid.

Parameters
PositionWorld-space point
Returns
true if Position point is inside of the grid, else false.

Definition at line 300 of file Mesh.cpp.

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

◆ remove()

void Hydrax::Mesh::remove ( )

Remove all resources.

Definition at line 52 of file Mesh.cpp.

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

◆ setMaterialName()

void Hydrax::Mesh::setMaterialName ( const Ogre::String &  MaterialName)

Set mesh material.

Parameters
MaterialNameThe material name

Definition at line 107 of file Mesh.cpp.

+ Here is the caller graph for this function:

◆ setOptions()

void Hydrax::Mesh::setOptions ( const Options Options)

Update options.

Parameters
OptionsMesh options
Remarks
Call it before create(...)

Definition at line 78 of file Mesh.cpp.

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

◆ updateGeometry()

bool Hydrax::Mesh::updateGeometry ( const int &  numVer,
void *  verArray 
)

Update geomtry.

Parameters
numVerNumber of vertices
verArrayVertices array
Returns
false If number of vertices do not correspond.

Definition at line 281 of file Mesh.cpp.

+ Here is the caller graph for this function:

Field Documentation

◆ mCreated

bool Hydrax::Mesh::mCreated
private

Is _createGeometry() called?

Definition at line 314 of file Mesh.h.

◆ mEntity

Ogre::Entity* Hydrax::Mesh::mEntity
private

Ogre::Entity pointer.

Definition at line 320 of file Mesh.h.

◆ mHydrax

Hydrax* Hydrax::Mesh::mHydrax
private

Hydrax pointer.

Definition at line 338 of file Mesh.h.

◆ mIndexBuffer

Ogre::HardwareIndexBufferSharedPtr Hydrax::Mesh::mIndexBuffer
private

Index buffer.

Definition at line 329 of file Mesh.h.

◆ mMaterialName

Ogre::String Hydrax::Mesh::mMaterialName
private

Material name.

Definition at line 335 of file Mesh.h.

◆ mMesh

Ogre::MeshPtr Hydrax::Mesh::mMesh
private

Ogre::MeshPtr.

Definition at line 316 of file Mesh.h.

◆ mNumFaces

int Hydrax::Mesh::mNumFaces
private

Number of faces.

Definition at line 322 of file Mesh.h.

◆ mNumVertices

int Hydrax::Mesh::mNumVertices
private

Number of vertices.

Definition at line 324 of file Mesh.h.

◆ mOptions

Options Hydrax::Mesh::mOptions
private

Mesh options.

Definition at line 312 of file Mesh.h.

◆ mSceneNode

Ogre::SceneNode* Hydrax::Mesh::mSceneNode
private

Ogre::SceneNode pointer.

Definition at line 332 of file Mesh.h.

◆ mSubMesh

Ogre::SubMesh* Hydrax::Mesh::mSubMesh
private

Ogre::Submesh pointer.

Definition at line 318 of file Mesh.h.

◆ mVertexBuffer

Ogre::HardwareVertexBufferSharedPtr Hydrax::Mesh::mVertexBuffer
private

Vertex buffer.

Definition at line 327 of file Mesh.h.


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