46 #include "worldmanager.h"
47 #include "worldmanagerfactory.h"
48 #include "stringtool.h"
51 #include "actormanager.h"
52 #include "areaeffectmanager.h"
54 #include "terrainmanager.h"
56 #include "Audio/soundscapemanager.h"
57 #include "Graphics/scenemanager.h"
58 #include "Physics/physicsmanager.h"
61 #ifdef ENABLE_OALS_AUDIO_IMPLEMENTATION
62 #include "Audio/OALS/oalssoundscapemanagerfactory.h"
63 #endif // ENABLE_OALS_AUDIO_IMPLEMENTATION
73 std::vector <WorldManager*> temp;
75 this->
Construct(PhysicsInfo,
"DefaultSceneManager",temp);
83 this->
Construct(PhysicsInfo,
"DefaultSceneManager",Managers);
89 std::vector <WorldManager*> temp;
91 this->
Construct(PhysicsInfo, SceneType, temp);
97 this->
Construct(PhysicsInfo, SceneType, Managers);
118 if( this->
GetManager(ManagerBase::MT_ActorManager) == 0 ) {
121 if( this->
GetManager(ManagerBase::MT_AreaEffectManager) == 0 ) {
124 if( this->
GetManager(ManagerBase::MT_DebrisManager) == 0 ) {
127 if( this->
GetManager(ManagerBase::MT_SceneManager) == 0 ) {
128 Params.push_back( std::make_pair(
String(
"InternalManagerTypeName"),SceneType ) );
132 if( this->
GetManager(ManagerBase::MT_PhysicsManager) == 0 ) {
144 #ifdef ENABLE_OALS_AUDIO_IMPLEMENTATION
145 if( this->
GetManager(ManagerBase::MT_SoundScapeManager) == 0 ) {
148 #endif //ENABLE_OALS_AUDIO_IMPLEMENTATION
160 {
return this->
Name; }
172 if( PhysMan != NULL ) {
182 if( ActorMan != NULL ) {
185 if( AreaEffectMan != NULL ) {
188 if( DebrisMan != NULL ) {
196 if( PhysMan != NULL ) {
199 if( SceneMan != NULL ) {
203 if( SoundScapeMan != NULL ) {
217 InitStream <<
"Initializing " << (*ManIter)->GetImplementationTypeName() <<
" as " << (*ManIter)->GetInterfaceTypeAsString() <<
"." << std::endl;
220 (*ManIter)->Initialize();
230 DeinitStream <<
"Deinitializing " << (*ManIter)->GetImplementationTypeName() <<
" as " << (*ManIter)->GetInterfaceTypeAsString() <<
"." << std::endl;
233 (*ManIter)->Deinitialize();
249 if( FactoryIt == World::ManagerFactories.end() ) {
252 WorldManager* NewMan = (*FactoryIt).second->CreateManager(
this,Params);
262 if( FactoryIt == World::ManagerFactories.end() ) {
265 WorldManager* NewMan = (*FactoryIt).second->CreateManager(
this,XMLNode);
276 if( FactoryIt == World::ManagerFactories.end() ) {
280 (*FactoryIt).second->DestroyManager(ToBeDestroyed);
301 String ImplName = (*WorldManIt)->GetImplementationTypeName();
303 if( FactoryIt == World::ManagerFactories.end() ) {
306 (*FactoryIt).second->DestroyManager( (*WorldManIt) );
317 if( (*ManIter)->GetInterfaceType() == IType )
328 if( (*ManIter)->GetInterfaceType() == ManagerToGet )
338 if( (*ManIter) == ToBeRemoved ) {
349 if( (*ManIter)->GetInterfaceType() == ToBeRemoved ) {
371 World::ManagerFactories.insert(std::pair<String,WorldManagerFactory*>(ToBeAdded->
GetManagerImplName(),ToBeAdded));
382 if( ManIt != World::ManagerFactories.end() )
383 { World::ManagerFactories.erase(ManIt); }
394 if( ManIt != World::ManagerFactories.end() ) {
395 delete ManIt->second;
396 World::ManagerFactories.erase(ManIt);
402 for(
ManagerFactoryIterator ManIt = World::ManagerFactories.begin() ; ManIt != World::ManagerFactories.end() ; ++ManIt )
403 {
delete (*ManIt).second; }
404 World::ManagerFactories.clear();
411 ManIt = World::ManagerFactories.find(
"DefaultActorManager");
414 ManIt = World::ManagerFactories.find(
"DefaultAreaEffectManager");
417 ManIt = World::ManagerFactories.find(
"DefaultDebrisManager");
420 ManIt = World::ManagerFactories.find(
"DefaultPhysicsManager");
423 ManIt = World::ManagerFactories.find(
"DefaultSceneManager");
426 ManIt = World::ManagerFactories.find(
"DefaultTerrainManager");
429 #ifdef ENABLE_OALS_AUDIO_IMPLEMENTATION
431 ManIt = World::ManagerFactories.find(
"OALSSoundScapeManager");
432 if( ManIt == World::ManagerFactories.end() )
World::AddManagerFactory(
new Audio::OALS::OALSSoundScapeManagerFactory());
433 #endif //ENABLE_OALS_AUDIO_IMPLEMENTATION
virtual void DestroyAllAreaEffects()
Destroys all actors currently within this manager.
void RemoveManager(WorldManager *ToBeRemoved)
This removes a manager by finding the matching pointer.
static void RemoveManagerFactory(WorldManagerFactory *ToBeRemoved)
Removes a manager factory from the container of registered factories.
A factory responsible for the creation and destruction of the default DebrisManager.
virtual ManagerType GetInterfaceType() const =0
This returns the type of this manager.
virtual void DestroyAllActors()
Destroys all Actors currently within this manager.
WorldManager * GetManager(const Whole ManagerToGet)
This is will find the manager of a given type.
static void DestroyAllManagerFactories()
Destroys all registered manager factories.
static ManagerFactoryMap ManagerFactories
A global container for registered factories for WorldManagers.
WorldManagerContainer & GetWorldManagers()
This gets the list of managers in the world.
WorldManagerContainer::const_iterator ConstWorldManagerIterator
Const Iterator type for WorldManager instances stored by this class.
bool Boole
Generally acts a single bit, true or false.
This class contains utilities and functions to allow the manipulation of the Graphical scene...
Vector3 GeographyLowerBounds
The lower limits of the worlds AABB.
A manager responsible for the storage and management of all areaeffects in use.
This file contains the declaration for the manager that manages debris objects in a world...
void Deinitialize()
Deinitializes all managers in this world and unhooks all of it's systems, disabling this world...
ManagerType
A listing of Manager Types.
WorldManagerContainer WorldManagers
A container storing all the managers belonging to this world.
void DestroyAllManagers()
Destroys all managers currently in the World.
Thrown when the requested identity could not be found.
#define MEZZ_EXCEPTION(num, desc)
An easy way to throw exceptions with rich information.
WorldManagerContainer::iterator WorldManagerIterator
Iterator type for WorldManager instances stored by this class.
void DisableSky()
If any sky is active, disable it.
A factory responsible for the creation and destruction of the default terrainmanager.
Vector3 Gravity
The gravity to set for the world.
Enables multi-threaded acceleration structures.
WorldManager * CreateManager(const String &ManagerImplName, const NameValuePairList &Params, Boole AddToWorld=true)
Creates a new manager.
virtual void ProtoDeSerialize(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite this object with it.
static void AddManagerFactory(WorldManagerFactory *ToBeAdded)
Adds/registers a manager factory for use with World instances.
void _Log(const T &Message)
Runtime event and message logging.
virtual String GetImplementationTypeName() const =0
This Allows any manager name to be sent to a stream. Primarily used for logging.
String Name
Unique string identifier for world.
Enables support for soft bodies in the simulation.
virtual ~World()
class destructor.
virtual void ProtoSerializeProperties(XML::Node &SelfRoot) const
Convert the properties of this class to an XML::Node ready for serialization.
std::stringstream StringStream
A Datatype used for streaming operations with strings.
static void DestroyManagerFactory(WorldManagerFactory *ToBeRemoved)
Removes and destroys a manager factory in the container of registered factories.
std::map< String, WorldManagerFactory * > ManagerFactoryMap
Basic container type for factories that construct known manager types.
Enables support for very large simulations.
virtual void DestroyAllDebris()
Destroys all Debriss currently within this manager.
void ClearPhysicsMetaData()
Clears all data relating to actors and other simulation objects from the physics world.
static Entresol * GetSingletonPtr()
Fetches a pointer to the singleton.
ManagerFactoryMap::iterator ManagerFactoryIterator
Iterator type for manager factories stored by this class.
A manager responsible for the storage and management of all Debris that exist in a world...
virtual void ProtoDeSerializeProperties(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite the properties of this object with it...
A light-weight handle for manipulating nodes in DOM tree.
void Construct(const Physics::ManagerConstructionInfo &PhysicsInfo, const String &SceneType, const WorldManagerContainer &ManagerToBeAdded)
Helper function used to assist construction.
Whole MaxProxies
The maximum number of Actors and Area Effects you expect to have in the world at one time...
static void AddAllEngineDefaultManagerFactories()
Adds all the default manager factories provided by the engine.
virtual void DestroyAllProxies()=0
Deletes all stored SoundProxy instances.
A factory responsible for the creation and destruction of the default areaeffectmanager.
void Initialize()
Initializes all managers in this world and performs all the necessary hooks to enable this world...
A factory responsible for the creation and destruction of the default physicsmanager.
void DestroyAllProxies()
Deletes all stored RenderableProxy instances.
void DestroyAllConstraints()
Destroys all constraints currently in the manager.
void PauseWorld(const Boole Pause)
Pauses all animations, particles, and object movement throughout the world.
void DestroyAllWorldTriggers()
Destroys all triggers currently in the manager.
void RemoveAllManagers()
This removes all managers from the manager list.
void DestroyAllProxies()
Deletes all stored CollidableProxy instances.
std::list< NameValuePair > NameValuePairList
This is a datatype mostly used for describing settings or parameters that can't be declared in advanc...
void DestroyManager(WorldManager *ToBeDestroyed)
Destroys a manager.
This is the base class for all managers that belong to a single world instance.
This is simply a place for storing all the Physics Related functions.
A factory responsible for the creation and destruction of the default actormanager.
virtual String GetManagerImplName() const =0
Gets the name of the manager that is created by this factory.
World(const String &WorldName)
Class constructor.
virtual String GetDerivedSerializableName() const
Gets the most derived serializable name of this World.
A factory responsible for the creation and destruction of the default scenemanager.
virtual void ProtoSerialize(XML::Node &ParentNode) const
Convert this class to an XML::Node ready for serialization.
static String GetSerializableName()
Get the name of the the XML tag the World class will leave behind as its instances are serialized...
std::vector< WorldManager * > WorldManagerContainer
Basic container type for WorldManager storage by this class.
Whole PhysicsFlags
The flags to initialize the physics system with.
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.
const String & GetName() const
Gets the name of this world.
This is a base class for factories that construct managers used by the World class.
Vector3 GeographyUpperBounds
The upper limits of the worlds AABB.
Boole AddManager(WorldManager *ManagerToAdd)
This adds a manager, in the correct order, to the list that the world calls on.
std::string String
A datatype used to a series of characters.
This is the base manager class for audio being played in a 3D environment.
Boole VerifyManagerInitializations()
Checks if all managers currently stored in this World have been initialized.
void PreMainLoopInit()
Initialize any default managers and any added after construction. This should be called before the En...
This is a helper class storing information needed for the construction of a PhysicsManager.
A manager responsible for the storage and management of all actors that exist in a world...
void Clear()
Clears the world of all objects.