#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) |
| StereoMode | getStereoMode (void) const |
| 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 | isFocalLengthInfinite (void) const |
| void | fixFocalPlanePos (bool fix) |
| void | setScreenWidth (Real w) |
| void | useScreenWidth (Real w) |
| void | setCustomProjectonMatrices (bool enable, const Matrix4 &leftMatrix, const Matrix4 &rightMatrix) |
| void | getCustomProjectonMatrices (bool &enabled, Matrix4 &leftMatrix, Matrix4 &rightMatrix) const |
| void | inverseStereo (bool inverse) |
| bool | isStereoInversed (void) const |
| void | setVisibilityMask (uint32 leftMask, uint32 rightMask) |
| void | getVisibilityMask (uint32 &outLeftMask, uint32 &outRightMask) const |
| Viewport * | getLeftViewport (void) const |
| Viewport * | getRightViewport (void) const |
| void | saveConfig (const String &filename) const |
| 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 | mIsCustomProjection |
| Matrix4 | mLeftCustomProjection |
| Matrix4 | mRightCustomProjection |
| bool | mAreOverlaysEnabled |
| Viewport * | mCompositorViewport |
| RenderTargetList | mRenderTargetList |
| SceneManager * | mSceneMgr |
| Entity * | mDebugPlane |
| SceneNode * | mDebugPlaneNode |
| String | mLeftMaterialName |
| String | mRightMaterialName |
Friends | |
| class | StereoCameraListener |
| class | DeviceLostListener |
Definition at line 58 of file StereoManager.h.
typedef std::map<RenderTarget *, bool> Ogre::StereoManager::RenderTargetList [protected] |
Definition at line 157 of file StereoManager.h.
| typedef std::map<StereoMode, StereoModeDescription> Ogre::StereoManager::StereoModeList |
Definition at line 102 of file StereoManager.h.
Definition at line 61 of file StereoManager.h.
| StereoManager::StereoManager | ( | void | ) |
Definition at line 143 of file StereoManager.cpp.
| StereoManager::~StereoManager | ( | void | ) |
Definition at line 174 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 393 of file StereoManager.cpp.
| void StereoManager::chooseDebugPlaneMaterial | ( | bool | isLeftEye | ) | [protected] |
Definition at line 604 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 533 of file StereoManager.cpp.
| void StereoManager::destroyDebugPlane | ( | void | ) |
Definition at line 572 of file StereoManager.cpp.
| void StereoManager::enableDebugPlane | ( | bool | enable | ) |
Definition at line 521 of file StereoManager.cpp.
| void Ogre::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 250 of file StereoManager.h.
| Camera* Ogre::StereoManager::getCamera | ( | void | ) | const [inline] |
Definition at line 220 of file StereoManager.h.
| void StereoManager::getCustomProjectonMatrices | ( | bool & | enabled, | |
| Matrix4 & | leftMatrix, | |||
| Matrix4 & | rightMatrix | |||
| ) | const |
Definition at line 513 of file StereoManager.cpp.
| Real Ogre::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 469 of file StereoManager.cpp.
| Viewport* Ogre::StereoManager::getLeftViewport | ( | void | ) | const [inline] |
retrieve the left and right viewports. They will be the same as the ones you passed to the init method in the DUAL_OUTPUT mode. They will be different in case of the modes using the compositor.
Definition at line 273 of file StereoManager.h.
| Viewport* Ogre::StereoManager::getRightViewport | ( | void | ) | const [inline] |
Definition at line 274 of file StereoManager.h.
| StereoMode Ogre::StereoManager::getStereoMode | ( | void | ) | const [inline] |
Definition at line 218 of file StereoManager.h.
| void StereoManager::getVisibilityMask | ( | uint32 & | outLeftMask, | |
| uint32 & | outRightMask | |||
| ) | const |
Definition at line 387 of file StereoManager.cpp.
| void StereoManager::init | ( | Viewport * | leftViewport, | |
| Viewport * | rightViewport, | |||
| StereoMode | mode | |||
| ) |
Definition at line 180 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 188 of file StereoManager.cpp.
| void StereoManager::init | ( | Viewport * | leftViewport, | |
| Viewport * | rightViewport | |||
| ) | [protected] |
Definition at line 196 of file StereoManager.cpp.
| void StereoManager::initCompositor | ( | Viewport * | viewport, | |
| const String & | materialName, | |||
| Viewport *& | out_left, | |||
| Viewport *& | out_right | |||
| ) | [protected] |
Definition at line 270 of file StereoManager.cpp.
| void StereoManager::initListeners | ( | Viewport * | leftViewport, | |
| Viewport * | rightViewport | |||
| ) | [protected] |
Definition at line 239 of file StereoManager.cpp.
| void StereoManager::inverseStereo | ( | bool | inverse | ) |
Inverse the left eye and the right eye viewports
Definition at line 499 of file StereoManager.cpp.
| bool Ogre::StereoManager::isFocalLengthInfinite | ( | void | ) | const [inline] |
Definition at line 238 of file StereoManager.h.
| bool Ogre::StereoManager::isStereoInversed | ( | void | ) | const [inline] |
Definition at line 260 of file StereoManager.h.
| StereoManager::StereoMode StereoManager::loadConfig | ( | const String & | filename | ) |
Definition at line 657 of file StereoManager.cpp.
| void StereoManager::removeRenderTargetDependency | ( | RenderTarget * | renderTarget | ) |
Definition at line 401 of file StereoManager.cpp.
| void StereoManager::saveConfig | ( | const String & | filename | ) | const |
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 617 of file StereoManager.cpp.
| void Ogre::StereoManager::setCamera | ( | Camera * | cam | ) | [inline] |
Definition at line 221 of file StereoManager.h.
| void StereoManager::setCustomProjectonMatrices | ( | bool | enable, | |
| const Matrix4 & | leftMatrix, | |||
| const Matrix4 & | rightMatrix | |||
| ) |
Use a custom projections matrix for each eye
Definition at line 506 of file StereoManager.cpp.
| void Ogre::StereoManager::setEyesSpacing | ( | Real | l | ) | [inline] |
Definition at line 224 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 446 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 477 of file StereoManager.cpp.
| void Ogre::StereoManager::setScreenWidth | ( | Real | w | ) | [inline] |
Definition at line 251 of file StereoManager.h.
| void StereoManager::setVisibilityMask | ( | uint32 | leftMask, | |
| uint32 | rightMask | |||
| ) |
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. It is usefull if you want to display some objects only for the right eye and some objects only for the left eye .
Definition at line 373 of file StereoManager.cpp.
| void StereoManager::shutdown | ( | void | ) |
Shutdown and re-init the stereo manager to change stereo mode
Definition at line 353 of file StereoManager.cpp.
| void StereoManager::shutdownCompositor | ( | void | ) | [protected] |
Definition at line 320 of file StereoManager.cpp.
| void StereoManager::shutdownListeners | ( | void | ) | [protected] |
Definition at line 256 of file StereoManager.cpp.
| void StereoManager::toggleDebugPlane | ( | void | ) |
Definition at line 527 of file StereoManager.cpp.
| void StereoManager::updateAllDependentRenderTargets | ( | bool | isLeftEye | ) | [protected] |
Definition at line 409 of file StereoManager.cpp.
| void StereoManager::updateCamera | ( | Real | delta | ) | [protected] |
Definition at line 492 of file StereoManager.cpp.
| void StereoManager::updateDebugPlane | ( | void | ) |
Definition at line 585 of file StereoManager.cpp.
| void StereoManager::useScreenWidth | ( | Real | w | ) |
Definition at line 484 of file StereoManager.cpp.
friend class DeviceLostListener [friend] |
Definition at line 130 of file StereoManager.h.
friend class StereoCameraListener [friend] |
Definition at line 121 of file StereoManager.h.
bool Ogre::StereoManager::mAreOverlaysEnabled [protected] |
Definition at line 153 of file StereoManager.h.
StereoModeList Ogre::StereoManager::mAvailableModes [protected] |
Definition at line 140 of file StereoManager.h.
Camera* Ogre::StereoManager::mCamera [protected] |
Definition at line 132 of file StereoManager.h.
CompositorInstance* Ogre::StereoManager::mCompositorInstance [protected] |
Definition at line 137 of file StereoManager.h.
Viewport* Ogre::StereoManager::mCompositorViewport [protected] |
Definition at line 154 of file StereoManager.h.
Entity* Ogre::StereoManager::mDebugPlane [protected] |
Definition at line 163 of file StereoManager.h.
SceneNode* Ogre::StereoManager::mDebugPlaneNode [protected] |
Definition at line 164 of file StereoManager.h.
Definition at line 134 of file StereoManager.h.
Real Ogre::StereoManager::mEyesSpacing [protected] |
Definition at line 142 of file StereoManager.h.
Real Ogre::StereoManager::mFocalLength [protected] |
Definition at line 143 of file StereoManager.h.
bool Ogre::StereoManager::mFocalLengthInfinite [protected] |
Definition at line 144 of file StereoManager.h.
bool Ogre::StereoManager::mIsCustomProjection [protected] |
Definition at line 148 of file StereoManager.h.
bool Ogre::StereoManager::mIsFocalPlaneFixed [protected] |
Definition at line 145 of file StereoManager.h.
bool Ogre::StereoManager::mIsInversed [protected] |
Definition at line 147 of file StereoManager.h.
Definition at line 133 of file StereoManager.h.
Matrix4 Ogre::StereoManager::mLeftCustomProjection [protected] |
Definition at line 149 of file StereoManager.h.
uint32 Ogre::StereoManager::mLeftMask [protected] |
Definition at line 136 of file StereoManager.h.
String Ogre::StereoManager::mLeftMaterialName [protected] |
Definition at line 165 of file StereoManager.h.
Viewport* Ogre::StereoManager::mLeftViewport [protected] |
Definition at line 135 of file StereoManager.h.
Definition at line 159 of file StereoManager.h.
Definition at line 133 of file StereoManager.h.
Matrix4 Ogre::StereoManager::mRightCustomProjection [protected] |
Definition at line 149 of file StereoManager.h.
uint32 Ogre::StereoManager::mRightMask [protected] |
Definition at line 136 of file StereoManager.h.
String Ogre::StereoManager::mRightMaterialName [protected] |
Definition at line 165 of file StereoManager.h.
Viewport * Ogre::StereoManager::mRightViewport [protected] |
Definition at line 135 of file StereoManager.h.
SceneManager* Ogre::StereoManager::mSceneMgr [protected] |
Definition at line 162 of file StereoManager.h.
Real Ogre::StereoManager::mScreenWidth [protected] |
Definition at line 146 of file StereoManager.h.
StereoMode Ogre::StereoManager::mStereoMode [protected] |
Definition at line 141 of file StereoManager.h.
1.6.3