Ogre Procedural  0.3.0 unstable
Procedural Geometry & Textures for Ogre3D
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Procedural::MeshGenerator< T > Class Template Referenceabstract

#include <ProceduralMeshGenerator.h>

Public Member Functions

 MeshGenerator ()
 Default constructor. More...
 
Ogre::MeshPtr realizeMesh (const std::string &name="", const Ogre::String &group="General")
 Builds a mesh. More...
 
TriangleBuffer buildTriangleBuffer () const
 Outputs a triangleBuffer. More...
 
virtual void addToTriangleBuffer (TriangleBuffer &buffer) const =0
 Overloaded by each generator to implement the specifics. More...
 
T & setUTile (Ogre::Real uTile)
 Sets U Tile, ie the number by which u texture coordinates are multiplied (default=1) More...
 
T & setVTile (Ogre::Real vTile)
 Sets V Tile, ie the number by which v texture coordinates are multiplied (default=1) More...
 
T & setTextureRectangle (const Ogre::RealRect &textureRectangle)
 Sets the texture rectangle. More...
 
T & setEnableNormals (bool enableNormals)
 Sets whether normals are enabled or not (default=true) More...
 
T & setNumTexCoordSet (unsigned char numTexCoordSet)
 Sets the number of texture coordintate sets (default=1) More...
 
T & setSwitchUV (bool switchUV)
 Sets whether to switch U and V texture coordinates. More...
 
T & setOrientation (const Ogre::Quaternion &orientation)
 Sets an orientation to give when building the mesh. More...
 
T & setPosition (const Ogre::Vector3 &position)
 Sets a translation baked into the resulting mesh. More...
 
T & setPosition (Ogre::Real x, Ogre::Real y, Ogre::Real z)
 Sets a translation baked into the resulting mesh. More...
 
T & setScale (const Ogre::Vector3 &scale)
 Sets a scale baked into the resulting mesh. More...
 
T & setScale (Ogre::Real scale)
 Sets a uniform scale baked into the resulting mesh. More...
 
T & setScale (Ogre::Real x, Ogre::Real y, Ogre::Real z)
 Sets a scale baked into the resulting mesh. More...
 
T & resetTransforms ()
 Resets all transforms (orientation, position and scale) that would have been applied to the mesh to their default values. More...
 

Protected Member Functions

void addPoint (TriangleBuffer &buffer, const Ogre::Vector3 &position, const Ogre::Vector3 &normal, const Ogre::Vector2 &uv) const
 Adds a new point to a triangle buffer, using the format defined for that MeshGenerator. More...
 

Protected Attributes

Ogre::Real mUTile
 A pointer to the default scene manager. More...
 
Ogre::Real mVTile
 V tile for texture coords generation. More...
 
bool mEnableNormals
 Whether to produces normals or not. More...
 
unsigned char mNumTexCoordSet
 The number of texture coordinate sets to include. More...
 
Ogre::Vector2 mUVOrigin
 Rectangle in which the texture coordinates will be placed. More...
 
bool mSwitchUV
 If set to true, the UV coordinates coming from the mesh generator will be switched. More...
 
Ogre::Quaternion mOrientation
 Orientation to apply the mesh. More...
 
Ogre::Vector3 mScale
 Scale to apply the mesh. More...
 
Ogre::Vector3 mPosition
 Position to apply to the mesh. More...
 
bool mTransform
 

Detailed Description

template<typename T>
class Procedural::MeshGenerator< T >

Superclass of everything that builds meshes

Constructor & Destructor Documentation

◆ MeshGenerator()

template<typename T >
Procedural::MeshGenerator< T >::MeshGenerator ( )

Default constructor.

Exceptions
Ogre::InvalidStateExceptionScene Manager is not set in OGRE root object

Member Function Documentation

◆ addPoint()

template<typename T >
void Procedural::MeshGenerator< T >::addPoint ( TriangleBuffer buffer,
const Ogre::Vector3 position,
const Ogre::Vector3 normal,
const Ogre::Vector2 uv 
) const
protected

Adds a new point to a triangle buffer, using the format defined for that MeshGenerator.

Parameters
bufferthe triangle buffer to update
positionthe position of the new point
normalthe normal of the new point
uvthe uv texcoord of the new point

◆ addToTriangleBuffer()

template<typename T >
virtual void Procedural::MeshGenerator< T >::addToTriangleBuffer ( TriangleBuffer buffer) const
pure virtual

◆ buildTriangleBuffer()

template<typename T >
TriangleBuffer Procedural::MeshGenerator< T >::buildTriangleBuffer ( ) const

Outputs a triangleBuffer.

◆ realizeMesh()

template<typename T >
Ogre::MeshPtr Procedural::MeshGenerator< T >::realizeMesh ( const std::string &  name = "",
const Ogre::String group = "General" 
)

Builds a mesh.

Parameters
nameof the mesh for the MeshManager
groupressource group in which the mesh will be created

◆ resetTransforms()

template<typename T >
T& Procedural::MeshGenerator< T >::resetTransforms ( )

Resets all transforms (orientation, position and scale) that would have been applied to the mesh to their default values.

◆ setEnableNormals()

template<typename T >
T& Procedural::MeshGenerator< T >::setEnableNormals ( bool  enableNormals)

Sets whether normals are enabled or not (default=true)

◆ setNumTexCoordSet()

template<typename T >
T& Procedural::MeshGenerator< T >::setNumTexCoordSet ( unsigned char  numTexCoordSet)

Sets the number of texture coordintate sets (default=1)

◆ setOrientation()

template<typename T >
T& Procedural::MeshGenerator< T >::setOrientation ( const Ogre::Quaternion orientation)

Sets an orientation to give when building the mesh.

◆ setPosition() [1/2]

template<typename T >
T& Procedural::MeshGenerator< T >::setPosition ( const Ogre::Vector3 position)

Sets a translation baked into the resulting mesh.

◆ setPosition() [2/2]

template<typename T >
T& Procedural::MeshGenerator< T >::setPosition ( Ogre::Real  x,
Ogre::Real  y,
Ogre::Real  z 
)

Sets a translation baked into the resulting mesh.

◆ setScale() [1/3]

template<typename T >
T& Procedural::MeshGenerator< T >::setScale ( const Ogre::Vector3 scale)

Sets a scale baked into the resulting mesh.

◆ setScale() [2/3]

template<typename T >
T& Procedural::MeshGenerator< T >::setScale ( Ogre::Real  scale)

Sets a uniform scale baked into the resulting mesh.

◆ setScale() [3/3]

template<typename T >
T& Procedural::MeshGenerator< T >::setScale ( Ogre::Real  x,
Ogre::Real  y,
Ogre::Real  z 
)

Sets a scale baked into the resulting mesh.

◆ setSwitchUV()

template<typename T >
T& Procedural::MeshGenerator< T >::setSwitchUV ( bool  switchUV)

Sets whether to switch U and V texture coordinates.

◆ setTextureRectangle()

template<typename T >
T& Procedural::MeshGenerator< T >::setTextureRectangle ( const Ogre::RealRect textureRectangle)

Sets the texture rectangle.

◆ setUTile()

template<typename T >
T& Procedural::MeshGenerator< T >::setUTile ( Ogre::Real  uTile)

Sets U Tile, ie the number by which u texture coordinates are multiplied (default=1)

◆ setVTile()

template<typename T >
T& Procedural::MeshGenerator< T >::setVTile ( Ogre::Real  vTile)

Sets V Tile, ie the number by which v texture coordinates are multiplied (default=1)

Member Data Documentation

◆ mEnableNormals

template<typename T >
bool Procedural::MeshGenerator< T >::mEnableNormals
protected

◆ mNumTexCoordSet

template<typename T >
unsigned char Procedural::MeshGenerator< T >::mNumTexCoordSet
protected

◆ mOrientation

template<typename T >
Ogre::Quaternion Procedural::MeshGenerator< T >::mOrientation
protected

◆ mPosition

template<typename T >
Ogre::Vector3 Procedural::MeshGenerator< T >::mPosition
protected

◆ mScale

template<typename T >
Ogre::Vector3 Procedural::MeshGenerator< T >::mScale
protected

◆ mSwitchUV

template<typename T >
bool Procedural::MeshGenerator< T >::mSwitchUV
protected

If set to true, the UV coordinates coming from the mesh generator will be switched.

It can be used, for example, if your texture doesn't fit the mesh generator's assumptions about UV. If UV were to fit in a given rectangle, they still fit in it after the switch.

Referenced by Procedural::MeshGenerator< TorusGenerator >::addPoint(), and Procedural::MeshGenerator< TorusGenerator >::setSwitchUV().

◆ mTransform

template<typename T >
bool Procedural::MeshGenerator< T >::mTransform
protected

◆ mUTile

template<typename T >
Ogre::Real Procedural::MeshGenerator< T >::mUTile
protected

◆ mUVOrigin

template<typename T >
Ogre::Vector2 Procedural::MeshGenerator< T >::mUVOrigin
protected

Rectangle in which the texture coordinates will be placed.

Referenced by Procedural::MeshGenerator< TorusGenerator >::addPoint(), and Procedural::MeshGenerator< TorusGenerator >::setTextureRectangle().

◆ mVTile

template<typename T >
Ogre::Real Procedural::MeshGenerator< T >::mVTile
protected

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