void StereoManager::updateAllDependentRenderTargets(bool isLeftEye) { Ogre::uint32 mask; if(isLeftEye) { mask = left_mask_; } else { mask = right_mask_; } RenderTargetList::iterator itarg, itargend; itargend = rendertarget_list_.end(); for( itarg = rendertarget_list_.begin(); itarg != itargend; ++itarg ) { Ogre::RenderTarget *rt = itarg->first; int n = rt->getNumViewports(); std::vector<int> maskVector(n); // VS2005 gives a warning if I declare the vector as uint32 but not with int for(int i = 0; i<n ; ++i) { maskVector[i] = rt->getViewport(i)->getVisibilityMask(); rt->getViewport(i)->setVisibilityMask(maskVector[i] & mask); } rt->update(); for(int i = 0; i<n ; ++i) { rt->getViewport(i)->setVisibilityMask(maskVector[i]); } } }
void Screen::toggleRenderMode() { if (mPolygonMode == Ogre::PM_SOLID) { mPolygonMode = Ogre::PM_WIREFRAME; } else { mPolygonMode = Ogre::PM_SOLID; } Ogre::RenderSystem::RenderTargetIterator renderTargetI = Ogre::Root::getSingleton().getRenderSystem()->getRenderTargetIterator(); for (Ogre::RenderSystem::RenderTargetIterator::iterator I = renderTargetI.begin(); I != renderTargetI.end(); ++I) { Ogre::RenderTarget* renderTarget = I->second; for (unsigned short i = 0; i < renderTarget->getNumViewports(); ++i) { Ogre::Camera* camera = renderTarget->getViewport(i)->getCamera(); if (camera) { camera->setPolygonMode(mPolygonMode); } } } }