#include <StereoManager.h>
Classes | |
| class | DeviceLostListener |
| class | StereoCameraListener |
| struct | StereoModeDescription |
Public Types | |
| enum | StereoMode { SM_NONE, SM_ANAGLYPH_RC, SM_ANAGLYPH_YB, SM_DUALOUTPUT, SM_INTERLACED_V, SM_INTERLACED_H, SM_INTERLACED_CB, SM_LIMIT } |
| typedef std::map< StereoMode, StereoModeDescription > | StereoModeList |
Public Member Functions | |
| StereoManager (void) | |
| ~StereoManager (void) | |
| void | init (Viewport *leftViewport, Viewport *rightViewport, const String &fileName) |
| void | init (Viewport *leftViewport, Viewport *rightViewport, StereoMode mode) |
| void | shutdown (void) |
| void | addRenderTargetDependency (RenderTarget *renderTarget) |
| void | removeRenderTargetDependency (RenderTarget *renderTarget) |
| void | createDebugPlane (SceneManager *sceneMgr, const String &leftMaterialName="", const String &rightMaterialName="") |
| void | destroyDebugPlane (void) |
| void | enableDebugPlane (bool enable) |
| void | toggleDebugPlane (void) |
| void | updateDebugPlane (void) |
| Camera * | getCamera (void) const |
| void | setCamera (Camera *cam) |
| Real | getEyesSpacing (void) const |
| void | setEyesSpacing (Real l) |
| void | setFocalLength (Real l) |
| Real | getFocalLength (void) const |
| void | setFocalLengthInfinite (bool isInfinite=true) |
| bool | getFocalLengthInfinite (void) const |
| void | fixFocalPlanePos (bool fix) |
| void | setScreenWidth (Real w) |
| void | useScreenWidth (Real w) |
| StereoMode | getStereoMode (void) |
| void | inverseStereo (bool inverse) |
| bool | isStereoInversed (void) |
| void | setVisibilityMask (uint32 leftFlags, uint32 rightFlags) |
| void | saveConfig (const String &filename) |
| StereoMode | loadConfig (const String &filename) |
Protected Types | |
| typedef std::map< RenderTarget *, bool > | RenderTargetList |
Protected Member Functions | |
| void | initCompositor (Viewport *viewport, const String &materialName, Viewport *&out_left, Viewport *&out_right) |
| void | shutdownCompositor (void) |
| void | initListeners (Viewport *leftViewport, Viewport *rightViewport) |
| void | shutdownListeners (void) |
| void | updateCamera (Real delta) |
| void | init (Viewport *leftViewport, Viewport *rightViewport) |
| void | updateAllDependentRenderTargets (bool isLeftEye) |
| void | chooseDebugPlaneMaterial (bool isLeftEye) |
Protected Attributes | |
| Camera * | mCamera |
| StereoCameraListener | mLeftCameraListener |
| StereoCameraListener | mRightCameraListener |
| DeviceLostListener | mDeviceLostListener |
| Viewport * | mLeftViewport |
| Viewport * | mRightViewport |
| uint32 | mLeftMask |
| uint32 | mRightMask |
| CompositorInstance * | mCompositorInstance |
| StereoModeList | mAvailableModes |
| StereoMode | mStereoMode |
| Real | mEyesSpacing |
| Real | mFocalLength |
| bool | mFocalLengthInfinite |
| bool | mIsFocalPlaneFixed |
| Real | mScreenWidth |
| bool | mIsInversed |
| bool | mAreOverlaysEnabled |
| Viewport * | mCompositorViewport |
| RenderTargetList | mRenderTargetList |
| SceneManager * | mSceneMgr |
| Entity * | mDebugPlane |
| SceneNode * | mDebugPlaneNode |
| String | mLeftMaterialName |
| String | mRightMaterialName |
Friends | |
| class | StereoCameraListener |
| class | DeviceLostListener |
Stereo vision manager class. This manager supports two stereo vision mode :
Note : Ogre does not support natively the output in fullscreen on two screens. If you want to use the dual output mode with two fullscreen displays, you may want to apply this patch to OGRE : http://sourceforge.net/tracker/index.php?func=detail&aid=2555758&group_id=2997&atid=302997 However, this manager is completely indepedent from this patch, the dual output mode only needs two viewports, for example two non-fullscreen windows or a windows with two viewports inside.
Definition at line 58 of file StereoManager.h.
typedef std::map<RenderTarget*, bool> StereoManager::RenderTargetList [protected] |
Definition at line 153 of file StereoManager.h.
| typedef std::map<StereoMode, StereoModeDescription> StereoManager::StereoModeList |
Definition at line 101 of file StereoManager.h.
Definition at line 61 of file StereoManager.h.
| StereoManager::StereoManager | ( | void | ) |
Definition at line 114 of file StereoManager.cpp.
| StereoManager::~StereoManager | ( | void | ) |
Definition at line 142 of file StereoManager.cpp.
| void StereoManager::addRenderTargetDependency | ( | RenderTarget * | renderTarget | ) |
RenderTargets added with this method will no longer be auto-updated but will be updated one time before the right viewport is updated and one time before the left viewport is updated. It is useful if you have a render texture whose content depends on the camera position, for example a render texture for water reflection
Definition at line 353 of file StereoManager.cpp.
| void StereoManager::chooseDebugPlaneMaterial | ( | bool | isLeftEye | ) | [protected] |
Definition at line 553 of file StereoManager.cpp.
| void StereoManager::createDebugPlane | ( | SceneManager * | sceneMgr, | |
| const String & | leftMaterialName = "", |
|||
| const String & | rightMaterialName = "" | |||
| ) |
Create a representation of the focal plane in the scene. If no material name is provided, a default wireframe material is used.
The position of the debug plane will no longer be consistent with the focal length when it is set to infinite. The focal plane will still use the last finite focal length.
Definition at line 484 of file StereoManager.cpp.
| void StereoManager::destroyDebugPlane | ( | void | ) |
Definition at line 523 of file StereoManager.cpp.
| void StereoManager::enableDebugPlane | ( | bool | enable | ) |
Definition at line 472 of file StereoManager.cpp.
| void StereoManager::fixFocalPlanePos | ( | bool | fix | ) | [inline] |
The focal plane represents the screen in the world space. As the screen is not and infinite plane but a rectangle, what I call the focal plane is in fact a rectangle. When the position of the plane is fixed, its position and size doesn't change if you change the focal length. Instead the camera is moved to reflect the focal length. The FOV angle of the camera is also adjusted in order to keep the focal rectangle covering the whole field view.
If you set the screen width in the manager you can achieve a 1:1 scale effect if the observer's distance to the screen is equal to the focal distance.
Definition at line 256 of file StereoManager.h.
| Camera* StereoManager::getCamera | ( | void | ) | const [inline] |
Definition at line 214 of file StereoManager.h.
| Real StereoManager::getEyesSpacing | ( | void | ) | const [inline] |
Definition at line 223 of file StereoManager.h.
| Real StereoManager::getFocalLength | ( | void | ) | const |
Returns the focal length. Will return std::numeric_limits<Real>::infinity() if you used setFocalLengthInfinite(true)
Definition at line 429 of file StereoManager.cpp.
| bool StereoManager::getFocalLengthInfinite | ( | void | ) | const |
Definition at line 444 of file StereoManager.cpp.
| StereoMode StereoManager::getStereoMode | ( | void | ) | [inline] |
Definition at line 266 of file StereoManager.h.
| void StereoManager::init | ( | Viewport * | leftViewport, | |
| Viewport * | rightViewport, | |||
| StereoMode | mode | |||
| ) |
Definition at line 148 of file StereoManager.cpp.
| void StereoManager::init | ( | Viewport * | leftViewport, | |
| Viewport * | rightViewport, | |||
| const String & | fileName | |||
| ) |
The manager should be initialized with two viewports if you want dual output stereo (SM_DUALOUTPUT). If you want red/blue anaglyph stereo (SM_ANAGLYPH) you only need one viewport, just set the rightViewport to NULL. The left eye and the right eye will be composited on the leftViewport. The camera will be detected from the viewports.
You can also use a configuration file that will store the stereo mode, the focal length, the eye spacing and the screen width.
Definition at line 156 of file StereoManager.cpp.
| void StereoManager::init | ( | Viewport * | leftViewport, | |
| Viewport * | rightViewport | |||
| ) | [protected] |
Definition at line 164 of file StereoManager.cpp.
| void StereoManager::initCompositor | ( | Viewport * | viewport, | |
| const String & | materialName, | |||
| Viewport *& | out_left, | |||
| Viewport *& | out_right | |||
| ) | [protected] |
Definition at line 233 of file StereoManager.cpp.
| void StereoManager::initListeners | ( | Viewport * | leftViewport, | |
| Viewport * | rightViewport | |||
| ) | [protected] |
Definition at line 202 of file StereoManager.cpp.
| void StereoManager::inverseStereo | ( | bool | inverse | ) |
Inverse the left eye and the right eye viewports
Definition at line 464 of file StereoManager.cpp.
| bool StereoManager::isStereoInversed | ( | void | ) | [inline] |
Definition at line 273 of file StereoManager.h.
| StereoManager::StereoMode StereoManager::loadConfig | ( | const String & | filename | ) |
Definition at line 600 of file StereoManager.cpp.
| void StereoManager::removeRenderTargetDependency | ( | RenderTarget * | renderTarget | ) |
Definition at line 361 of file StereoManager.cpp.
| void StereoManager::saveConfig | ( | const String & | filename | ) |
You can save and load the stereo configuration (mode, eyes spacing, focal length and screen width) to a file. Then this file can be used to initialize the manager.
Definition at line 566 of file StereoManager.cpp.
| void StereoManager::setCamera | ( | Camera * | cam | ) | [inline] |
Definition at line 218 of file StereoManager.h.
| void StereoManager::setEyesSpacing | ( | Real | l | ) | [inline] |
Definition at line 227 of file StereoManager.h.
| void StereoManager::setFocalLength | ( | Real | l | ) |
Sets the focal length of the camera, i.e. the distance at which a point will be rendered at the same position on the screen for each eye. Will disable the infinite focal length
Definition at line 406 of file StereoManager.cpp.
| void StereoManager::setFocalLengthInfinite | ( | bool | isInfinite = true |
) |
Sets the focal length to infinite. Usefull if you use Head Mounted Displays because you need parallel frustums. The position of the debug plane will no longer be consistent with the focal length when it is set to infinite. The focal plane will still use the last finite focal length.
Definition at line 437 of file StereoManager.cpp.
| void StereoManager::setScreenWidth | ( | Real | w | ) | [inline] |
Definition at line 260 of file StereoManager.h.
| void StereoManager::setVisibilityMask | ( | uint32 | leftFlags, | |
| uint32 | rightFlags | |||
| ) |
Only objects matching the following flags will be rendered. This method sets the visibility mask for the right and the left viewports and the according mask for each dependent render target.
Definition at line 339 of file StereoManager.cpp.
| void StereoManager::shutdown | ( | void | ) |
Shutdown and re-init the stereo manager to change stereo mode
Definition at line 319 of file StereoManager.cpp.
| void StereoManager::shutdownCompositor | ( | void | ) | [protected] |
Definition at line 286 of file StereoManager.cpp.
| void StereoManager::shutdownListeners | ( | void | ) | [protected] |
Definition at line 219 of file StereoManager.cpp.
| void StereoManager::toggleDebugPlane | ( | void | ) |
Definition at line 478 of file StereoManager.cpp.
| void StereoManager::updateAllDependentRenderTargets | ( | bool | isLeftEye | ) | [protected] |
Definition at line 369 of file StereoManager.cpp.
| void StereoManager::updateCamera | ( | Real | delta | ) | [protected] |
Definition at line 457 of file StereoManager.cpp.
| void StereoManager::updateDebugPlane | ( | void | ) |
Definition at line 536 of file StereoManager.cpp.
| void StereoManager::useScreenWidth | ( | Real | w | ) |
Definition at line 449 of file StereoManager.cpp.
friend class DeviceLostListener [friend] |
Definition at line 128 of file StereoManager.h.
friend class StereoCameraListener [friend] |
Definition at line 119 of file StereoManager.h.
bool StereoManager::mAreOverlaysEnabled [protected] |
Definition at line 149 of file StereoManager.h.
StereoModeList StereoManager::mAvailableModes [protected] |
Definition at line 138 of file StereoManager.h.
Camera* StereoManager::mCamera [protected] |
Definition at line 130 of file StereoManager.h.
CompositorInstance* StereoManager::mCompositorInstance [protected] |
Definition at line 135 of file StereoManager.h.
Viewport* StereoManager::mCompositorViewport [protected] |
Definition at line 150 of file StereoManager.h.
Entity* StereoManager::mDebugPlane [protected] |
Definition at line 159 of file StereoManager.h.
SceneNode* StereoManager::mDebugPlaneNode [protected] |
Definition at line 160 of file StereoManager.h.
DeviceLostListener StereoManager::mDeviceLostListener [protected] |
Definition at line 132 of file StereoManager.h.
Real StereoManager::mEyesSpacing [protected] |
Definition at line 140 of file StereoManager.h.
Real StereoManager::mFocalLength [protected] |
Definition at line 141 of file StereoManager.h.
bool StereoManager::mFocalLengthInfinite [protected] |
Definition at line 142 of file StereoManager.h.
bool StereoManager::mIsFocalPlaneFixed [protected] |
Definition at line 143 of file StereoManager.h.
bool StereoManager::mIsInversed [protected] |
Definition at line 145 of file StereoManager.h.
Definition at line 131 of file StereoManager.h.
uint32 StereoManager::mLeftMask [protected] |
Definition at line 134 of file StereoManager.h.
String StereoManager::mLeftMaterialName [protected] |
Definition at line 161 of file StereoManager.h.
Viewport* StereoManager::mLeftViewport [protected] |
Definition at line 133 of file StereoManager.h.
RenderTargetList StereoManager::mRenderTargetList [protected] |
Definition at line 155 of file StereoManager.h.
Definition at line 131 of file StereoManager.h.
uint32 StereoManager::mRightMask [protected] |
Definition at line 134 of file StereoManager.h.
String StereoManager::mRightMaterialName [protected] |
Definition at line 161 of file StereoManager.h.
Viewport * StereoManager::mRightViewport [protected] |
Definition at line 133 of file StereoManager.h.
SceneManager* StereoManager::mSceneMgr [protected] |
Definition at line 158 of file StereoManager.h.
Real StereoManager::mScreenWidth [protected] |
Definition at line 144 of file StereoManager.h.
StereoMode StereoManager::mStereoMode [protected] |
Definition at line 139 of file StereoManager.h.
1.6.3