/// <summary> /// Disposes of the GangstaExample instance. /// </summary> public override void Dispose() { if (mDriver != null) { if (mWorld != null) { mWorld.setDebugVisualMode((uint)DebugVisual.Mode.GDV_NONE); if (mCallBackOgre != null) { mCallBackOgre.endDrag(); } mDriver.destroyWorld(mWorld); } mWorld = null; mManager.unloadPhysicsDriver(mDriver); } mDriver = null; if (mCallBackOgre != null) { mCallBackOgre.Dispose(); } mCallBackOgre = null; if (mManager != null) { mManager.Dispose(); } mManager = null; //mRayHit = null; base.Dispose(); }
protected override bool Setup() { mRoot = new Root(); SetupResources("resources.cfg"); if (!mRoot.ShowConfigDialog()) { return(false); } mRenderWindow = mRoot.Initialise(true, "Ogre Render Window"); CreateSceneManager(); CreateCamera(); CreateViewPort(); TextureManager.Instance.SetDefaultNumMipmaps(5); LoadResources(); mDebugOverlay = OverlayManager.getSingleton().getByName("Core/DebugOverlay"); mAverageFPS = OverlayManager.getSingleton().getOverlayElement("Core/AverageFps"); mCurrentFPS = OverlayManager.getSingleton().getOverlayElement("Core/CurrFps"); mBestFPS = OverlayManager.getSingleton().getOverlayElement("Core/BestFps"); mWorstFPS = OverlayManager.getSingleton().getOverlayElement("Core/WorstFps"); mTriangleCount = OverlayManager.getSingleton().getOverlayElement("Core/NumTris"); DebugOverlayVisible = true; MaterialManager.Instance.SetDefaultTextureFiltering(mFilter); MaterialManager.Instance.SetDefaultAnisotropy(mAnisotropy); //init PhysicsSystem mManager = new Manager(); if (!LoadPhysicsDrivers()) //mDriver = mManager.loadDynamicModule( "ODE" ); { return(false); } mCallBackOgre = new CallbackInterface_Ogre(mSceneManager); mCallBackOgre.setupCallbackInterface(mDriver); if (!CreatePhysicsWorld()) { return(false); } LoadGangstaLogo(); //mRayHit = new RayHitExample( mSceneManager ); CreateScene(); CreatePhysicsScene(); CreateEventHandler(); return(true); }