40 #ifndef _graphicsmeshmanager_cpp
41 #define _graphicsmeshmanager_cpp
43 #include "Graphics/meshmanager.h"
44 #include "Graphics/mesh.h"
49 #include "Internal/iostreamwrapper.h.cpp"
55 template<> Graphics::MeshManager* Singleton<Graphics::MeshManager>::SingletonPtr = NULL;
80 if( MeshIt == this->
Meshes.end() ) {
81 this->
Meshes.insert( std::pair<String,Mesh*>(MeshName,ToAdd) );
93 if( MeshIt != this->
Meshes.end() ) {
94 return (*MeshIt).second;
101 size_t Slash = FilePathAndName.find_last_of(
"\\/");
102 if( Slash != String::npos ) {
103 std::ifstream Stream;
104 Stream.open(FilePathAndName.c_str());
105 Ogre::MeshSerializer OgreSerializer;
107 Ogre::MeshPtr NewMesh = Ogre::MeshManager::getSingleton().createManual(FilePathAndName.substr(Slash+1),Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
108 OgreSerializer.importMesh(OgreStreamPtr,NewMesh.get());
124 if( MeshIt == this->
Meshes.end() ) {
128 delete (*MeshIt).second;
129 this->
Meshes.erase(MeshIt);
135 {
delete (*MeshIt).second; }
147 Ogre::MeshSerializer OgreSerializer;
148 OgreSerializer.exportMesh(ToSave->
_GetInternalMesh().get(),FilePathAndName);
153 Ogre::MeshSerializer OgreSerializer;
161 if( MeshIt != this->
Meshes.end() ) {
162 return (*MeshIt).second;
169 return this->
Meshes.size();
201 {
return Ogre::MeshManager::getSingletonPtr(); }
235 {
delete ToBeDestroyed; }
virtual void AddMesh(Mesh *ToAdd)
Adds a Mesh to this manager. the name of the Mesh being added is not unique a II_DUPLICATE_IDENTITY_E...
virtual void Deinitialize()
Removes this manager from any necessary configuration so it can be safely disposed of...
Thrown when duplicates of teh same identity string exist.
String GetManagerImplName() const
Gets the name of the manager that is created by this factory.
void SaveMesh(Mesh *ToSave, const String &FileName, const String &GroupName)
Writes a Mesh to the asset group.
void UnloadAllMeshes()
Unloads every Mesh that is currently loaded.
EntresolManager * CreateManager(const NameValuePairList &Params)
Creates a manager of the type represented by this factory.
static const ManagerBase::ManagerType InterfaceType
A ManagerType enum value used to describe the type of interface/functionality this manager provides...
ManagerType
A listing of Manager Types.
Whole GetNumMeshes()
Gets the number of currently loaded meshes.
Ogre::MeshManager * _GetInternalManager() const
Gets the internal MeshManager.
#define MEZZ_EXCEPTION(num, desc)
An easy way to throw exceptions with rich information.
This class is used to check and modify the properties of a graphics mesh.
Thrown when we just have not coded a thing yet, but we knew what the API should look like...
Ogre::MeshPtr _GetInternalMesh() const
Gets the internal Mesh pointer.
Mesh * _WrapInternalMesh(Ogre::MeshPtr ToWrap)
Wraps and stores an Ogre Mesh instance.
MeshManager()
Class constructor.
MeshContainer Meshes
Container storing all of the currently loaded Meshes.
This implements the exception hiearchy for Mezzanine.
Mesh * LoadMesh(const String &ResourceName, const String &ResourceGroup)
Loads a Mesh file from an asset group and prepares it for use.
void UnloadMesh(const String &MeshName)
Unloads a Mesh from memory.
static const String ImplementationName
A String containing the name of this manager implementation.
Mesh * GetMesh(const String &MeshName)
Gets a Mesh stored in this manager.
void DestroyManager(EntresolManager *ToBeDestroyed)
Destroys a Manager created by this factory.
static Boole SingletonValid()
Checks to see if the singleton pointer is valid.
ConstString & GetName() const
Gets the Name of this Mesh.
virtual ManagerType GetInterfaceType() const
This returns the type of this manager.
static MeshManager * GetSingletonPtr()
Fetches a pointer to the singleton.
This is the base class for all managers that do no describe properties of a single world...
A light-weight handle for manipulating nodes in DOM tree.
virtual ~DefaultMeshManagerFactory()
Class destructor.
MeshContainer::iterator MeshIterator
Iterator type for Mesh instances stored in this class.
std::list< NameValuePair > NameValuePairList
This is a datatype mostly used for describing settings or parameters that can't be declared in advanc...
DefaultMeshManagerFactory()
Class constructor.
virtual ~MeshManager()
Class destructor.
virtual void Initialize()
Configures this manager for use prior to entering the main loop.
The bulk of the engine components go in this namspace.
unsigned long Whole
Whole is an unsigned integer, it will be at least 32bits in size.
CountedPtr< DataStream > DataStreamPtr
This is a convenience type for a data stream in a counted pointer.
This manager handles the storage, generation, and query of of Graphics Meshes.
std::string String
A datatype used to a series of characters.
ManagerBase::ManagerType GetManagerType() const
Gets the type of manager that is created by this factory.
Boole Initialized
Simple Boole indicating whether or not this manager has been initialized.
virtual String GetImplementationTypeName() const
This Allows any manager name to be sent to a stream. Primarily used for logging.