Color EC_OgreEnvironment::GetAmbientLightColor() const { if (renderer_.expired()) return Color(0.0f, 0.0f, 0.0f, 0.0f); RendererPtr renderer = renderer_.lock(); Ogre::SceneManager *sceneManager = renderer->GetSceneManager(); return ToCoreColor(sceneManager->getAmbientLight()); }
virtual void preViewportUpdate(const Ogre::RenderTargetViewportEvent& evt) { Ogre::SceneManager* pSceneManager = CEngineInterface::GetMe()->GetFairySystem()->getSceneManager(); CFakeObjectEntityManager::FakeObject* pObj = CFakeObjectEntityManager::GetMe()->GetObjectAsViewPort(evt.source); if(!pObj) return; //---------------------------------------------------------- //设置VisibleFlag m_nRenderMask = pSceneManager->getVisibilityMask(); pSceneManager->setVisibilityMask(Fairy::OVF_GUI_ELEMENTS); CFakeObjectEntityManager::GetMe()->SetActiveObject(pObj); //pObj->pEntityNode->SetGfxPosition(fVector3(0, 0, 0)); //隐藏地图探灯 CUIMapLight::GetMe()->Show(false); //---------------------------------------------------------- //设置环境光 m_colAmbient = pSceneManager->getAmbientLight(); pSceneManager->setAmbientLight(Ogre::ColourValue(1.0f, 1.0f, 1.0f, 1.0f)); m_pLightModel->setPosition(pObj->pCamera->getPosition()); }