Rigs of Rods 2023.09
Soft-body Physics Simulation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
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>

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

Private Member Functions

void _createGeometry ()
 Create mesh geometry.
 

Private Attributes

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

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.

Member Function Documentation

◆ _createGeometry()

void Hydrax::Mesh::_createGeometry ( )
private

Create mesh geometry.

Definition at line 169 of file Mesh.cpp.

◆ 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.

◆ getEntity()

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

Get entity.

Returns
Entity

Definition at line 221 of file Mesh.h.

◆ 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.

◆ getHardwareIndexBuffer()

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

Get hardware index buffer reference.

Returns
Ogre::HardwareIndexBufferSharedPtr reference

Definition at line 285 of file Mesh.h.

◆ getHardwareVertexBuffer()

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

Get hardware vertex buffer reference.

Returns
Ogre::HardwareVertexBufferSharedPtr reference

Definition at line 277 of file Mesh.h.

◆ getMaterialName()

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

Get material name.

Returns
Material name

Definition at line 269 of file Mesh.h.

◆ 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.

◆ getOptions()

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

Get options.

Returns
Mesh options

Definition at line 229 of file Mesh.h.

◆ 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.

◆ getSize()

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

Get mesh size.

Returns
Mesh size

Definition at line 237 of file Mesh.h.

◆ getSubMesh()

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

Get sub mesh.

Returns
Sub mesh

Definition at line 213 of file Mesh.h.

◆ 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.

◆ 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.

◆ remove()

void Hydrax::Mesh::remove ( )

Remove all resources.

Definition at line 52 of file Mesh.cpp.

◆ setMaterialName()

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

Set mesh material.

Parameters
MaterialNameThe material name

Definition at line 107 of file Mesh.cpp.

◆ 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.

◆ 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.

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: