本文整理汇总了C++中ogre::Root类的典型用法代码示例。如果您正苦于以下问题:C++ Root类的具体用法?C++ Root怎么用?C++ Root使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Root类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv)
{
try {
Ogre::Root *root = new Ogre::Root();
if(!root->restoreConfig() && !root->showConfigDialog())
return -1;
root->initialise(false);
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("./data", "FileSystem");
Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
Gtk::Main kit(argc, argv);
MainWindow window;
window.show();
while(!window.hasExited()) {
//root->renderOneFrame();
kit.iteration();
}
} catch( Ogre::Exception& e) {
std::cerr << "Caught unhandled Ogre exception: " << e.getFullDescription() << std::endl;
}
// delete root;
return 0;
}
示例2: initialise
void initialise(Ogre::RenderWindow* _window, Ogre::SceneManager* _scene)
{
MYGUI_PLATFORM_ASSERT(!mIsInitialise, getClassTypeName() << " initialised twice");
MYGUI_PLATFORM_LOG(Info, "* Initialise: " << getClassTypeName());
mColorBlendMode.blendType = Ogre::LBT_COLOUR;
mColorBlendMode.source1 = Ogre::LBS_TEXTURE;
mColorBlendMode.source2 = Ogre::LBS_DIFFUSE;
mColorBlendMode.operation = Ogre::LBX_MODULATE;
mAlphaBlendMode.blendType = Ogre::LBT_ALPHA;
mAlphaBlendMode.source1 = Ogre::LBS_TEXTURE;
mAlphaBlendMode.source2 = Ogre::LBS_DIFFUSE;
mAlphaBlendMode.operation = Ogre::LBX_MODULATE;
mTextureAddressMode.u = Ogre::TextureUnitState::TAM_CLAMP;
mTextureAddressMode.v = Ogre::TextureUnitState::TAM_CLAMP;
mTextureAddressMode.w = Ogre::TextureUnitState::TAM_CLAMP;
mSceneManager = nullptr;
mWindow = nullptr;
mUpdate = false;
mRenderSystem = nullptr;
mActiveViewport = 0;
Ogre::Root* root = Ogre::Root::getSingletonPtr();
if (root != nullptr)
setRenderSystem(root->getRenderSystem());
setRenderWindow(_window);
setSceneManager(_scene);
MYGUI_PLATFORM_LOG(Info, getClassTypeName() << " successfully initialized");
mIsInitialise = true;
}
示例3: float
OgreRTTexture::OgreRTTexture(Ogre::TexturePtr _texture) :
mViewport(nullptr),
mSaveViewport(nullptr),
mTexture(_texture)
{
mProjectMatrix = Ogre::Matrix4::IDENTITY;
Ogre::Root* root = Ogre::Root::getSingletonPtr();
if (root != nullptr)
{
Ogre::RenderSystem* system = root->getRenderSystem();
if (system != nullptr)
{
size_t width = mTexture->getWidth();
size_t height = mTexture->getHeight();
mRenderTargetInfo.maximumDepth = system->getMaximumDepthInputValue();
mRenderTargetInfo.hOffset = system->getHorizontalTexelOffset() / float(width);
mRenderTargetInfo.vOffset = system->getVerticalTexelOffset() / float(height);
mRenderTargetInfo.aspectCoef = float(height) / float(width);
mRenderTargetInfo.pixScaleX = 1.0f / float(width);
mRenderTargetInfo.pixScaleY = 1.0f / float(height);
}
if (mTexture->getBuffer()->getRenderTarget()->requiresTextureFlipping())
{
mProjectMatrix[1][0] = -mProjectMatrix[1][0];
mProjectMatrix[1][1] = -mProjectMatrix[1][1];
mProjectMatrix[1][2] = -mProjectMatrix[1][2];
mProjectMatrix[1][3] = -mProjectMatrix[1][3];
}
}
}
示例4: debugDrawClassification
void NavigationCell::debugDrawClassification( Ogre::Vector3 start, Ogre::Vector3 end )
{
Ogre::Root *root = Ogre::Root::getSingletonPtr();
Ogre::SceneManager* mgr = root->getSceneManager( "SceneManagerInstance" );
Ogre::ManualObject* debug;
Ogre::SceneNode* node;
if( mgr->hasManualObject( "debugDrawClassification" ) )
debug = mgr->getManualObject( "debugDrawClassification" );
else
{
debug = mgr->createManualObject( "debugDrawClassification" );
node = mgr->getRootSceneNode()->createChildSceneNode();
node->attachObject( debug );
node->translate( 0, 1, 0 );
debug->setQueryFlags( 0 );
debug->setRenderQueueGroup( Ogre::RENDER_QUEUE_OVERLAY );
}
debug->begin( "debug/blue", Ogre::RenderOperation::OT_LINE_LIST );
debug->position( start );
debug->position( end );
debug->end();
// debugDrawCell( debug, "debug/yellow", "debug/blue" );
}
示例5: testModelMountScaling
void ModelMountTestCase::testModelMountScaling()
{
Ogre::Root root;
Ogre::SceneManager* sceneManager = root.createSceneManager(Ogre::ST_GENERIC);
TestModel model(*sceneManager);
//First test with a straight forward case.
Ogre::SceneNode* node = sceneManager->getRootSceneNode()->createChildSceneNode();
//We get an error when it's destroyed. So we don't destroy it.
SceneNodeProvider* nodeProvider = new SceneNodeProvider(node, nullptr);
Model::ModelMount mount(model, nodeProvider);
scaleAndTestMount(model, mount, nodeProvider->getNode());
//Test with the parent node being scaled
node->setScale(Ogre::Vector3(3.0f, 0.2f, 200.0f));
Ogre::SceneNode* subNode = node->createChildSceneNode();
nodeProvider = new SceneNodeProvider(subNode, nullptr);
Model::ModelMount mount2(model, nodeProvider);
scaleAndTestMount(model, mount2, nodeProvider->getNode());
//Test with the parent node being scaled and rotated
node->setScale(Ogre::Vector3(3.0f, 0.2f, 200.0f));
node->yaw(Ogre::Degree(42));
node->pitch(Ogre::Degree(76));
node->roll(Ogre::Degree(98));
subNode = node->createChildSceneNode();
nodeProvider = new SceneNodeProvider(subNode, nullptr);
Model::ModelMount mount3(model, nodeProvider);
scaleAndTestMount(model, mount3, nodeProvider->getNode());
}
示例6: OnMouseMove
void COrbitViewView::OnMouseMove(UINT nFlags, CPoint point)
{
Ogre::Vector3 CameraMove(0.0, 0.0, 0.0);
CEngine * Engine = ((COrbitViewApp*)AfxGetApp())->m_Engine;
if (Engine == NULL)
return;
Ogre::Root *Root = Engine->GetRoot();
if (m_Camera == NULL)
return;
if (m_MouseNavigation)
{
if (m_Orbit)
{
Ogre::SceneNode* CameraNode = m_SceneManager->getSceneNode("CameraNode");
CameraMove[1] = m_MousePosition.y - point.y;
m_Camera->moveRelative(CameraMove);
CameraNode->yaw(Ogre::Radian(0.01 * (m_MousePosition.x - point.x)));
}
else
{
CameraMove[0] = -(m_MousePosition.x - point.x);
CameraMove[1] = m_MousePosition.y - point.y;
m_Camera->moveRelative(CameraMove);
}
m_MousePosition = point;
Root->renderOneFrame();
}
CView::OnMouseMove(nFlags, point);
}
开发者ID:southerlies,项目名称:OGRE-3D-1.7-Application-Development-Cookbook-Code,代码行数:33,代码来源:OrbitViewView.cpp
示例7: startEngine
Ogre::Root* OgreEngine::startEngine()
{
m_resources_cfg = "resources.cfg";
activateOgreContext();
Ogre::Root *ogreRoot = new Ogre::Root;
Ogre::RenderSystem *renderSystem = ogreRoot->getRenderSystemByName("OpenGL Rendering Subsystem");
ogreRoot->setRenderSystem(renderSystem);
ogreRoot->initialise(false);
Ogre::NameValuePairList params;
params["externalGLControl"] = "true";
params["currentGLContext"] = "true";
//Finally create our window.
m_ogreWindow = ogreRoot->createRenderWindow("OgreWindow", 1, 1, false, ¶ms);
m_ogreWindow->setVisible(false);
m_ogreWindow->update(false);
doneOgreContext();
return ogreRoot;
}
示例8: OnMouseMove
void CUsingControllersView::OnMouseMove(UINT nFlags, CPoint point)
{
if (m_MouseNavigation)
{
Ogre::Vector3 CameraMove(0.0, 0.0, 0.0);
CameraMove[0] = -(m_MousePosition.x - point.x);
CameraMove[1] = m_MousePosition.y - point.y;
CEngine * Engine = ((CUsingControllersApp*)AfxGetApp())->m_Engine;
if (Engine == NULL)
return;
Ogre::Root *Root = Engine->GetRoot();
if (m_Camera == NULL)
return;
Ogre::Vector3 OldPosition = m_Camera->getPosition();
m_Camera->moveRelative(CameraMove);
m_MousePosition = point;
Root->renderOneFrame();
}
CView::OnMouseMove(nFlags, point);
}
开发者ID:southerlies,项目名称:OGRE-3D-1.7-Application-Development-Cookbook-Code,代码行数:25,代码来源:UsingControllersView.cpp
示例9: startup
int startup(){
_root = new Ogre::Root("plugins_d.cfg");
if(!_root->showConfigDialog()){
return -1;
}
Ogre::RenderWindow* window = _root->initialise(true, "Ventana Ogre");
_sceneManager = _root->createSceneManager(Ogre::ST_GENERIC);
Ogre::Camera* camera = _sceneManager->createCamera("Camera");
camera->setPosition(Ogre::Vector3(500,100,500));
camera->lookAt(Ogre::Vector3(0,0,0));
camera->setNearClipDistance(5);
Ogre::Viewport* viewport = window->addViewport(camera);
viewport->setBackgroundColour(Ogre::ColourValue(0.0,0.0,0.0));
camera->setAspectRatio(Ogre::Real(viewport->getActualWidth()/viewport->getActualHeight()));
_listener = new FrameListenerProyectos(window,camera);
_root->addFrameListener(_listener);
loadResources();
createScene();
_root->startRendering();
return 0;
}
示例10: OnSysKeyDown
void CGeoImageView::OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
switch (nChar)
{
case 'W':
m_Camera->setPolygonMode(Ogre::PM_WIREFRAME);
break;
case 'S':
m_Camera->setPolygonMode(Ogre::PM_SOLID);
break;
case 'P':
m_Camera->setPolygonMode(Ogre::PM_POINTS);
break;
}
Ogre::Root *Root = ((CGeoImageApp*)AfxGetApp())->m_Engine->GetRoot();
Root->renderOneFrame();
CView::OnSysKeyDown(nChar, nRepCnt, nFlags);
}
开发者ID:southerlies,项目名称:OGRE-3D-1.7-Application-Development-Cookbook-Code,代码行数:28,代码来源:GeoImageView.cpp
示例11: OnTimer
void CUsingControllersView::OnTimer(UINT_PTR nIDEvent)
{
CEngine *Engine = ((CUsingControllersApp*)AfxGetApp())->m_Engine;
Ogre::Root *Root = Engine->GetRoot();
Root->renderOneFrame();
CView::OnTimer(nIDEvent);
}
开发者ID:southerlies,项目名称:OGRE-3D-1.7-Application-Development-Cookbook-Code,代码行数:8,代码来源:UsingControllersView.cpp
示例12: initialise
void initialise(Ogre::RenderWindow* _window, Ogre::SceneManager* _scene)
{
MYGUI_PLATFORM_ASSERT(!mIsInitialise, getClassTypeName() << " initialised twice");
MYGUI_PLATFORM_LOG(Info, "* Initialise: " << getClassTypeName());
mColorBlendMode.blendType = Ogre::LBT_COLOUR;
mColorBlendMode.source1 = Ogre::LBS_TEXTURE;
mColorBlendMode.source2 = Ogre::LBS_DIFFUSE;
mColorBlendMode.operation = Ogre::LBX_MODULATE;
mAlphaBlendMode.blendType = Ogre::LBT_ALPHA;
mAlphaBlendMode.source1 = Ogre::LBS_TEXTURE;
mAlphaBlendMode.source2 = Ogre::LBS_DIFFUSE;
mAlphaBlendMode.operation = Ogre::LBX_MODULATE;
mTextureAddressMode.u = Ogre::TextureUnitState::TAM_CLAMP;
mTextureAddressMode.v = Ogre::TextureUnitState::TAM_CLAMP;
mTextureAddressMode.w = Ogre::TextureUnitState::TAM_CLAMP;
mSceneManager = nullptr;
mWindow = nullptr;
mUpdate = false;
mRenderSystem = nullptr;
mActiveViewport = 0;
Ogre::Root* root = Ogre::Root::getSingletonPtr();
if (root != nullptr)
setRenderSystem(root->getRenderSystem());
setRenderWindow(_window);
setSceneManager(_scene);
// ADDED
sh::MaterialInstance* mat = sh::Factory::getInstance().getMaterialInstance("MyGUI/NoTexture");
sh::Factory::getInstance()._ensureMaterial("MyGUI/NoTexture", "Default");
mVertexProgramNoTexture = static_cast<sh::OgreMaterial*>(mat->getMaterial())->getOgreTechniqueForConfiguration("Default")->getPass(0)
->getVertexProgram()->_getBindingDelegate();
mat = sh::Factory::getInstance().getMaterialInstance("MyGUI/OneTexture");
sh::Factory::getInstance()._ensureMaterial("MyGUI/OneTexture", "Default");
mVertexProgramOneTexture = static_cast<sh::OgreMaterial*>(mat->getMaterial())->getOgreTechniqueForConfiguration("Default")->getPass(0)
->getVertexProgram()->_getBindingDelegate();
mat = sh::Factory::getInstance().getMaterialInstance("MyGUI/NoTexture");
sh::Factory::getInstance()._ensureMaterial("MyGUI/NoTexture", "Default");
mFragmentProgramNoTexture = static_cast<sh::OgreMaterial*>(mat->getMaterial())->getOgreTechniqueForConfiguration("Default")->getPass(0)
->getFragmentProgram()->_getBindingDelegate();
mat = sh::Factory::getInstance().getMaterialInstance("MyGUI/OneTexture");
sh::Factory::getInstance()._ensureMaterial("MyGUI/OneTexture", "Default");
mFragmentProgramOneTexture = static_cast<sh::OgreMaterial*>(mat->getMaterial())->getOgreTechniqueForConfiguration("Default")->getPass(0)
->getFragmentProgram()->_getBindingDelegate();
MYGUI_PLATFORM_LOG(Info, getClassTypeName() << " successfully initialized");
mIsInitialise = true;
}
示例13: render
void Window::render()
{
Pipe *pipe = static_cast<Pipe *>(getPipe());
Ogre::Root *root = pipe->_ogre->getRoot();
root->_fireFrameStarted();
root->_fireFrameRenderingQueued();
mWindow->update(false);
root->_fireFrameEnded();
}
示例14: 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
}
}
}
示例15: OnActionsReset
void CManualObjectView::OnActionsReset()
{
for (int Index = 0; Index < m_ManualObject->getNumSections(); Index++)
{
m_ManualObject->setMaterialName(Index, Materials[Index]);
}
Ogre::Root *Root = ((CManualObjectApp*)AfxGetApp())->m_Engine->GetRoot();
Root->renderOneFrame();
}
开发者ID:southerlies,项目名称:OGRE-3D-1.7-Application-Development-Cookbook-Code,代码行数:10,代码来源:ManualObjectView.cpp