本文整理汇总了C++中CEngine::GetRoot方法的典型用法代码示例。如果您正苦于以下问题:C++ CEngine::GetRoot方法的具体用法?C++ CEngine::GetRoot怎么用?C++ CEngine::GetRoot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CEngine
的用法示例。
在下文中一共展示了CEngine::GetRoot方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnPaint
void CSceletalAnimationView::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
// Do not call CView::OnPaint() for painting messages
CSceletalAnimationDoc *Document = GetDocument();
CEngine *Engine = ((CSceletalAnimationApp*)AfxGetApp())->m_Engine;
if (Engine == NULL)
return;
Ogre::Root *Root = Engine->GetRoot();
if (m_First && Root != NULL)
{
m_First = false;
EngineSetup();
}
if (Root != NULL)
{
Root->renderOneFrame();
}
}
开发者ID:southerlies,项目名称:OGRE-3D-1.7-Application-Development-Cookbook-Code,代码行数:23,代码来源:SceletalAnimationView.cpp
示例2: OnPaint
void COrbitViewView::OnPaint()
{
CPaintDC dc(this); // device context for painting
COrbitViewDoc *Document = GetDocument();
CEngine *Engine = ((COrbitViewApp*)AfxGetApp())->m_Engine;
if (Engine == NULL)
return;
Ogre::Root *Root = Engine->GetRoot();
if (m_First && Root != NULL)
{
m_First = false;
EngineSetup();
}
if (Root != NULL)
{
Root->renderOneFrame();
}
// Do not call CView::OnPaint() for painting messages
}
开发者ID:southerlies,项目名称:OGRE-3D-1.7-Application-Development-Cookbook-Code,代码行数:23,代码来源:OrbitViewView.cpp
示例3: OnPaint
void CSaveSceneView::OnPaint()
{
CPaintDC dc(this); // device context for painting
CSaveSceneDoc *Document = GetDocument();
CEngine *Engine = ((CSaveSceneApp*)AfxGetApp())->m_Engine;
if (Engine == NULL)
return;
Ogre::Root *Root = Engine->GetRoot();
if (m_First && Root != NULL)
{
m_First = false;
EngineSetup();
}
if (Root != NULL)
{
Root->renderOneFrame();
}
}
开发者ID:southerlies,项目名称:OGRE-3D-1.7-Application-Development-Cookbook-Code,代码行数:23,代码来源:SaveSceneView.cpp
示例4: OnMouseMove
void CGeoImageView::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 = ((CGeoImageApp*)AfxGetApp())->m_Engine;
if (Engine == NULL)
return;
Ogre::Root *Root = Engine->GetRoot();
if (m_Camera == NULL)
return;
m_Camera->moveRelative(CameraMove);
m_MousePosition = point;
Root->renderOneFrame();
}
CView::OnMouseMove(nFlags, point);
}
开发者ID:southerlies,项目名称:OGRE-3D-1.7-Application-Development-Cookbook-Code,代码行数:23,代码来源:GeoImageView.cpp
示例5: OnMouseMove
void CSceneEditorView::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
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 = ((CSceneEditorApp*)AfxGetApp())->m_Engine;
if (Engine == NULL)
return;
Ogre::Root *Root = Engine->GetRoot();
if (m_Camera == NULL)
return;
m_Camera->yaw(Ogre::Degree(CameraMove[0] * 0.10f));
m_Camera->pitch(Ogre::Degree(CameraMove[1] * 0.10f));
m_MousePosition = point;
}
CView::OnMouseMove(nFlags, point);
}
示例6: EngineSetup
void CResourceManagementView::EngineSetup(void)
{
CEngine* Engine = ((CResourceManagementApp*)AfxGetApp())->m_Engine;
Ogre::Root *Root = Engine->GetRoot();
Ogre::SceneManager *SceneManager = NULL;
SceneManager = Root->createSceneManager(Ogre::ST_GENERIC, "ResourceManagement");
//
// Create a render window
// This window should be the current ChildView window using the externalWindowHandle
// value pair option.
//
Ogre::NameValuePairList parms;
parms["externalWindowHandle"] = Ogre::StringConverter::toString((long)m_hWnd);
parms["vsync"] = "true";
CRect rect;
GetClientRect(&rect);
Ogre::RenderTarget *RenderWindow = Root->getRenderTarget("Resource Management");
if (RenderWindow == NULL)
{
try
{
m_RenderWindow = Root->createRenderWindow("Resource Management", rect.Width(), rect.Height(), false, &parms);
}
catch(...)
{
MessageBox("Cannot initialize\nCheck that graphic-card driver is up-to-date", "Initialize Render System", MB_OK | MB_ICONSTOP);
exit(EXIT_SUCCESS);
}
}
Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
// Create the camera
m_Camera = SceneManager->createCamera("Camera");
m_Camera->setNearClipDistance(0.5);
m_Camera->setFarClipDistance(5000);
m_Camera->setCastShadows(false);
m_Camera->setUseRenderingDistance(true);
m_Camera->setPosition(Ogre::Vector3(200.0, 50.0, 100.0));
m_Camera->lookAt(0.0, 0.0, 0.0);
Ogre::SceneNode *CameraNode = NULL;
CameraNode = SceneManager->getRootSceneNode()->createChildSceneNode("CameraNode");
Ogre::Viewport* Viewport = NULL;
if (0 == m_RenderWindow->getNumViewports())
{
Viewport = m_RenderWindow->addViewport(m_Camera);
Viewport->setBackgroundColour(Ogre::ColourValue(0.8f, 1.0f, 0.8f));
}
// Alter the camera aspect ratio to match the viewport
m_Camera->setAspectRatio(Ogre::Real(rect.Width()) / Ogre::Real(rect.Height()));
Ogre::StringVector Groups = Ogre::ResourceGroupManager::getSingleton().getResourceGroups();
Ogre::Entity *MobiusEntity = Engine->m_StlFileManager->createEntity("Mobius", "1_4.stl");
Ogre::SceneNode *MobiusNode = SceneManager->getRootSceneNode()->createChildSceneNode();
MobiusNode->attachObject(MobiusEntity);
Ogre::AxisAlignedBox MobiusBox = MobiusEntity->getBoundingBox();
Ogre::Vector3 MobiusCenter = MobiusBox.getCenter();
m_Camera->lookAt(MobiusCenter);
Ogre::Real Radius = MobiusEntity->getBoundingRadius();
m_Camera->setPosition(300, 100, 200);
m_Camera->setPolygonMode(Ogre::PM_WIREFRAME);
}
示例7:
void CViewManagerView::On3dViews()
{
int ViewIndex = CMFCRibbonGallery::GetLastSelectedItem(ID_3DVIEWS);
CEngine *Engine = ((CViewManagerApp*)AfxGetApp())->m_Engine;
Ogre::Root *Root = Engine->GetRoot();
m_SceneManager->_updateSceneGraph(m_Camera);
Ogre::SceneNode *CubeNode = m_SceneManager->getSceneNode("Cube");
Ogre::AxisAlignedBox Box = m_SceneManager->getRootSceneNode()->_getWorldAABB();
Ogre::Vector3 Center = Box.getCenter();
Ogre::Vector3 Position;
Ogre::Vector3 Destination;
switch (ViewIndex)
{
case 0: //top
Position = Center;
Position.y += 4.0 * Box.getSize().y;
Destination = Center;
break;
case 1://bottom
Position = Center;
Position.y -= 4.0 * Box.getSize().y;
Destination = Center;
break;
case 2:
Position = Center;
Position.x += 4.0 * Box.getSize().x;
Destination = Center;
break;
case 3:
Position = Center;
Position.x -= 4.0 * Box.getSize().x;
Destination = Center;
break;
case 4:
Position = Center;
Position.z -= 4.0 * Box.getSize().z;
Destination = Center;
break;
case 5:
Position = Center;
Position.z += 4.0 * Box.getSize().z;
Destination = Center;
break;
case 9:
CubeNode->roll(Ogre::Radian(-atan(sin(Ogre::Math::PI/4.0))));
CubeNode->yaw(Ogre::Radian(Ogre::Math::PI/4.0));
Destination = Center;
Position = m_Camera->getPosition();
break;
}
m_Camera->setPosition(Position);
m_Camera->lookAt(Destination);
Root->renderOneFrame();
}
开发者ID:southerlies,项目名称:OGRE-3D-1.7-Application-Development-Cookbook-Code,代码行数:72,代码来源:ViewManagerView.cpp
示例8: OnTimer
void CTerrainWalkingView::OnTimer(UINT_PTR nIDEvent)
{
Ogre::Quaternion Quaternion;
CEngine *Engine = ((CTerrainWalkingApp*)AfxGetApp())->m_Engine;
Ogre::Root *Root = Engine->GetRoot();
Ogre::SceneNode *RobotNode = Root->getSceneManager("Walking")->getSceneNode("Robot");
Ogre::Entity *RobotEntity = Root->getSceneManager("Walking")->getEntity("Robot");
Ogre::AxisAlignedBox RobotBox = RobotEntity->getBoundingBox();
Ogre::Entity *TopographyEntity = Root->getSceneManager("Walking")->getEntity("Topography");
Ogre::AxisAlignedBox TopographyBox = TopographyEntity->getBoundingBox();
Ogre::Vector3 Start = TopographyBox.getMinimum();
Ogre::Vector3 Finish = TopographyBox.getMaximum();
double x = Start[0] + (Finish[0] - Start[0]) * m_RelativeDistance;
double y = Start[1] + (Finish[1] - Start[1]) * m_RelativeDistance;
double z = Start[2] + (Finish[2] - Start[2]) * m_RelativeDistance;
Ogre::Vector3 Elevation(x, y, z);
Ogre::Vector3 CameraMove;
switch (nIDEvent)
{
case 1:
m_Animation->addTime(0.01);
m_RelativeDistance += 0.01;
if (m_CollisionTools->collidesWithEntity(Elevation, Ogre::Vector3(x,y - 1,z), Ogre::Vector3(x,y + 1,z), 100.0f, 0.0f, 4294967295))
{
x = Elevation[0];
y = Elevation[1] + RobotBox.getSize()[1];
z = Elevation[2];
}
RobotNode->setPosition(x, y, z);
m_Camera->lookAt(x, y, z);
if (m_RelativeDistance > 1.0)
KillTimer(1);
break;
case 2:
CameraMove[0] = -100;
CameraMove[1] = 0;
CameraMove[2] = 0;
m_Camera->moveRelative(CameraMove);
break;
case 3:
CameraMove[0] = 0;
CameraMove[1] = 100;
CameraMove[2] = 0;
m_Camera->moveRelative(CameraMove);
break;
case 4:
CameraMove[0] = 100;
CameraMove[1] = 0;
CameraMove[2] = 0;
m_Camera->moveRelative(CameraMove);
break;
case 5:
CameraMove[0] = 0;
CameraMove[1] = -100;
CameraMove[2] = 0;
m_Camera->moveRelative(CameraMove);
break;
}
Root->renderOneFrame();
CView::OnTimer(nIDEvent);
}
开发者ID:southerlies,项目名称:OGRE-3D-1.7-Application-Development-Cookbook-Code,代码行数:85,代码来源:TerrainWalkingView.cpp