//----------------------------------------------------------------------- MatrixForceFieldCalculationFactory::~MatrixForceFieldCalculationFactory(void) { Ogre::WorkQueue* wq = Ogre::Root::getSingleton().getWorkQueue(); wq->removeRequestHandler(mWorkQueueChannel, this); wq->removeResponseHandler(mWorkQueueChannel, this); deleteMatrix(); }
World::~World() { Ogre::WorkQueue* wq = Ogre::Root::getSingleton().getWorkQueue(); wq->removeRequestHandler(mWorkQueueChannel, this); wq->removeResponseHandler(mWorkQueueChannel, this); delete mRootNode; delete mStorage; }
//----------------------------------------------------------------------- MatrixForceFieldCalculationFactory::MatrixForceFieldCalculationFactory(void) : ForceFieldCalculationFactory(), mMatrixPositions(0), mForceFieldSize(0), mX(0), mY(0), mZ(0), mInitialising(false) { Ogre::WorkQueue* wq = Ogre::Root::getSingleton().getWorkQueue(); mWorkQueueChannel = wq->getChannel("ParticleUniverse/MatrixForceFieldCalculationFactory"); wq->addRequestHandler(mWorkQueueChannel, this); wq->addResponseHandler(mWorkQueueChannel, this); }
World::World(Ogre::SceneManager* sceneMgr, Storage* storage, int visibilityFlags, bool distantLand, bool shaders, Alignment align, float minBatchSize, float maxBatchSize) : mStorage(storage) , mMinBatchSize(minBatchSize) , mMaxBatchSize(maxBatchSize) , mSceneMgr(sceneMgr) , mVisibilityFlags(visibilityFlags) , mDistantLand(distantLand) , mShaders(shaders) , mVisible(true) , mAlign(align) , mMaxX(0) , mMinX(0) , mMaxY(0) , mMinY(0) , mChunksLoading(0) , mWorkQueueChannel(0) , mCache(storage->getCellVertices()) , mLayerLoadPending(true) { #if TERRAIN_USE_SHADER == 0 if (mShaders) std::cerr << "Compiled Terrain without shader support, disabling..." << std::endl; mShaders = false; #endif mCompositeMapSceneMgr = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC); /// \todo make composite map size configurable Ogre::Camera* compositeMapCam = mCompositeMapSceneMgr->createCamera("a"); mCompositeMapRenderTexture = Ogre::TextureManager::getSingleton().createManual( "terrain/comp/rt", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D, 128, 128, 0, Ogre::PF_A8B8G8R8, Ogre::TU_RENDERTARGET); mCompositeMapRenderTarget = mCompositeMapRenderTexture->getBuffer()->getRenderTarget(); mCompositeMapRenderTarget->setAutoUpdated(false); mCompositeMapRenderTarget->addViewport(compositeMapCam); storage->getBounds(mMinX, mMaxX, mMinY, mMaxY); int origSizeX = mMaxX-mMinX; int origSizeY = mMaxY-mMinY; // Dividing a quad tree only works well for powers of two, so round up to the nearest one int size = nextPowerOfTwo(std::max(origSizeX, origSizeY)); // Adjust the center according to the new size float centerX = (mMinX+mMaxX)/2.f + (size-origSizeX)/2.f; float centerY = (mMinY+mMaxY)/2.f + (size-origSizeY)/2.f; mRootSceneNode = mSceneMgr->getRootSceneNode()->createChildSceneNode(); // While building the quadtree, remember leaf nodes since we need to load their layers LayersRequestData data; data.mPack = getShadersEnabled(); mRootNode = new QuadTreeNode(this, Root, size, Ogre::Vector2(centerX, centerY), NULL); buildQuadTree(mRootNode, data.mNodes); //loadingListener->indicateProgress(); mRootNode->initAabb(); //loadingListener->indicateProgress(); mRootNode->initNeighbours(); //loadingListener->indicateProgress(); Ogre::WorkQueue* wq = Ogre::Root::getSingleton().getWorkQueue(); mWorkQueueChannel = wq->getChannel("LargeTerrain"); wq->addRequestHandler(mWorkQueueChannel, this); wq->addResponseHandler(mWorkQueueChannel, this); // Start loading layers in the background (for leaf nodes) wq->addRequest(mWorkQueueChannel, REQ_ID_LAYERS, Ogre::Any(data)); }
void LodWorkQueueWorker::clearPendingLodRequests() { Ogre::WorkQueue* wq = Root::getSingleton().getWorkQueue(); wq->abortPendingRequestsByChannel(mChannelID); }