ShaderManager::GraphicsLevel ShaderManager::setGraphicsLevel(ShaderManager::GraphicsLevel newLevel) { if (newLevel > mBestGraphicsLevel) { S_LOG_FAILURE("Cannot set graphics level " << mGraphicSchemes[newLevel]); return mGraphicsLevel; } S_LOG_INFO("Using graphics level " << mGraphicSchemes[newLevel]); Ogre::MaterialManager::getSingleton().setActiveScheme(mGraphicSchemes[newLevel]); Ogre::RenderWindow* window = EmberOgre::getSingleton().getRenderWindow(); for (int i = 0; i < window->getNumViewports(); ++i) { window->getViewport(i)->setMaterialScheme(mGraphicSchemes[newLevel]); } switch (newLevel) { case LEVEL_EXPERIMENTAL: case LEVEL_HIGH: setPSSMShadows(); break; case LEVEL_MEDIUM: case LEVEL_LOW: case LEVEL_DEFAULT: setNoShadows(); break; } mGraphicsLevel = newLevel; EventLevelChanged.emit(); return mGraphicsLevel; }
void renderQueueStarted(Ogre::uint8 queueGroupId, const Ogre::String& invocation, bool& skipThisInvocation) { Gui* gui = Gui::getInstancePtr(); if (gui == nullptr) return; if (Ogre::RENDER_QUEUE_OVERLAY != queueGroupId) return; Ogre::Viewport* viewport = mSceneManager->getCurrentViewport(); if (nullptr == viewport || !viewport->getOverlaysEnabled()) return; if (mWindow->getNumViewports() <= mActiveViewport || viewport != mWindow->getViewport(mActiveViewport)) return; mCountBatch = 0; static Timer timer; static unsigned long last_time = timer.getMilliseconds(); unsigned long now_time = timer.getMilliseconds(); unsigned long time = now_time - last_time; onFrameEvent((float)((double)(time) / (double)1000)); last_time = now_time; //begin(); setManualRender(true); onRenderToTarget(this, mUpdate); //end(); // сбрасываем флаг mUpdate = false; }