35 #include <OgreViewport.h>
36 #include <OgreCamera.h>
37 #include <OgreRenderWindow.h>
38 #include <OgreStringConverter.h>
39 #include <OgreGpuProgramManager.h>
40 #include <OgreRenderTargetListener.h>
45 #if OGRE_PLATFORM == OGRE_PLATFORM_LINUX
62 , overlays_enabled_(true)
63 , background_color_(
Ogre::ColourValue::Black)
64 , stereo_enabled_(false)
65 , rendering_stereo_(false)
66 , left_camera_(nullptr)
67 , right_camera_(nullptr)
68 , right_viewport_(nullptr)
77 #if OGRE_STEREO_ENABLE
111 #if OGRE_STEREO_ENABLE
113 viewport_->setDrawBuffer(Ogre::CBT_BACK_LEFT);
130 #if OGRE_STEREO_ENABLE
131 viewport_->setDrawBuffer(Ogre::CBT_BACK);
146 Ogre::Viewport* viewport = evt.source;
148 const Ogre::Vector2& offset =
camera_->getFrustumOffset();
149 const Ogre::Vector3 pos =
camera_->getPosition();
150 const Ogre::Vector3 right =
camera_->getRight();
151 const Ogre::Vector3 up =
camera_->getUp();
161 Ogre::Vector3 newpos = pos + right * offset.x + up * offset.y;
176 Ogre::Vector3 newpos = pos - right * offset.x - up * offset.y;
185 ROS_WARN(
"Begin rendering to unknown viewport.");
191 Ogre::Viewport* viewport = evt.source;
203 ROS_WARN(
"End rendering to unknown viewport.");
244 viewport_->setOverlaysEnabled(overlays_enabled);
254 viewport_->setBackgroundColour(background_color);
265 camera_->setAspectRatio(Ogre::Real(width()) / Ogre::Real(height()));
268 right_camera_->setAspectRatio(Ogre::Real(width()) / Ogre::Real(height()));
271 if (
camera_->getProjectionType() == Ogre::PT_ORTHOGRAPHIC)
277 camera_->setCustomProjectionMatrix(
true, proj);