MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Attributes | List of all members
Mezzanine::Graphics::MeshManager Class Reference

This manager handles the storage, generation, and query of of Graphics Meshes. More...

#include <meshmanager.h>

+ Inheritance diagram for Mezzanine::Graphics::MeshManager:
+ Collaboration diagram for Mezzanine::Graphics::MeshManager:

Public Types

typedef
MeshContainer::const_iterator 
ConstMeshIterator
 
typedef std::map< String, Mesh * > MeshContainer
 
typedef MeshContainer::iterator MeshIterator
 
- Public Types inherited from Mezzanine::ManagerBase
enum  ManagerType {
  MT_AudioManager = 1, MT_AnimationManager, MT_CollisionShapeManager, MT_CompositorManager,
  MT_GraphicsManager, MT_EventManager, MT_InputManager, MT_LogManager,
  MT_MaterialManager, MT_MeshManager, MT_NetworkManager, MT_ResourceManager,
  MT_ScriptingManager, MT_UIManager, MT_ActorManager = 100, MT_AreaEffectManager,
  MT_CameraManager, MT_DebrisManager, MT_PagingManager, MT_PhysicsManager,
  MT_SceneManager, MT_SoundScapeManager, MT_TerrainManager, MT_VehicleManager,
  MT_UserCreated = 512
}
 

Public Member Functions

 MeshManager ()
 Class constructor.
 
 MeshManager (XML::Node &XMLNode)
 XML constructor. More...
 
virtual ~MeshManager ()
 Class destructor.
 
virtual MeshCreateBoxCornerMesh (const String &MeshName, const String &MaterialName, const Vector3 &HalfExtents, const Real &BoxThickness)
 Creates a mesh composed of boxes that outline the corner edges of a larger box. More...
 
virtual MeshCreateBoxCornerMesh (const String &MeshName, const ColourValue &Colour, const Vector3 &HalfExtents, const Real &BoxThickness)
 Creates a mesh composed of boxes that outline the corner edges of a larger box. More...
 
virtual MeshCreateBoxMesh (const String &MeshName, const String &MaterialName, const Vector3 &HalfExtents)
 Creates a box graphical mesh. More...
 
virtual MeshCreateBoxMesh (const String &MeshName, const ColourValue &Colour, const Vector3 &HalfExtents)
 Creates a box graphical mesh. More...
 
virtual const StringCreateColouredMaterial (const String &MatName, const ColourValue &Colour, const String &Group="")
 Creates a basic material in code using the provided colour. More...
 
virtual MeshCreateCylinderMesh (const String &MeshName, const String &MaterialName, const Vector3 &HalfExtents, const Vector3 &AxisOrientation, const Whole &CircleRes=16, const Whole &Segments=1)
 Creates a cylinder graphical mesh. More...
 
virtual MeshCreateCylinderMesh (const String &MeshName, const ColourValue &Colour, const Vector3 &HalfExtents, const Vector3 &AxisOrientation, const Whole &CircleRes=16, const Whole &Segments=1)
 Creates a cylinder graphical mesh and simple material. More...
 
virtual MeshCreateMeshFromShape (const String &MeshName, const String &MaterialName, Physics::CollisionShape *Shape)
 Generates a mesh based on a collision shape. More...
 
virtual MeshCreateSphereMesh (const String &MeshName, const String &MaterialName, const Real &Radius, const Real &Rings=16, const Real &Segments=16)
 Creates a sphere graphical mesh. More...
 
virtual MeshCreateSphereMesh (const String &MeshName, const ColourValue &Colour, const Real &Radius, const Real &Rings=16, const Real &Segments=16)
 Creates a sphere graphical mesh and simple material. More...
 
virtual void Deinitialize ()
 Removes this manager from any necessary configuration so it can be safely disposed of. More...
 
virtual void DestroyAllGeneratedMeshes ()
 Destroys all the meshes generated by this generator.
 
void DestroyAllMeshes ()
 Clears this manager of all meshes, both loaded and generated.
 
virtual void DestroyGeneratedMesh (const String &MeshName)
 Destroys a named Mesh, freeing it's resources. More...
 
virtual String GetImplementationTypeName () const
 This Allows any manager name to be sent to a stream. Primarily used for logging. More...
 
virtual ManagerType GetInterfaceType () const
 This returns the type of this manager. More...
 
MeshGetMesh (const String &MeshName)
 Gets a mesh stored in this manager. More...
 
virtual Whole GetNumGeneratedMeshes ()
 Gets the number of meshes this generator has created and are in use. More...
 
virtual Whole GetNumLoadedMeshes ()
 Gets the number of currently loaded mesh files. More...
 
virtual void Initialize ()
 Configures this manager for use prior to entering the main loop. More...
 
virtual MeshLoadMesh (const String &MeshName, const String &Group)
 Loads a mesh file from disk and prepares it for use. More...
 
virtual void UnloadAllLoadedMeshes ()
 Unloads every mesh that is currently loaded.
 
virtual void UnloadMesh (const String &MeshName)
 Unloads a mesh file. More...
 
- Public Member Functions inherited from Mezzanine::ManagerBase
 ManagerBase ()
 Class constructor.
 
virtual ~ManagerBase ()
 Class destructor.
 
virtual String GetInterfaceTypeAsString () const
 Gets a string of the interface type of this manager. More...
 
bool IsInitialized () const
 Gets whether or not this manager has been initialized. More...
 
- Public Member Functions inherited from Mezzanine::Singleton< MeshManager >
 Singleton ()
 Class constructor.
 
 ~Singleton ()
 Class destructor.
 

Protected Attributes

MeshContainer GeneratedMeshes
 
MeshContainer LoadedMeshes
 
- Protected Attributes inherited from Mezzanine::ManagerBase
bool Initialized
 Simple bool indicating whether or not this manager has been initialized. More...
 
EntresolTheEntresol
 The actual pointer to the Entresol core class. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Mezzanine::ManagerBase
static String GetTypeAsString (const ManagerType &ManagerType)
 Gets the string form of the type of manager. More...
 
static ManagerType GetTypeFromString (const String &ManagerName)
 Gets the type of manager requested from a string. More...
 
- Static Public Member Functions inherited from Mezzanine::Singleton< MeshManager >
static MeshManager * GetSingletonPtr ()
 Fetches a pointer to the singleton. More...
 
static bool SingletonValid ()
 Checks to see if the singleton pointer is valid. More...
 
- Static Protected Attributes inherited from Mezzanine::Singleton< MeshManager >
static MeshManager * SingletonPtr
 

Detailed Description

This manager handles the storage, generation, and query of of Graphics Meshes.

Definition at line 69 of file meshmanager.h.

Constructor & Destructor Documentation

Mezzanine::Graphics::MeshManager::MeshManager ( XML::Node XMLNode)

XML constructor.

Parameters
XMLNodeThe node of the xml document to construct from.
Todo:
This class currently doesn't initialize anything from XML, if that changes this constructor needs to be expanded.

Definition at line 59 of file meshmanager.cpp.

Member Function Documentation

Mesh * Mezzanine::Graphics::MeshManager::CreateBoxCornerMesh ( const String MeshName,
const String MaterialName,
const Vector3 HalfExtents,
const Real BoxThickness 
)
virtual

Creates a mesh composed of boxes that outline the corner edges of a larger box.

Returns
Returns a pointer to the created Mesh.
Parameters
MeshNameThe name for the mesh which will be created. Use this to reference the mesh when creating other objects that need a mesh.
MaterialNameThe name of the material script which will be applied to this mesh.
HalfExtentsHalf of the full dimentions of the final object in world units. This allows the objects origin to be it's center.
BoxThicknessThe width/thickness of the smaller boxes that will outline the corners of the larger box.

Definition at line 422 of file meshmanager.cpp.

Mesh * Mezzanine::Graphics::MeshManager::CreateBoxCornerMesh ( const String MeshName,
const ColourValue Colour,
const Vector3 HalfExtents,
const Real BoxThickness 
)
virtual

Creates a mesh composed of boxes that outline the corner edges of a larger box.

Returns
Returns a pointer to the created Mesh.
Parameters
MeshNameThe name for the mesh which will be created. Use this to reference the mesh when creating other objects that need a mesh.
ColourThe colour to generate the material with that will be applied to the mesh. The created material's name will be autogenerated to "[Meshname]+Mat".
HalfExtentsHalf of the full dimentions of the final object in world units. This allows the objects origin to be it's center.
BoxThicknessThe width/thickness of the smaller boxes that will outline the corners of the larger box.

Definition at line 629 of file meshmanager.cpp.

Mesh * Mezzanine::Graphics::MeshManager::CreateBoxMesh ( const String MeshName,
const String MaterialName,
const Vector3 HalfExtents 
)
virtual

Creates a box graphical mesh.

Returns
Returns a pointer to the created Mesh.
Parameters
MeshNameThe name for the mesh which will be created. Use this to reference the mesh when creating other objects that need a mesh.
MaterialNameThe name of the material script which will be applied to this mesh.
HalfExtentsHalf of the full dimentions of the final object in world units. This allows the objects origin to be it's center.

Definition at line 160 of file meshmanager.cpp.

Mesh * Mezzanine::Graphics::MeshManager::CreateBoxMesh ( const String MeshName,
const ColourValue Colour,
const Vector3 HalfExtents 
)
virtual

Creates a box graphical mesh.

Returns
Returns a pointer to the created Mesh.
Parameters
MeshNameThe name for the mesh which will be created. Use this to reference the mesh when creating other objects that need a mesh.
ColourThe colour to generate the material with that will be applied to the mesh. The created material's name will be autogenerated to "[Meshname]+Mat".
HalfExtentsHalf of the full dimentions of the final object in world units. This allows the objects origin to be it's center.

Definition at line 218 of file meshmanager.cpp.

const String & Mezzanine::Graphics::MeshManager::CreateColouredMaterial ( const String MatName,
const ColourValue Colour,
const String Group = "" 
)
virtual

Creates a basic material in code using the provided colour.

Returns
Returns a string containing the name of the created Material. This is actually the same string as whats passed in as the MatName, just here as convenience when calling the function as an argument in other functions.
Parameters
MatNameThe name to assign to the created material.
ColourThe colour to assign to the created material.
GroupThe resource group where to place this material. Will be placed in an internal resouce group if left blank.

Definition at line 644 of file meshmanager.cpp.

Mesh * Mezzanine::Graphics::MeshManager::CreateCylinderMesh ( const String MeshName,
const String MaterialName,
const Vector3 HalfExtents,
const Vector3 AxisOrientation,
const Whole CircleRes = 16,
const Whole Segments = 1 
)
virtual

Creates a cylinder graphical mesh.

Returns
Returns a pointer to the created Mesh.
Parameters
MeshNameThe name for the mesh which will be created. Use this to reference the mesh when creating other objects that need a mesh.
MaterialNameThe name of the material script which will be applied to this mesh.
HalfExtentsHalf of the full dimentions of the final object in world units. This allows the objects origin to be it's center.
AxisOrientationVector3 representing which axis the cylinder should be aligned on. Should be one of the three: (1,0,0), (0,1,0), (0,0,1).
CircleResThe number of segments the circle should be comprised of. Determines the "resolution" of the cylinder.
SegmentsOptional parameter to specify the number of segments the cylinder should be comprised of. Mostly just useful if a special material is made for his.

Start of MIT(Ogre Proceadural) License ///

Todo:
These if/elses aren't really a long term solution as they won't work for any more then 1 segment. This needs to be addressed.

End of MIT(Ogre Proceadural) License ///

Definition at line 225 of file meshmanager.cpp.

Mesh * Mezzanine::Graphics::MeshManager::CreateCylinderMesh ( const String MeshName,
const ColourValue Colour,
const Vector3 HalfExtents,
const Vector3 AxisOrientation,
const Whole CircleRes = 16,
const Whole Segments = 1 
)
virtual

Creates a cylinder graphical mesh and simple material.

Returns
Returns a pointer to the created Mesh.
Parameters
MeshNameThe name for the mesh which will be created. Use this to reference the mesh when creating other objects that need a mesh.
ColourThe colour to generate the material with that will be applied to the mesh. The created material's name will be autogenerated to "[Meshname]+Mat".
HalfExtentsHalf of the full dimentions of the final object in world units. This allows the objects origin to be it's center.
AxisOrientationVector3 representing which axis the cylinder should be aligned on. Should be one of the three: (1,0,0), (0,1,0), (0,0,1).
CircleResThe number of segments the circle should be comprised of. Determines the "resolution" of the cylinder.
SegmentsOptional parameter to specify the number of segments the cylinder should be comprised of. Mostly just useful if a special material is made for his.

Definition at line 341 of file meshmanager.cpp.

Mesh * Mezzanine::Graphics::MeshManager::CreateMeshFromShape ( const String MeshName,
const String MaterialName,
Physics::CollisionShape Shape 
)
virtual

Generates a mesh based on a collision shape.

Remarks
This is just a convenience function. You can fetch the information and build the mesh yourself with greater flexability then what this function has to offer. This function only supports building the shapes this manager can generate, and it will only use default options when deciding the parameters to use(if it's a parameter it can't get from the shape).
Returns
Returns a pointer to the created mesh.
Parameters
MeshNameThe name that will be given to the generated mesh.
MaterialNameThe name of the material to use with this mesh.
ShapeThe shape to base the mesh on.

Definition at line 636 of file meshmanager.cpp.

Mesh * Mezzanine::Graphics::MeshManager::CreateSphereMesh ( const String MeshName,
const String MaterialName,
const Real Radius,
const Real Rings = 16,
const Real Segments = 16 
)
virtual

Creates a sphere graphical mesh.

Returns
Returns a pointer to the created Mesh.
Parameters
MeshNameThe name for the mesh which will be created. Use this to reference the mesh when creating other objects that need a mesh.
MaterialNameThe name of the material script which will be applied to this mesh.
RadiusThe radius to generate the sphere with in world units.
RingsThe number of horizontal rings the sphere is to be comprised of. This along with the segments parameter controls the overall resolution of the sphere. Less then 16 is not recommended.
SegmentsThe number of vertical rings the sphere is to be comprised of. This along with the rings parameter controls the overall resolution of the sphere. Less then 16 is not recommended.

Definition at line 348 of file meshmanager.cpp.

Mesh * Mezzanine::Graphics::MeshManager::CreateSphereMesh ( const String MeshName,
const ColourValue Colour,
const Real Radius,
const Real Rings = 16,
const Real Segments = 16 
)
virtual

Creates a sphere graphical mesh and simple material.

Returns
Returns a pointer to the created Mesh.
Parameters
MeshNameThe name for the mesh which will be created. Use this to reference the mesh when creating other objects that need a mesh.
ColourThe colour to generate the material with that will be applied to the mesh. The created material's name will be autogenerated to "[Meshname]+Mat".
RadiusThe radius to generate the sphere with in world units.
RingsThe number of horizontal rings the sphere is to be comprised of. This along with the segments parameter controls the overall resolution of the sphere. Less then 16 is not recommended.
SegmentsThe number of vertical rings the sphere is to be comprised of. This along with the rings parameter controls the overall resolution of the sphere. Less then 16 is not recommended.

Definition at line 397 of file meshmanager.cpp.

void Mezzanine::Graphics::MeshManager::Deinitialize ( )
virtual

Removes this manager from any necessary configuration so it can be safely disposed of.

Implements Mezzanine::ManagerBase.

Definition at line 667 of file meshmanager.cpp.

void Mezzanine::Graphics::MeshManager::DestroyGeneratedMesh ( const String MeshName)
virtual

Destroys a named Mesh, freeing it's resources.

Parameters
MeshNameThe name of the mesh to be destroyed.

Definition at line 136 of file meshmanager.cpp.

String Mezzanine::Graphics::MeshManager::GetImplementationTypeName ( ) const
virtual

This Allows any manager name to be sent to a stream. Primarily used for logging.

Returns
This returns a String that contains the name.

Implements Mezzanine::ManagerBase.

Definition at line 676 of file meshmanager.cpp.

ManagerBase::ManagerType Mezzanine::Graphics::MeshManager::GetInterfaceType ( ) const
virtual

This returns the type of this manager.

This is intended to make using and casting from Manager base easier. With this is is possible to cast from ManagerBase to the correct Manager Type.

Returns
This returns a ManagerTypeName to identify what this can be safely cast to.

Implements Mezzanine::ManagerBase.

Definition at line 673 of file meshmanager.cpp.

Mesh * Mezzanine::Graphics::MeshManager::GetMesh ( const String MeshName)

Gets a mesh stored in this manager.

Returns
Returns a pointer to the requested mesh.
Parameters
MeshNameThe name of the mesh to retrieve.

Definition at line 73 of file meshmanager.cpp.

Whole Mezzanine::Graphics::MeshManager::GetNumGeneratedMeshes ( )
virtual

Gets the number of meshes this generator has created and are in use.

Returns
Returns a Whole representing the number of meshes created by this generator.

Definition at line 131 of file meshmanager.cpp.

Whole Mezzanine::Graphics::MeshManager::GetNumLoadedMeshes ( )
virtual

Gets the number of currently loaded mesh files.

Returns
Returns a whole representing the number of mesh files currently loaded.

Definition at line 113 of file meshmanager.cpp.

void Mezzanine::Graphics::MeshManager::Initialize ( )
virtual

Configures this manager for use prior to entering the main loop.

Implements Mezzanine::ManagerBase.

Definition at line 664 of file meshmanager.cpp.

Mesh * Mezzanine::Graphics::MeshManager::LoadMesh ( const String MeshName,
const String Group 
)
virtual

Loads a mesh file from disk and prepares it for use.

Returns
Returns a pointer to the loaded mesh.
Parameters
MeshNameThe name of the mesh file to be loaded.
GroupThe resource group from which the mesh file should be loaded.

Definition at line 93 of file meshmanager.cpp.

void Mezzanine::Graphics::MeshManager::UnloadMesh ( const String MeshName)
virtual

Unloads a mesh file.

Parameters
MeshNameThe name of the mesh to be unloaded.

Definition at line 103 of file meshmanager.cpp.


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