Manager::Manager( const char* name, int width, int height, Engine::WindowMode wm ): RTTI_CLASS_DEFINE( Manager ), m_engine( 0 ), m_game( 0 ), m_pushState( 0 ), m_progressState( 0 ), m_progressStateDefault( 0 ), m_popState( false ), m_changeState( false ), m_loading( false ), m_states( 0 ), m_scenes( 0 ), m_materials( 0 ), m_effects( 0 ), m_fonts( 0 ), m_textures( 0 ), m_canvases( 0 ), m_assets( 0 ), m_assetsLoading( 0 ), m_actors( 0 ), m_controls( 0 ), m_collisions( 0 ), m_audio( 0 ) { m_engine = xnew Engine(); m_engine->initiation( name, width, height, wm ); m_states = xnew Stack< IState >(); m_scenes = xnew SceneManager(); m_materials = xnew MaterialManager(); m_effects = xnew EffectManager(); m_fonts = xnew FontManager(); m_textures = xnew TextureManager(); m_canvases = xnew CanvasManager(); m_assets = xnew AssetManager(); m_assetsLoading = xnew AssetManager(); m_actors = xnew Stack< ActorManager >(); m_controls = xnew Stack< ControlManager >(); m_collisions = xnew Stack< CollisionManager >(); m_audio = xnew AudioManager(); Global::use().engine = m_engine; Global::use().scenes = m_scenes; Global::use().materials = m_materials; Global::use().effects = m_effects; Global::use().fonts = m_fonts; Global::use().textures = m_textures; Global::use().canvases = m_canvases; Global::use().assets = m_assets; Global::use().assetsLoading = m_assetsLoading; Global::use().actors = 0; Global::use().controls = 0; Global::use().collisions = 0; Global::use().audio = m_audio; }
void MeshWithoutIndexDataTests::setUp() { LogManager::getSingleton().createLog("MeshWithoutIndexDataTests.log", true); OGRE_NEW ResourceGroupManager(); OGRE_NEW LodStrategyManager(); mBufMgr = OGRE_NEW DefaultHardwareBufferManager(); mMeshMgr = OGRE_NEW MeshManager(); archiveMgr = OGRE_NEW ArchiveManager(); archiveMgr->addArchiveFactory(OGRE_NEW FileSystemArchiveFactory()); MaterialManager* matMgr = OGRE_NEW MaterialManager(); matMgr->initialise(); }
void MeshSerializerTests::setUp() { errorFactor = 0.05; OGRE_DELETE LogManager::getSingletonPtr(); mLogManager = OGRE_NEW LogManager(); mLogManager->createLog("MeshWithoutIndexDataTests.log", false); mLogManager->setLogDetail(LL_LOW); mFSLayer = OGRE_NEW_T(Ogre::FileSystemLayer, Ogre::MEMCATEGORY_GENERAL)(OGRE_VERSION_NAME); OGRE_NEW ResourceGroupManager(); OGRE_NEW LodStrategyManager(); OGRE_NEW DefaultHardwareBufferManager(); OGRE_NEW MeshManager(); OGRE_NEW SkeletonManager(); ArchiveManager* archiveMgr = OGRE_NEW ArchiveManager(); archiveMgr->addArchiveFactory(OGRE_NEW FileSystemArchiveFactory()); MaterialManager* matMgr = OGRE_NEW MaterialManager(); matMgr->initialise(); // Load resource paths from config file ConfigFile cf; String resourcesPath; #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE || OGRE_PLATFORM == OGRE_PLATFORM_WIN32 resourcesPath = mFSLayer->getConfigFilePath("resources.cfg"); #else resourcesPath = mFSLayer->getConfigFilePath("bin/resources.cfg"); #endif // Go through all sections & settings in the file cf.load(resourcesPath); ConfigFile::SectionIterator seci = cf.getSectionIterator(); String secName, typeName, archName; while (seci.hasMoreElements()) { secName = seci.peekNextKey(); ConfigFile::SettingsMultiMap* settings = seci.getNext(); ConfigFile::SettingsMultiMap::iterator i; for (i = settings->begin(); i != settings->end(); ++i) { typeName = i->first; archName = i->second; if (typeName == "FileSystem") { ResourceGroupManager::getSingleton().addResourceLocation( archName, typeName, secName); } } } mMesh = MeshManager::getSingleton().load("knot.mesh", ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME); getResourceFullPath(mMesh, mMeshFullPath); if (!copyFile(mMeshFullPath + ".bak", mMeshFullPath)) { // If there is no backup, create one. copyFile(mMeshFullPath, mMeshFullPath + ".bak"); } mSkeletonFullPath = ""; mSkeleton = SkeletonManager::getSingleton().load("jaiqua.skeleton", "Popular").staticCast<Skeleton>(); getResourceFullPath(mSkeleton, mSkeletonFullPath); if (!copyFile(mSkeletonFullPath + ".bak", mSkeletonFullPath)) { // If there is no backup, create one. copyFile(mSkeletonFullPath, mSkeletonFullPath + ".bak"); } mMesh->reload(); #ifdef OGRE_BUILD_COMPONENT_MESHLODGENERATOR { MeshLodGenerator().generateAutoconfiguredLodLevels(mMesh); } #endif /* ifdef OGRE_BUILD_COMPONENT_MESHLODGENERATOR */ mOrigMesh = mMesh->clone(mMesh->getName() + ".orig.mesh", mMesh->getGroup()); }
//----------------------------------------------------------------------- Root::Root(const String& pluginFileName, const String& configFileName, const String& logFileName) : mLogManager(0) , mRenderSystemCapabilitiesManager(0) , mNextFrame(0) , mFrameSmoothingTime(0.0f) , mNextMovableObjectTypeFlag(1) , mIsInitialised(false) { // superclass will do singleton checking String msg; // Init mActiveRenderer = 0; mVersion = StringConverter::toString(OGRE_VERSION_MAJOR) + "." + StringConverter::toString(OGRE_VERSION_MINOR) + "." + StringConverter::toString(OGRE_VERSION_PATCH) + OGRE_VERSION_SUFFIX + " " + "(" + OGRE_VERSION_NAME + ")"; mConfigFileName = configFileName; // Create log manager and default log file if there is no log manager yet if(LogManager::getSingletonPtr() == 0) { mLogManager = OGRE_NEW LogManager(); mLogManager->createLog(logFileName, true, true); } // Dynamic library manager mDynLibManager = OGRE_NEW DynLibManager(); mArchiveManager = OGRE_NEW ArchiveManager(); // ResourceGroupManager mResourceGroupManager = OGRE_NEW ResourceGroupManager(); // ResourceBackgroundQueue mResourceBackgroundQueue = OGRE_NEW ResourceBackgroundQueue(); // Create SceneManager enumerator (note - will be managed by singleton) mSceneManagerEnum = OGRE_NEW SceneManagerEnumerator(); mCurrentSceneManager = NULL; mShadowTextureManager = OGRE_NEW ShadowTextureManager(); mRenderSystemCapabilitiesManager = OGRE_NEW RenderSystemCapabilitiesManager(); // ..material manager mMaterialManager = OGRE_NEW MaterialManager(); // Mesh manager mMeshManager = OGRE_NEW MeshManager(); // Skeleton manager mSkeletonManager = OGRE_NEW SkeletonManager(); // ..particle system manager mParticleManager = OGRE_NEW ParticleSystemManager(); // Compiler manager //mCompilerManager = OGRE_NEW ScriptCompilerManager(); mTimer = OGRE_NEW Timer(); // Overlay manager mOverlayManager = OGRE_NEW OverlayManager(); mPanelFactory = OGRE_NEW PanelOverlayElementFactory(); mOverlayManager->addOverlayElementFactory(mPanelFactory); mBorderPanelFactory = OGRE_NEW BorderPanelOverlayElementFactory(); mOverlayManager->addOverlayElementFactory(mBorderPanelFactory); mTextAreaFactory = OGRE_NEW TextAreaOverlayElementFactory(); mOverlayManager->addOverlayElementFactory(mTextAreaFactory); // Font manager mFontManager = OGRE_NEW FontManager(); #if OGRE_PROFILING // Profiler mProfiler = OGRE_NEW Profiler(); Profiler::getSingleton().setTimer(mTimer); #endif mFileSystemArchiveFactory = OGRE_NEW FileSystemArchiveFactory(); ArchiveManager::getSingleton().addArchiveFactory( mFileSystemArchiveFactory ); mZipArchiveFactory = OGRE_NEW ZipArchiveFactory(); ArchiveManager::getSingleton().addArchiveFactory( mZipArchiveFactory ); #if OGRE_NO_FREEIMAGE == 0 // Register image codecs FreeImageCodec::startup(); #endif #if OGRE_NO_DEVIL == 0 // Register image codecs ILCodecs::registerCodecs(); #endif #if OGRE_NO_DDS_CODEC == 0 // Register image codecs DDSCodec::startup(); #endif mHighLevelGpuProgramManager = OGRE_NEW HighLevelGpuProgramManager(); mExternalTextureSourceManager = OGRE_NEW ExternalTextureSourceManager(); mCompositorManager = OGRE_NEW CompositorManager(); mCompilerManager = OGRE_NEW ScriptCompilerManager(); // Auto window mAutoWindow = 0; // instantiate and register base movable factories mEntityFactory = OGRE_NEW EntityFactory(); addMovableObjectFactory(mEntityFactory); mLightFactory = OGRE_NEW LightFactory(); addMovableObjectFactory(mLightFactory); mBillboardSetFactory = OGRE_NEW BillboardSetFactory(); addMovableObjectFactory(mBillboardSetFactory); mManualObjectFactory = OGRE_NEW ManualObjectFactory(); addMovableObjectFactory(mManualObjectFactory); mBillboardChainFactory = OGRE_NEW BillboardChainFactory(); addMovableObjectFactory(mBillboardChainFactory); mRibbonTrailFactory = OGRE_NEW RibbonTrailFactory(); addMovableObjectFactory(mRibbonTrailFactory); // Load plugins if (!pluginFileName.empty()) loadPlugins(pluginFileName); LogManager::getSingleton().logMessage("*-*-* OGRE Initialising"); msg = "*-*-* Version " + mVersion; LogManager::getSingleton().logMessage(msg); // Can't create managers until initialised mControllerManager = 0; mFirstTimePostWindowInit = false; }