本文整理汇总了C++中ogre::RenderWindow::update方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderWindow::update方法的具体用法?C++ RenderWindow::update怎么用?C++ RenderWindow::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::RenderWindow
的用法示例。
在下文中一共展示了RenderWindow::update方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void ClientApplication::run()
{
Ogre::Root* root = mGraphicsManager->getRoot();
Ogre::RenderWindow* window = mGraphicsManager->getWindow();
root->getRenderSystem()->_initRenderTargets();
root->clearEventTimes();
boost::timer timer;
while( !mShutdown )
{
if( mShutdownRequested )
{
mStateMachine->popTo( 0 );
mShutdown = true;
}
const Real elapsed = timer.elapsed();
timer.restart();
mEarlyUpdateSignal();
mEarlyFrameSignal( elapsed );
mUpdateSignal();
mFrameSignal( elapsed );
mLateUpdateSignal();
mLateFrameSignal( elapsed );
Ogre::WindowEventUtilities::messagePump();
// Render even when the window is inactive.
if( window->isActive() )
{
root->renderOneFrame();
}
else if( window->isVisible() )
{
root->renderOneFrame();
window->update();
#if DIVERSIA_PLATFORM == DIVERSIA_PLATFORM_WIN32
Sleep( ( 1.0 / 60.0 ) * 1000.0 );
#else
usleep( ( 1.0 / 60.0 ) * 1000000.0 );
#endif
}
else if( !window->isActive() && !window->isVisible() )
{
#if DIVERSIA_PLATFORM == DIVERSIA_PLATFORM_WIN32
Sleep( ( 1.0 / 60.0 ) * 1000.0 );
#else
usleep( ( 1.0 / 60.0 ) * 1000000.0 );
#endif
}
}
}
示例2: update
void OculusDisplay::update( float wall_dt, float ros_dt )
{
if ( !oculus_ )
{
return;
}
updateCamera();
Ogre::RenderWindow *window = render_widget_->getRenderWindow();
window->update(false);
if ( oculus_->isMagCalibrated() )
{
setStatus( rviz::StatusProperty::Ok, "Magnetometer", "Magnetometer calibrated.");
}
else
{
setStatus( rviz::StatusProperty::Warn, "Magnetometer", "Magnetometer not calibrated. Look left/right/up/down to collect enough samples.");
}
}
示例3: EnterMainLoop
void Main::EnterMainLoop()
{
/* Setup 3D engine */
OgreSubsystem* ror_ogre_subsystem = RoR::Application::GetOgreSubsystem();
assert(ror_ogre_subsystem != nullptr);
m_viewport = ror_ogre_subsystem->GetRenderWindow()->addViewport(nullptr);
int viewport_width = m_viewport->getActualWidth();
m_viewport->setBackgroundColour(m_config->viewport_background_color);
m_camera->setAspectRatio(m_viewport->getActualHeight() / viewport_width);
m_viewport->setCamera(m_camera);
InitializeOrRestoreGui();
/* Setup input */
RoR::Application::GetInputEngine()->SetKeyboardListener(m_input_handler);
RoR::Application::GetInputEngine()->SetMouseListener(m_input_handler);
/* Show debug box */
m_debug_box->setVisible(true);
while (! m_exit_loop_requested)
{
UpdateMainLoop();
Ogre::RenderWindow* rw = RoR::Application::GetOgreSubsystem()->GetRenderWindow();
if (rw->isClosed())
{
RoR::Application::GetMainThreadLogic()->RequestShutdown();
break;
}
/* Render */
RoR::Application::GetOgreSubsystem()->GetOgreRoot()->renderOneFrame();
if (!rw->isActive() && rw->isVisible())
{
rw->update(); // update even when in background !
}
}
/* Hide GUI */
m_gui_menubar->Hide();
if (m_gui_open_save_file_dialog->isModal())
{
m_gui_open_save_file_dialog->endModal(); // Hides the dialog
}
m_gui_delete_menu->Hide();
// Supress node/beam panels (if visible)
m_nodes_panel ->HideTemporarily();
m_beams_panel ->HideTemporarily();
m_hydros_panel ->HideTemporarily();
m_commands2_panel->HideTemporarily();
m_shocks_panel ->HideTemporarily();
m_shocks2_panel ->HideTemporarily();
m_meshwheels2_panel ->HideTemporarily();
m_flexbodywheels_panel ->HideTemporarily();
/* Hide debug box */
m_debug_box->setVisible(false);
m_exit_loop_requested = false;
}
示例4: main
//.........这里部分代码省略.........
Ogre::RenderWindow* lWindow = lRoot->initialise(lCreateAWindowAutomatically, lWindowTitle, lCustomCapacities);
if (!lWindow) {
/* ogre.cfg is not available - start with hardcoded parameters */
unsigned int lSizeX = 800;
unsigned int lSizeY = 600;
bool lFullscreen = false;
Ogre::NameValuePairList lParams;
lParams["FSAA"] = "0";
lParams["vsync"] = "true";
lWindow = lRoot->createRenderWindow(lWindowTitle, lSizeX, lSizeY, lFullscreen, &lParams);
}
/* Create a scene manager */
Ogre::SceneManager* lScene = lRoot->createSceneManager(Ogre::ST_GENERIC, "SceneManager");
Ogre::SceneNode* lRootSceneNode = lScene->getRootSceneNode();
/* Create camera */
Ogre::Camera* lCamera = lScene->createCamera("MyCamera");
/* Create viewport (camera <-> window) */
Ogre::Viewport* vp = lWindow->addViewport(lCamera);
vp->setAutoUpdated(true);
vp->setBackgroundColour(Ogre::ColourValue(1, 0, 1));
lCamera->setAspectRatio(float(vp->getActualWidth()) / vp->getActualHeight());
lCamera->setPosition(Ogre::Vector3(0, 100, -1));
lCamera->lookAt(Ogre::Vector3(0, 0, 0));
/* Set clipping*/
lCamera->setNearClipDistance(1.5f);
lCamera->setFarClipDistance(3000.0f);
/* Lighting */
Ogre::Light* lLight = lScene->createLight("MainLight");
lLight->setPosition(Ogre::Vector3(0, 100, 0));
/* Resource manager */
Ogre::String lRcGroupName = "Main group";
initResourceMainGroup(lRcGroupName);
/* Load model */
Ogre::Entity* lShipEntity = lScene->createEntity("airship.mesh");
lShipEntity->setCastShadows(false);
Ogre::SceneNode* lShipNode = lRootSceneNode->createChildSceneNode();
lShipNode->attachObject(lShipEntity);
lShipNode->setScale(Ogre::Vector3(3.15f, 3.15f, 3.15f));
/* Starship start point */
Ogre::Vector3 razorSP(0, -200, -100);
lShipNode->setPosition(razorSP);
/* Sprite billboard */
Ogre::SceneNode* lSpriteNode = lRootSceneNode->createChildSceneNode();
Ogre::BillboardSet* lBillboardSet = lScene->createBillboardSet();
lBillboardSet->setMaterialName("enemy_01", lRcGroupName);
lBillboardSet->setTextureStacksAndSlices(1, 4);
Ogre::Billboard* lSpriteBillboard = lBillboardSet->createBillboard(Ogre::Vector3(0, 0, 0));
lSpriteBillboard->setDimensions(48.0f / 2.0f, 58.0f / 2.0f);
lSpriteBillboard->setTexcoordIndex(1);
lSpriteNode->attachObject(lBillboardSet);
lSpriteNode->setPosition(Ogre::Vector3(0, -200, 100));
/* Obtain the timer pointer */
Ogre::Timer* lTimer = lRoot->getTimer();
/* Skip all the messages */
lWindow->setAutoUpdated(false);
lRoot->clearEventTimes();
while (!lWindow->isClosed()) {
float angle = Ogre::Math::Sin(float(lTimer->getMilliseconds()) * Ogre::Math::PI / 2000.0f) * Ogre::Math::PI / 4.0f;
float diplacement = Ogre::Math::Cos(float(lTimer->getMilliseconds()) * Ogre::Math::PI / 2000.0f) * 100.0f;
lShipNode->setOrientation(Ogre::Quaternion(Ogre::Radian(angle), Ogre::Vector3(0, 0, 1)));
lShipNode->setPosition(razorSP + Ogre::Vector3(diplacement, 0.0f, 0.0f));
unsigned int spriteFrame = (lTimer->getMilliseconds() / 125) % 2;
lSpriteBillboard->setTexcoordIndex(spriteFrame);
lWindow->update(false);
lWindow->swapBuffers();
lRoot->renderOneFrame();
Ogre::WindowEventUtilities::messagePump();
}
Ogre::LogManager::getSingleton().logMessage("Render window closed.");
}
catch (Ogre::Exception &e) {
std::cerr << "Ogre::Exception: " << e.what() << std::endl;
}
catch (std::exception &e) {
std::cerr << "std::exception: " << e.what() << std::endl;
}
return 0;
}