void DeferredShadingSystem::logCurrentMode(void) { if (mActive==false) { Ogre::LogManager::getSingleton().logMessage("No Compositor Enabled!"); return; } Ogre::CompositorInstance* ci = mInstance[mCurrentMode]; assert(ci->getEnabled()==true); Ogre::LogManager::getSingleton().logMessage("Current Mode: "); Ogre::LogManager::getSingleton().logMessage(ci->getCompositor()->getName()); }
//--------------------------------------------------------------------- void CompositorDemo_FrameListener::updateDebugRTTWindow(void) { // Clear listbox mDebugRTTListbox->resetList(); // Clear imagesets mDebugRTTStaticImage->setProperty("Image", ""); for (ImageSetList::iterator isIt = mDebugRTTImageSets.begin(); isIt != mDebugRTTImageSets.end(); ++isIt) { CEGUI::ImagesetManager::getSingleton().destroyImageset(*isIt); } mDebugRTTImageSets.clear(); Ogre::set<Ogre::String>::type uniqueTextureNames; // Add an entry for each render texture for all active compositors Ogre::Viewport* vp = mMain->getRenderWindow()->getViewport(0); Ogre::CompositorChain* chain = Ogre::CompositorManager::getSingleton().getCompositorChain(vp); Ogre::CompositorChain::InstanceIterator it = chain->getCompositors(); while (it.hasMoreElements()) { Ogre::CompositorInstance* inst = it.getNext(); if (inst->getEnabled()) { Ogre::CompositionTechnique::TextureDefinitionIterator texIt = inst->getTechnique()->getTextureDefinitionIterator(); while (texIt.hasMoreElements()) { Ogre::CompositionTechnique::TextureDefinition* texDef = texIt.getNext(); // Get instance name of texture (NB only index 0 if MRTs for now) const Ogre::String& instName = inst->getTextureInstanceName(texDef->name, 0); // Create CEGUI texture from name of OGRE texture CEGUI::Texture* tex = mMain->getGuiRenderer()->createTexture(instName.c_str()); // Create imageset // Note that if we use shared textures in compositor, the same texture name // will occur more than once, so we have to cater for this if (uniqueTextureNames.find(instName) == uniqueTextureNames.end()) { CEGUI::Imageset* imgSet = CEGUI::ImagesetManager::getSingleton().createImageset( instName.c_str(), tex); mDebugRTTImageSets.push_back(imgSet); imgSet->defineImage((CEGUI::utf8*)"RttImage", CEGUI::Point(0.0f, 0.0f), CEGUI::Size(tex->getWidth(), tex->getHeight()), CEGUI::Point(0.0f,0.0f)); CEGUI::ListboxTextItem *item = new CEGUI::ListboxTextItem(texDef->name.c_str(), 0, imgSet); item->setSelectionBrushImage("TaharezLook", "ListboxSelectionBrush"); item->setSelectionColours(CEGUI::colour(0,0,1)); mDebugRTTListbox->addItem(item); uniqueTextureNames.insert(instName); } } } } }