void Application::updateOverlayInfo() { m_debug_1 = ""; m_debug_2 = ""; if (onSurface) { m_debug_1 = "On surface"; } else { m_debug_1 = "On air"; last_hit_position = NxOgre::Vec3(0,0,0); last_hit_normal = NxOgre::Vec3(0,0,0); last_hit_sliding = NxOgre::Vec3(0,0,0); angle_normal = 0; } m_debug_1 = m_debug_1 + " :: " + "P[" " " + Ogre::StringConverter::toString(last_hit_position.x) + " " + Ogre::StringConverter::toString(last_hit_position.y) + " " + Ogre::StringConverter::toString(last_hit_position.z) + " " + "]" + " :: " + "N[" + " " + Ogre::StringConverter::toString(last_hit_normal.x) + " " + Ogre::StringConverter::toString(last_hit_normal.y) + " " + Ogre::StringConverter::toString(last_hit_normal.z) + " " + "]" + " :: " + "S[" + " " + Ogre::StringConverter::toString(last_hit_sliding.x) + " " + Ogre::StringConverter::toString(last_hit_sliding.y) + " " + Ogre::StringConverter::toString(last_hit_sliding.z) + " " + "]" + " :: " + "A[" + " " + Ogre::StringConverter::toString(Ogre::Real(angle_normal)) + " " + "]"; if (m_showInfo) { Ogre::OverlayElement* overlay = Ogre::OverlayManager::getSingleton().getOverlayElement("InfoPanelFps"); overlay->setCaption("Current FPS: "+Ogre::StringConverter::toString(m_window->getLastFPS())); overlay = Ogre::OverlayManager::getSingleton().getOverlayElement("InfoPanelNTriangles"); overlay->setCaption("Triangle count: "+Ogre::StringConverter::toString(m_window->getTriangleCount())); } else { Ogre::OverlayElement* overlay = Ogre::OverlayManager::getSingleton().getOverlayElement("InfoPanelFps"); overlay->setCaption(m_debug_2); overlay = Ogre::OverlayManager::getSingleton().getOverlayElement("InfoPanelNTriangles"); overlay->setCaption(""); } if (m_showDebug) { Ogre::OverlayElement* overlay = Ogre::OverlayManager::getSingleton().getOverlayElement("InfoPanelDebug"); overlay->setCaption(m_debug_1); } else { Ogre::OverlayElement* overlay_2 = Ogre::OverlayManager::getSingleton().getOverlayElement("InfoPanelDebug"); } }
void Menu::showDialogue(const std::string& first, const std::vector<std::string>& options) { Ogre::OverlayManager& om = Ogre::OverlayManager::getSingleton(); std::cout << "getByName(overlay)\n"; Ogre::Overlay* dialOverlay = om.getByName(cDialogueOverlay); if (dialOverlay == NULL) { std::cout << "create(overlay)\n"; dialOverlay = om.create(cDialogueOverlay); } Ogre::OverlayContainer* dialCont = NULL; std::cout << "getOE(Box)\n"; dialCont = static_cast<Ogre::OverlayContainer*> (om.getOverlayElement(cDialogueOverlay+"/Box")); if (dialCont == NULL) { std::cout << "createOE(Box)\n"; dialCont = static_cast<Ogre::OverlayContainer*> (om.createOverlayElement("Panel", cDialogueOverlay+"/Box")); dialCont->setPosition(0.0, 0.75); dialCont->setDimensions(1.0, 0.25); dialCont->setMaterialName("Dusk/Dialogue/Black"); } std::cout << "getOE(Box/First)\n"; Ogre::OverlayElement* dialElem; dialElem = om.getOverlayElement(cDialogueOverlay+"/Box/First"); if (dialElem==NULL) { std::cout << "createOE(Box/First)\n"; dialElem = om.createOverlayElement("TextArea", cDialogueOverlay+"/Box/First"); dialElem->setDimensions(1.0, 0.0625); dialElem->setPosition(0.0, 0.0); dialElem->setMaterialName("Dusk/Dialogue/Element"); dialCont->addChild(dialElem); } dialElem->setCaption(first); dialElem->show(); unsigned int elemCount = options.size(); if (elemCount > cMaxDialogueOptions) { elemCount = cMaxDialogueOptions; } killDialogueOverlayLines(); unsigned int i; const float elemHeight = 0.8/(float)elemCount; for (i=0; i<elemCount; i=i+1) { //dialElem = om.createOverlayElement("TextArea", cDialogueOverlay+"/Box/Line"+IntToString(i)); dialElem = om.createOverlayElementFromTemplate(cDialogueOverlay+"/LineTemplate", "TextArea", cDialogueOverlay+"/Box/Line"+IntToString(i)); dialElem->setPosition(0.1, dialCont->getHeight()*(0.2+i*elemHeight)); dialElem->setDimensions(0.8, elemHeight*dialCont->getHeight()); dialElem->setCaption(IntToString(i+1)+": "+options[i]); dialElem->show(); dialCont->addChild(dialElem); m_DialogueLineCount = i+1; }//for dialOverlay->show(); }
void Application::updateOverlayInfo() { if (m_showInfo) { Ogre::OverlayElement* overlay = Ogre::OverlayManager::getSingleton().getOverlayElement("InfoPanelFps"); overlay->setCaption("Current FPS: "+Ogre::StringConverter::toString(m_window->getLastFPS())); overlay = Ogre::OverlayManager::getSingleton().getOverlayElement("InfoPanelNTriangles"); overlay->setCaption("Triangle count: "+Ogre::StringConverter::toString(m_window->getTriangleCount())); } else { Ogre::OverlayElement* overlay = Ogre::OverlayManager::getSingleton().getOverlayElement("InfoPanelFps"); overlay->setCaption("Press I to view Statistics"); overlay = Ogre::OverlayManager::getSingleton().getOverlayElement("InfoPanelNTriangles"); overlay->setCaption(""); } }
void PendulumTest::updateOverlayData(unsigned int trialNum) { Ogre::OverlayElement* trialElement = Ogre::OverlayManager::getSingleton().getOverlayElement( "Verve/TrialNumber/Trial"); trialElement->setCaption("Trial " + Ogre::StringConverter::toString(trialNum)); }
bool COgreDebugOverlay::frameEnded( const Ogre::FrameEvent& evt ) {GUCE_TRACE; if ( NULL != m_debugOverlay ) { static Ogre::String currFps = "Current FPS: "; static Ogre::String avgFps = "Average FPS: "; static Ogre::String bestFps = "Best FPS: "; static Ogre::String worstFps = "Worst FPS: "; static Ogre::String tris = "Triangle Count: "; // update stats when necessary try { Ogre::OverlayElement* guiAvg = m_overlayManager->getOverlayElement( "Core/AverageFps" ); Ogre::OverlayElement* guiCurr = m_overlayManager->getOverlayElement( "Core/CurrFps" ); Ogre::OverlayElement* guiBest = m_overlayManager->getOverlayElement( "Core/BestFps" ); Ogre::OverlayElement* guiWorst = m_overlayManager->getOverlayElement( "Core/WorstFps" ); const Ogre::RenderTarget::FrameStats& stats = m_window->GetOgreWindowPtr()->getStatistics(); guiAvg->setCaption( avgFps + Ogre::StringConverter::toString( stats.avgFPS ) ); guiCurr->setCaption( currFps + Ogre::StringConverter::toString( stats.lastFPS ) ); guiBest->setCaption( bestFps + Ogre::StringConverter::toString( stats.bestFPS ) +" "+Ogre::StringConverter::toString(stats.bestFrameTime)+" ms"); guiWorst->setCaption(worstFps + Ogre::StringConverter::toString(stats.worstFPS ) +" "+Ogre::StringConverter::toString(stats.worstFrameTime)+" ms"); Ogre::OverlayElement* guiTris = m_overlayManager->getOverlayElement( "Core/NumTris" ); guiTris->setCaption( tris + Ogre::StringConverter::toString( stats.triangleCount ) ); //Ogre::OverlayElement* guiDbg = m_overlayManager->getOverlayElement( "Core/DebugText" ); //guiDbg->setCaption( m_window->GetOgreWindowPtr()->getDebugText() ); } catch( Ogre::Exception& ) { // ignore } } return true; }
bool wxOgre::frameEnded(const Ogre::FrameEvent& evt) { static const wxString camPosCaption(wxT("CamPos:X:%06.3f, Y:%06.3f, Z:%06.3f")); Ogre::OverlayElement* guiCurr = Ogre::OverlayManager::getSingleton().getOverlayElement("TextAreaOverlayElement"); Ogre::Vector3 camPos(mCamera->getRealPosition()); wxString camText(wxString::Format(camPosCaption, camPos.x, camPos.y, camPos.z)); guiCurr->setCaption(Ogre::String(camText.mb_str(wxConvUTF8))); return true; }
void Application::updateStats() { static Ogre::String currFps = "Current FPS: "; static Ogre::String avgFps = "Average FPS: "; static Ogre::String bestFps = "Best FPS: "; static Ogre::String worstFps = "Worst FPS: "; static Ogre::String tris = "Triangle Count: "; static Ogre::String batches = "Batch Count: "; // update stats when necessary try { Ogre::OverlayElement* guiAvg = Ogre::OverlayManager::getSingleton().getOverlayElement("Core/AverageFps"); Ogre::OverlayElement* guiCurr = Ogre::OverlayManager::getSingleton().getOverlayElement("Core/CurrFps"); Ogre::OverlayElement* guiBest = Ogre::OverlayManager::getSingleton().getOverlayElement("Core/BestFps"); Ogre::OverlayElement* guiWorst = Ogre::OverlayManager::getSingleton().getOverlayElement("Core/WorstFps"); const Ogre::RenderTarget::FrameStats& stats = m_window->getStatistics(); guiAvg->setCaption(avgFps + Ogre::StringConverter::toString(stats.avgFPS)); guiCurr->setCaption(currFps + Ogre::StringConverter::toString(stats.lastFPS)); guiBest->setCaption(bestFps + Ogre::StringConverter::toString(stats.bestFPS) +" "+Ogre::StringConverter::toString(stats.bestFrameTime)+" ms"); guiWorst->setCaption(worstFps + Ogre::StringConverter::toString(stats.worstFPS) +" "+Ogre::StringConverter::toString(stats.worstFrameTime)+" ms"); Ogre::OverlayElement* guiTris = Ogre::OverlayManager::getSingleton().getOverlayElement("Core/NumTris"); guiTris->setCaption(tris + Ogre::StringConverter::toString(stats.triangleCount)); Ogre::OverlayElement* guiBatches = Ogre::OverlayManager::getSingleton().getOverlayElement("Core/NumBatches"); guiBatches->setCaption(batches + Ogre::StringConverter::toString(stats.batchCount)); ///////////////////////// Ogre::Vector3 camPos = m_camera->getPosition(); Ogre::Quaternion camOri = m_camera->getOrientation(); Ogre::Vector3 freddyPos = m_sceneNode->getPosition(); Ogre::Quaternion freddyOri = m_sceneNode->getOrientation(); Ogre::OverlayElement* guiDbg = Ogre::OverlayManager::getSingleton().getOverlayElement("Core/DebugText"); guiDbg->setTop(0); Ogre::String message = "Camera Position: x: "+Ogre::StringConverter::toString(camPos.x)+", y: "+Ogre::StringConverter::toString(camPos.y)+", z:"+Ogre::StringConverter::toString(camPos.z) + "\n" + "Camera orientation: yaw: "+Ogre::StringConverter::toString(camOri.getYaw())+", pitch: "+Ogre::StringConverter::toString(camOri.getPitch())+", roll:"+Ogre::StringConverter::toString(camOri.getRoll()) + "\n" + "Freddy position: x: "+Ogre::StringConverter::toString(freddyPos.x)+", y: "+Ogre::StringConverter::toString(freddyPos.y)+", z:"+Ogre::StringConverter::toString(freddyPos.z) + "\n" + "Freddy orientation: yaw: "+Ogre::StringConverter::toString(freddyOri.getYaw())+", pitch: "+Ogre::StringConverter::toString(freddyOri.getPitch())+", roll:"+Ogre::StringConverter::toString(freddyOri.getRoll()); guiDbg->setCaption(message); debugWindow->setText("This is a demo!"); } catch(...) { /* ignore */ } }
void TextRenderer::SetText(const std::string &id, const char *fmt, /* args */ ...) { char text[256] = {'\0'}; va_list ap; if (fmt) { va_start(ap, fmt); vsprintf(text, fmt, ap); va_end(ap); } Ogre::OverlayElement *textBox = m_overlayMgr->getOverlayElement(id); textBox->setCaption(text); }
void FrameStatsListener::updateStats(void) { static Ogre::String currFps = "Current FPS: "; static Ogre::String avgFps = "Average FPS: "; static Ogre::String bestFps = "Best FPS: "; static Ogre::String worstFps = "Worst FPS: "; static Ogre::String tris = "Triangle Count: "; // update stats when necessary try { Ogre::OverlayElement* guiAvg = Ogre::OverlayManager::getSingleton().getOverlayElement("Core/AverageFps"); Ogre::OverlayElement* guiCurr = Ogre::OverlayManager::getSingleton().getOverlayElement("Core/CurrFps"); Ogre::OverlayElement* guiBest = Ogre::OverlayManager::getSingleton().getOverlayElement("Core/BestFps"); Ogre::OverlayElement* guiWorst = Ogre::OverlayManager::getSingleton().getOverlayElement("Core/WorstFps"); const Ogre::RenderTarget::FrameStats& stats = mRenderTarget->getStatistics(); guiAvg->setCaption(avgFps + Ogre::StringConverter::toString(stats.avgFPS)); guiCurr->setCaption(currFps + Ogre::StringConverter::toString(stats.lastFPS)); guiBest->setCaption(bestFps + Ogre::StringConverter::toString(stats.bestFPS) + " " + Ogre::StringConverter::toString(stats.bestFrameTime) + " ms"); guiWorst->setCaption(worstFps + Ogre::StringConverter::toString(stats.worstFPS) + " " + Ogre::StringConverter::toString(stats.worstFrameTime) + " ms"); Ogre::OverlayElement* guiTris = Ogre::OverlayManager::getSingleton().getOverlayElement("Core/NumTris"); guiTris->setCaption(tris + Ogre::StringConverter::toString(stats.triangleCount)); Ogre::OverlayElement* guiDbg = Ogre::OverlayManager::getSingleton().getOverlayElement("Core/DebugText"); //guiDbg->setCaption(mRenderTarget->getDebugText()); } catch (...) { // ignore } }
void RenderPump::renderOneFrame() { if(!initialized) { initialized = TRUE; roaming.initialize(); } static unsigned long LastTime = root->getTimer()->getMilliseconds(); unsigned long NowTime = root->getTimer()->getMilliseconds(); float Elapsed = (NowTime-LastTime)*0.001f; LastTime = NowTime; roaming.process(Elapsed); root->renderOneFrame(); CMaterialPreviewPage::Current->update(Elapsed); ParticlePreviewPage::current->update(Elapsed); ResourcePreview::Current->update(Elapsed); if(SceneDoc::current != NULL) { if(debugOverlay && debugOverlay->isVisible()) { static std::string currFps = "Current FPS: "; static std::string avgFps = "Average FPS: "; static std::string bestFps = "Best FPS: "; static std::string worstFps = "Worst FPS: "; static std::string tris = "Triangle Count: "; static std::string batches = "Batch Count: "; Ogre::OverlayElement *guiAvg = Ogre::OverlayManager::getSingletonPtr()->getOverlayElement("Core/AverageFps"); Ogre::OverlayElement *guiCurr = Ogre::OverlayManager::getSingletonPtr()->getOverlayElement("Core/CurrFps"); Ogre::OverlayElement *guiBest = Ogre::OverlayManager::getSingletonPtr()->getOverlayElement("Core/BestFps"); Ogre::OverlayElement *guiWorst = Ogre::OverlayManager::getSingletonPtr()->getOverlayElement("Core/WorstFps"); const Ogre::RenderTarget::FrameStats& stats = SceneDoc::current->getActiveView()->getRenderWindow()->getStatistics(); guiAvg->setCaption(avgFps + Ogre::StringConverter::toString(stats.avgFPS)); guiCurr->setCaption(currFps + Ogre::StringConverter::toString(stats.lastFPS)); guiBest->setCaption(bestFps + Ogre::StringConverter::toString(stats.bestFPS) +" "+Ogre::StringConverter::toString(stats.bestFrameTime)+" ms"); guiWorst->setCaption(worstFps + Ogre::StringConverter::toString(stats.worstFPS) +" "+Ogre::StringConverter::toString(stats.worstFrameTime)+" ms"); Ogre::OverlayElement* guiTris = Ogre::OverlayManager::getSingletonPtr()->getOverlayElement("Core/NumTris"); guiTris->setCaption(tris + Ogre::StringConverter::toString(stats.triangleCount)); Ogre::OverlayElement* guiBatches = Ogre::OverlayManager::getSingletonPtr()->getOverlayElement("Core/NumBatches"); guiBatches->setCaption(batches + Ogre::StringConverter::toString(stats.batchCount)); } SceneDoc::current->update(Elapsed); } if(GameDoc::current != NULL) GameDoc::current->update(Elapsed); }
void TextRenderer::AddTextBox(const std::string &id, const std::string &text, Ogre::Real x, Ogre::Real y, Ogre::Real width, Ogre::Real height, const Ogre::ColourValue &color) { Ogre::OverlayElement *textBox = m_overlayMgr->createOverlayElement("TextArea", id); textBox->setDimensions(width, height); textBox->setMetricsMode(Ogre::GMM_PIXELS); textBox->setPosition(x, y); textBox->setWidth(width); textBox->setHeight(height); textBox->setParameter("font_name", "DebugFont"); textBox->setParameter("char_height", "16"); textBox->setColour(color); textBox->setCaption(text); m_panel->addChild(textBox); }
void FrameListener::setGuiCaption(std::string elementName, std::string text) { Ogre::OverlayElement *element = Ogre::OverlayManager::getSingleton().getOverlayElement(elementName, false); element->setCaption(text); }
void TextRenderer::SetText(const std::string &id, const std::string &text) { Ogre::OverlayElement* textBox = m_overlayMgr->getOverlayElement(id); textBox->setCaption(text); }
bool MyFrameListener::frameStarted(const Ogre::FrameEvent& evt) { Ogre::Vector3 vt(0,0,0); Ogre::Real tSpeed = 20.0; Ogre::Real r = 0; Ogre::Real deltaT = evt.timeSinceLastFrame; int fps = 1.0 / deltaT; _keyboard->capture(); if(_keyboard->isKeyDown(OIS::KC_ESCAPE)) return false; if(_keyboard->isKeyDown(OIS::KC_UP)) vt+=Ogre::Vector3(0,0,-1); if(_keyboard->isKeyDown(OIS::KC_DOWN)) vt+=Ogre::Vector3(0,0,1); if(_keyboard->isKeyDown(OIS::KC_LEFT)) vt+=Ogre::Vector3(-1,0,0); if(_keyboard->isKeyDown(OIS::KC_RIGHT)) vt+=Ogre::Vector3(1,0,0); if(_keyboard->isKeyDown(OIS::KC_W)) vt+=Ogre::Vector3(0,0,-1); if(_keyboard->isKeyDown(OIS::KC_S)) vt+=Ogre::Vector3(0,0,1); if(_keyboard->isKeyDown(OIS::KC_A)) vt+=Ogre::Vector3(-1,0,0); if(_keyboard->isKeyDown(OIS::KC_D)) vt+=Ogre::Vector3(1,0,0); if(_keyboard->isKeyDown(OIS::KC_1)) { _sceneManager->setShadowTechnique(Ogre::SHADOWTYPE_TEXTURE_MODULATIVE); _shadowInfo = "TEXTURE_MODULATIVE"; _pMyApp->getSoundFXPtr()->play(); } if(_keyboard->isKeyDown(OIS::KC_2)) { _sceneManager->setShadowTechnique(Ogre::SHADOWTYPE_STENCIL_MODULATIVE); _shadowInfo = "STENCIL_MODULATIVE"; _pMyApp->getSoundFXPtr()->play(); } Ogre::Entity *ent = static_cast <Ogre::Entity *> (_node->getAttachedObject("Neptuno")); if(_keyboard->isKeyDown(OIS::KC_7)) { ent->setMaterialName("Material"); _materialInfo = "MaterialBase"; } if(_keyboard->isKeyDown(OIS::KC_8)) { ent->setMaterialName("MaterialAO"); _materialInfo = "MaterialAO"; } if(_keyboard->isKeyDown(OIS::KC_9)) { ent->setMaterialName("MaterialTex"); _materialInfo = "MaterialTex"; } if(_keyboard->isKeyDown(OIS::KC_0)) { ent->setMaterialName("MaterialAOTex"); _materialInfo = "MaterialAOTex"; } _camera->moveRelative(vt * deltaT * tSpeed); if (_camera->getPosition().length() < 10.0) { _camera->moveRelative(-vt * deltaT * tSpeed); } if(_keyboard->isKeyDown(OIS::KC_E)) r+=180; if(_keyboard->isKeyDown(OIS::KC_Q)) r-=180; _node->yaw(Ogre::Degree(r * deltaT)); _mouse->capture(); float rotx = _mouse->getMouseState().X.rel * deltaT * -1; float roty = _mouse->getMouseState().Y.rel * deltaT * -1; _camera->yaw(Ogre::Radian(rotx)); _camera->pitch(Ogre::Radian(roty)); Ogre::OverlayElement *oe; oe = _overlayManager->getOverlayElement("fpsInfo"); oe->setCaption(Ogre::StringConverter::toString(fps)); oe = _overlayManager->getOverlayElement("shadowInfo"); oe->setCaption(_shadowInfo); oe = _overlayManager->getOverlayElement("materialInfo"); oe->setCaption(_materialInfo); return true; }
void updateOverlay() { const verve::Agent* a = gRobot->getAgent(); Ogre::OverlayElement* overlayElement = Ogre::OverlayManager::getSingleton().getOverlayElement( "Verve/Debug/PrimaryReward"); overlayElement->setCaption("Primary Reward: " + Ogre::StringConverter::toString(a->getDebugData().reward, 4)); overlayElement = Ogre::OverlayManager::getSingleton().getOverlayElement( "Verve/Debug/ValueEstimation"); overlayElement->setCaption("Value Estimation: " + Ogre::StringConverter::toString(a->getDebugData().valueEstimation, 4)); overlayElement = Ogre::OverlayManager::getSingleton().getOverlayElement( "Verve/Debug/TDError"); overlayElement->setCaption("TD Error: " + Ogre::StringConverter::toString(a->getDebugData().TDError, 4)); overlayElement = Ogre::OverlayManager::getSingleton().getOverlayElement( "Verve/Debug/CuriosityReward"); overlayElement->setCaption("Curiosity Reward: " + Ogre::StringConverter::toString(a->getDebugData().curiosityReward, 4)); overlayElement = Ogre::OverlayManager::getSingleton().getOverlayElement( "Verve/Debug/Uncertainty"); overlayElement->setCaption("Uncertainty Estimation: " + Ogre::StringConverter::toString( a->getDebugData().predictionUncertaintyEstimation, 4)); overlayElement = Ogre::OverlayManager::getSingleton().getOverlayElement( "Verve/Debug/ModelError"); overlayElement->setCaption("Model Error: " + Ogre::StringConverter::toString(a->getDebugData().modelPredictionError, 4)); overlayElement = Ogre::OverlayManager::getSingleton().getOverlayElement( "Verve/Debug/PlanLength"); overlayElement->setCaption("Plan Length: " + Ogre::StringConverter::toString(a->getDebugData().planLength)); overlayElement = Ogre::OverlayManager::getSingleton().getOverlayElement( "Verve/Debug/Age"); overlayElement->setCaption("Age: " + a->getAgeString()); overlayElement = Ogre::OverlayManager::getSingleton().getOverlayElement( "Verve/Debug/Action"); overlayElement->setCaption("Action: " + gRobot->getCurrentActionName()); for (unsigned int i = 0; i < a->getNumContinuousSensors(); ++i) { Ogre::String sensorNumStr = Ogre::StringConverter::toString(i); Ogre::String label = "Sensor " + sensorNumStr; Ogre::OverlayElement* sensorElement = Ogre::OverlayManager::getSingleton().getOverlayElement( "Verve/Debug/Sensor" + sensorNumStr); const verve::real* sensorData = gRobot->getContinuousInputs(); sensorElement->setCaption(label + ": " + Ogre::StringConverter::toString(sensorData[i], 4)); } }
void TextRenderer::setText(const std::string& ID, const std::string& Text) { Ogre::OverlayElement* textBox = _overlayMgr->getOverlayElement(ID); textBox->setCaption(Text); }