本文整理汇总了C++中ogre::Viewport类的典型用法代码示例。如果您正苦于以下问题:C++ Viewport类的具体用法?C++ Viewport怎么用?C++ Viewport使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Viewport类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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()));
}
示例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: AdjustPauseMenuPosition
void GUIManager::AdjustPauseMenuPosition()
{
Ogre::Viewport* viewport = RoR::App::GetOgreSubsystem()->GetRenderWindow()->getViewport(0);
int margin = (viewport->getActualHeight() / 15);
m_impl->panel_GamePauseMenu.SetPosition(
margin, // left
viewport->getActualHeight() - m_impl->panel_GamePauseMenu.GetHeight() - margin // top
);
}
示例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: viewport_get_background_colour
//Ogre::Viewport::getBackgroundColour() const
void viewport_get_background_colour(ViewportHandle handle, coiColourValue* cv)
{
Ogre::Viewport* vp = reinterpret_cast<Ogre::Viewport*>(handle);
const Ogre::ColourValue &c = vp->getBackgroundColour();
cv->r = c.r;
cv->b = c.b;
cv->g = c.g;
cv->a = c.a;
}
示例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:
bool CSimulatorWindowHandler::view3DButtonClicked(const CEGUI::EventArgs& e)
{
m_renderTexture->removeAllViewports();
Ogre::Viewport *viewport = m_renderTexture->addViewport(m_cam3D);
viewport->setOverlaysEnabled(false);
viewport->setClearEveryFrame(true);
viewport->setBackgroundColour(Ogre::ColourValue::Black);
return true;
}
示例8:
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;
}
示例9: 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();
}
示例10: 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()));
}
示例11:
/// r,g,b,a
static int SetBackCol (lua_State *L) { PROFILE
Ogre::Viewport* pViewport = checkudata_alive(L)->mpViewport;
if (!pViewport) return 0;
int numargs=lua_gettop(L);
Ogre::Real r = (numargs >= 2 && !lua_isnil(L,2)) ? luaL_checknumber(L,2) : 0;
Ogre::Real g = (numargs >= 3 && !lua_isnil(L,3)) ? luaL_checknumber(L,3) : 0;
Ogre::Real b = (numargs >= 4 && !lua_isnil(L,4)) ? luaL_checknumber(L,4) : 0;
Ogre::Real a = (numargs >= 5 && !lua_isnil(L,5)) ? luaL_checknumber(L,5) : 0;
pViewport->setBackgroundColour(Ogre::ColourValue(r,g,b,a));
return 0;
}
示例12: 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));
}
示例13: 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()));
}
示例14: setActiveScene
void OGKSceneManager::setActiveScene(const Ogre::String name, Ogre::Real transitionTime)
{
mPreviousScene = mActiveScene;
mActiveScene = getScene(name);
Ogre::ColourValue bg = Ogre::ColourValue::Black;
if(mPreviousScene) {
if(mPreviousScene->mCamera) {
// save viewport settings for rtt
Ogre::Camera *cam = mPreviousScene->mCamera->getCamera();
bg = cam->getViewport()->getBackgroundColour();
}
mPreviousScene->onExitTransitionDidStart();
}
if(mActiveScene) {
OGKLOG("Transitioning to " + name + " scene");
mActiveScene->onEnter();
}
if(transitionTime > 0.01) {
// transition
mTransitionTime = transitionTime;
mTransitionTimeRemaining = transitionTime;
_initRTT();
if(mPreviousScene && mPreviousScene->mCamera &&
mPreviousScene->mCamera->getCamera()) {
// render to texture instead
Ogre::Camera *cam = mPreviousScene->mCamera->getCamera();
mRenderTexture->removeAllViewports();
Ogre::Viewport *vp = mRenderTexture->addViewport(cam);
if(vp) {
//OGKLOG("Preparing rtt viewport");
vp->setClearEveryFrame(true);
vp->setBackgroundColour(bg);
vp->setOverlaysEnabled(true);
vp->setCamera(cam);
}
}
if(mOverlay) {
//OGKLOG("Showing Overlay");
mOverlay->show();
}
}
else {
if(mPreviousScene) mPreviousScene->onExit();
if(mActiveScene) mActiveScene->onEnterTransitionDidFinish();
}
}
示例15: 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));
}