本文整理汇总了C++中ogre::Viewport::getActualHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ Viewport::getActualHeight方法的具体用法?C++ Viewport::getActualHeight怎么用?C++ Viewport::getActualHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::Viewport
的用法示例。
在下文中一共展示了Viewport::getActualHeight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnRenderViewSize
//-----------------------------------------------------------------------------
void Engine::OnRenderViewSize()
{
if(m_pRenderWnd)
m_pRenderWnd->windowMovedOrResized();
if(m_pCamera)
m_pCamera->setAspectRatio(
Ogre::Real(m_pViewport->getActualWidth()) / Ogre::Real(m_pViewport->getActualHeight()));
}
示例2: createViewports
//---------------------------------------------------------------------------
void TutorialApplication::createViewports()
{
Ogre::Viewport* vp = mWindow->addViewport(mCamera);
vp->setBackgroundColour(Ogre::ColourValue(0,0,0));
mCamera->setAspectRatio(
Ogre::Real(vp->getActualWidth()) /
Ogre::Real(vp->getActualHeight()));
}
示例3: createViewports
//---------------------------------------------------------------------------
void BaseApplication::createViewports(void)
{
// Create one viewport, entire window
Ogre::Viewport* vp = mWindow->addViewport(mCamera);
vp->setBackgroundColour(Ogre::ColourValue(0,0,0));
// Alter the camera aspect ratio to match the viewport
mCamera->setAspectRatio(Ogre::Real(vp->getActualWidth()) / Ogre::Real(vp->getActualHeight()));
}
示例4: main
int main(int argc, char* argv[]){
cout << "Test Ogre Program" << endl;
//Relative to where its executed from, not binary location
Ogre::Root *mRoot = new Ogre::Root("configs/plugins.cfg","configs/config.cfg","logs/main.log");
if(!(mRoot->restoreConfig() || mRoot->showConfigDialog())){
delete mRoot;
return -1;
}
// setup resources
// Only add the minimally required resource locations to load up the Ogre head mesh
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("/Users/jgrey/OgreSDK/Media/materials/programs", "FileSystem", "General");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("/Users/jgrey/OgreSDK/Media/materials/programs/GLSL", "FileSystem", "General");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("/Users/jgrey/OgreSDK/Media/materials/scripts", "FileSystem", "General");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("/Users/jgrey/OgreSDK/Media/materials/textures", "FileSystem", "General");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("/Users/jgrey/OgreSDK/Media/models", "FileSystem", "General");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("/Users/jgrey/github/Ogre_test/data","FileSystem","General");
//Create the window
Ogre::RenderWindow *mWindow = mRoot->initialise(true, "initial Render Window");
Ogre::SceneManager *sceneManager = mRoot->createSceneManager(Ogre::ST_GENERIC);
Ogre::Camera *camera = sceneManager->createCamera("PlayerCam");
camera->setPosition(Ogre::Vector3(0,0,80));
camera->lookAt(Ogre::Vector3(0,0,-300));
camera->setNearClipDistance(5);
Ogre::Viewport* vp = mWindow->addViewport(camera);
vp->setBackgroundColour(Ogre::ColourValue(0,0,0,0));
camera->setAspectRatio(Ogre::Real(vp->getActualWidth()) / Ogre::Real(vp->getActualHeight()));
Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
//Ogre::Entity* ogreHead = sceneManager->createEntity("Head","ogreHead.mesh");
Ogre::Entity* ogreHead = sceneManager->createEntity("Head","myTest.obj");
Ogre::SceneNode* headNode = sceneManager->getRootSceneNode()->createChildSceneNode();
headNode->attachObject(ogreHead);
sceneManager->setAmbientLight(Ogre::ColourValue(0.5,0.5,0.5));
//Run the system
bool continueRunning = true;
while(continueRunning){
mRoot->renderOneFrame();
headNode->rotate(Ogre::Vector3(0,1,0),Ogre::Radian(0.005));
if(mWindow->isClosed()){
continueRunning = false;
}
}
delete mRoot;
}
示例5:
GameState* StateManager::changeState ( const std::string& state_name, Ogre::RenderWindow* window ){
_prev_state = _current_state;
_current_state = _states[state_name];
window->removeAllViewports();
Ogre::Camera* camera = _current_state->getScene()->getCamera(MainCameraName);
Ogre::Viewport* vp = window->addViewport(camera);
vp->setBackgroundColour(Ogre::ColourValue(0.5,0.5,0.5));
camera->setAspectRatio(Ogre::Real(vp->getActualWidth()) / Ogre::Real(vp->getActualHeight()));
return _current_state;
}
示例6: setupViewport
void MultiMgrSample::setupViewport(Ogre::SceneManager *curr)
{
mWindow->removeAllViewports();
Ogre::Camera *cam = curr->getCamera(CAMERA_NAME);
Ogre::Viewport *vp = mWindow->addViewport(cam);
vp->setBackgroundColour(Ogre::ColourValue(0,0,0));
cam->setAspectRatio(Ogre::Real(vp->getActualWidth()) / Ogre::Real(vp->getActualHeight()));
}
示例7: ShowMainMenu
void GUIManager::ShowMainMenu(bool isVisible)
{
if (isVisible == true)
{
if (m_gui_GameMainMenu.get() == nullptr)
m_gui_GameMainMenu = std::unique_ptr<GUI::GameMainMenu>(new GUI::GameMainMenu());
/* Adjust menu position */
Ogre::Viewport* viewport = RoR::Application::GetOgreSubsystem()->GetRenderWindow()->getViewport(0);
int margin = (viewport->getActualHeight() / 15);
m_gui_GameMainMenu->SetPosition(
margin, // left
viewport->getActualHeight() - m_gui_GameMainMenu->GetHeight() - margin // top
);
m_gui_GameMainMenu->Show();
} else
m_gui_GameMainMenu->Hide();
}
示例8: QWidget
// -----------------------------------------------------------------------------
CardEditor::CardEditor(EditorProject* project, DeckEditor* parentEditor, QWidget *parent, Qt::WFlags flags)
: QWidget(parent, flags),
EditorWidget(project, parentEditor),
widget(0),
cards(project->getCards()),
current(0),
hasChanged(false),
notified(false),
currentItem(0),
cardCount(cards.size()),
rsError(false) {
ui.setupUi(this);
// We're trying to create a 3D Render Preview. If this fails, the user
// will still be able to edit stuff, but can't preview changes.
try {
// Create Editor RenderView
widget = new OgreWidget(Util::toQString(EditorSystem::getInstance().getRenderView()), ui.ogreWidget);
widget->setBaseSize(QSize(288,384));
widget->setFixedWidth(288);
widget->setFixedHeight(384);
widget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
widget->setFocusPolicy(Qt::NoFocus);
ui.ogreWidget->setAttribute(Qt::WA_PaintOnScreen);
ui.ogreWidget->setAttribute(Qt::WA_NoSystemBackground);
ui.ogreWidget->setAttribute(Qt::WA_NoBackground);
ui.innerLayout->addWidget(widget, 1, 1);
// We need a camera and Viewport in order to display anything
Ogre::Camera* camera = Ogre::Root::getSingletonPtr()->getSceneManager("root")->createCamera("PlayerCam");
Ogre::Viewport* viewport = static_cast<OgreWidget*>(widget)->getRenderWindow()->addViewport(camera);
camera->setAspectRatio(
Ogre::Real(viewport->getActualWidth()) / Ogre::Real(viewport->getActualHeight()));
// Initialize UI & associated Managers
Arcomage::UI::UIManager::getInstance().bootstrap();
// Preload required Editor Fonts
Arcomage::ResourceManager::getInstance().preloadResources(
Arcomage::ConfigurationManager::getInstance().getPath("Fonts")+"/fonts.xml",
/* unused, Music */ "",
/* unused, Sound effects */ "");
} catch (Ogre::Exception& e) {
rsError = true;
widget = new OgreWidget("errorwidget", ui.ogreWidget, true);
ToolkitUtil::getInstance().notifyError(e.what());
}
populateTree();
this->connectUI();
}
示例9: mRoot
MiniMapManager::MiniMapManager(Ogre::Root *root, Ogre::RenderWindow *window): mRoot(root), mWindow(window)
{
mSceneMgr = mRoot->createSceneManager(Ogre::ST_GENERIC, "MiniMapSceneMgr");
mCamera = mSceneMgr->createCamera("miniMapCamera");
Ogre::Viewport *vp = mWindow->addViewport(mCamera, 1, 0, 0.8, 0.2, 0.2);
vp->setBackgroundColour(Ogre::ColourValue(0, 0, 0));
mCamera->setAutoAspectRatio((Ogre::Real(vp->getActualWidth())) / (Ogre::Real(vp->getActualHeight())));
mSceneMgr->setAmbientLight(Ogre::ColourValue(0.8, 0.8, 0.8));
}
示例10: createCamera
// funcion que configura la camara
void createCamera(Ogre::RenderWindow* window){
camera = _sceneManager->createCamera("Camera");
camera->setPosition(Ogre::Vector3(0,60,-100));
camera->lookAt(Ogre::Vector3(0,0,50));
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())/Ogre::Real(viewport->getActualHeight()));
}
示例11: createViewports
//-------------------------------------------------------------------------------------
void THIS::createViewports(void)
{
cout << "<TRACE><LOG><SceneManager><createViewports> " << endl;
// Create one viewport, entire window
Ogre::Viewport* vp = mWindow->addViewport(mCamera);
vp->setBackgroundColour(Ogre::ColourValue(0,0,0));
// Alter the camera aspect ratio to match the viewport
mCamera->setAspectRatio(
Ogre::Real(vp->getActualWidth()) / Ogre::Real(vp->getActualHeight()));
}
示例12: windowResized
void GUIManager::windowResized(Ogre::RenderWindow* rw)
{
int width = (int)rw->getWidth();
int height = (int)rw->getHeight();
setInputViewSize(width, height);
BeamFactory *bf = BeamFactory::getSingletonPtr();
if (bf) bf->windowResized();
if (m_gui_GameMainMenu.get() != nullptr)
{
/* Adjust menu position */
Ogre::Viewport* viewport = RoR::Application::GetOgreSubsystem()->GetRenderWindow()->getViewport(0);
int margin = (viewport->getActualHeight() / 15);
m_gui_GameMainMenu->SetPosition(
margin, // left
viewport->getActualHeight() - m_gui_GameMainMenu->GetHeight() - margin // top
);
}
}
示例13: createViewports
//-------------------------------------------------------------------------------------
void DigitalForensicsVisualisation::createViewports(void)
{
// Create one viewport, entire window
Ogre::Viewport* vp = mWindow->addViewport(mCamera);
vp->setBackgroundColour(Ogre::ColourValue(.35,.35,.35));
// Alter the camera aspect ratio to match the viewport
//mCamera->setFarClipDistance(2000);
mCamera->setAspectRatio(Ogre::Real(vp->getActualWidth()) / Ogre::Real(vp->getActualHeight()));
mCamera->pitch(static_cast <Ogre::Radian>(-0.45));
}
示例14: windowResized
// дл¤ оповещений об изменении окна рендера
void Gui::windowResized(Ogre::RenderWindow* rw)
{
FloatSize oldViewSize = mViewSize;
Ogre::Viewport * port = rw->getViewport(mActiveViewport);
mViewSize.set(port->getActualWidth(), port->getActualHeight());
mLayerManager->_windowResized(mViewSize);
// выравниваем рутовые окна
for (VectorWidgetPtr::iterator iter = mWidgetChild.begin(); iter!=mWidgetChild.end(); ++iter) {
_alignWidget((*iter), oldViewSize, mViewSize);
}
}
示例15: InitViewport
void AsteroidGame::InitViewport(void){
try {
/* Retrieve scene manager and root scene node */
Ogre::SceneManager* scene_manager = ogre_root_->createSceneManager(Ogre::ST_GENERIC, "MySceneManager");
Ogre::SceneNode* root_scene_node = scene_manager->getRootSceneNode();
/* Create camera object */
camera = scene_manager->createCamera("MyCamera");
Ogre::SceneNode* camera_scene_node = root_scene_node->createChildSceneNode("MyCameraNode");
camera_scene_node->attachObject(camera);
camera->setNearClipDistance(camera_near_clip_distance_g);
camera->setFarClipDistance(camera_far_clip_distance_g);
camera->setPosition(camera_position_g);
camera->lookAt(camera_look_at_g);
//camera->setFixedYawAxis(true, camera_up_g);
/* Create second camera object */
camera_2 = scene_manager->createCamera("MyCamera_2");
Ogre::SceneNode* camera_scene_node_2 = root_scene_node->createChildSceneNode("MyCameraNode_2");
camera_scene_node_2->attachObject(camera_2);
camera_2->setNearClipDistance(camera_near_clip_distance_g);
camera_2->setFarClipDistance(camera_far_clip_distance_g);
camera_2->setPosition(camera_position_g);
camera_2->lookAt(camera_look_at_g);
//camera->setFixedYawAxis(true, camera_up_g);
/*Create viewport */
Ogre::Viewport *viewport = ogre_window_->addViewport(camera, viewport_z_order_g, viewport_left_g, viewport_top_g, viewport_width_g, viewport_height_g);
viewport->setAutoUpdated(true);
viewport->setBackgroundColour(viewport_background_color_g);
/* Set aspect ratio */
float ratio = float(viewport->getActualWidth()) / float(viewport->getActualHeight());
camera->setAspectRatio(ratio);
camera_2->setAspectRatio(ratio);
}
catch (Ogre::Exception &e){
throw(OgreAppException(std::string("Ogre::Exception: ") + std::string(e.what())));
}
catch(std::exception &e){
throw(OgreAppException(std::string("std::Exception: ") + std::string(e.what())));
}
}