OGRE Wiki
Support and community documentation for Ogre3D
Ogre Forums
ogre3d.org
Log in
Username:
Password:
CapsLock is on.
Remember me (for 1 year)
Log in
Home
Tutorials
Tutorials Home
Basic Tutorials
Intermediate Tutorials
Mad Marx Tutorials
In Depth Tutorials
Older Tutorials
External Tutorials
Cookbook
Cookbook Home
CodeBank
Snippets
Experiences
Ogre Articles
Libraries
Libraries Home
Alternative Languages
Assembling A Toolset
Development Tools
OGRE Libraries
List of Libraries
Tools
Tools Home
DCC Tools
DCC Tutorials
DCC Articles
DCC Resources
Assembling a production pipeline
Development
Development Home
Roadmap
Building Ogre
Installing the Ogre SDK
Setting Up An Application
Ogre Wiki Tutorial Framework
Frequently Asked Questions
Google Summer Of Code
Help Requested
Ogre Core Articles
Community
Community Home
Projects Using Ogre
Recommended Reading
Contractors
Wiki
Immediate Wiki Tasklist
Wiki Ideas
Wiki Guidelines
Article Writing Guidelines
Wiki Styles
Wiki Page Tracker
Ogre Wiki Help
Ogre Wiki Help Overview
Help - Basic Syntax
Help - Images
Help - Pages and Structures
Help - Wiki Plugins
Toolbox
Freetags
Categories
List Pages
Structures
Trackers
Statistics
Rankings
List Galleries
Ogre Lexicon
Comments
History: ChangeSceneManagerRunTime
View page
Source of version: 3
(current)
I made a tool for editing a .scene and therefore I needed to swich between ST_GENERIC and ST_EXTERIOR_CLOSE to support landscape in scenes. You can also use this code to switch between any type of SceneManager, e.g. to switch between outdoor and indoor rendering. __Note:__ For a whole framework around this code, check out ((Basic Tutorial 8)). If you just want the essential code, read on. __Code:__ {CODE(wrap="1", colors="c++")}void SwitchManager(SceneType mType) { mWnd->removeAllViewports(); mScene->removeAllCameras(); mScene = Root::getSingleton().getSceneManager(mType); mCam = mScene->createCamera("Main Camera"); mCam->setPosition(0, 0, 300); mCam->lookAt(0, 0, 0); mWnd->addViewport(mCam); currSceneType = mType; }{CODE} ''mWnd'' is a RenderWindow pointer to the window that I created in my Init function. ''mScene'' is a SceneManager pointer and ''mCam'' is a Camera pointer. If your window is automatically created, you can add this code before the ''removeAllViewports()'' to get it: {CODE(wrap="1", colors="c++")}mWnd = Root::getSingleton().getAutoCreatedWindow();{CODE} The idea is that you can change your SceneManager if you remove your viewport. So this code removes the viewports, changes the SceneManager and recreates the viewport and camera. __Note:__ The camera has to be recreated, otherwise it will display the old scene.
Search by Tags
Search Wiki by Freetags
Latest Changes
IDE Eclipse
FMOD SoundManager
HDRlib
Building Ogre V2 with CMake
Ogre 2.1 FAQ
Minimal Ogre Collision
Artifex Terra
OpenMB
Advanced Mogre Framework
MogreSocks
...more
Search
Find
Advanced
Search Help
Online Users
142 online users