46 #include <visp3/core/vpConfig.h>
51 #include <visp3/core/vpImage.h>
52 #include <visp3/core/vpImageConvert.h>
53 #include <visp3/core/vpRGBa.h>
55 #include <visp3/core/vpHomogeneousMatrix.h>
56 #include <visp3/core/vpImageTools.h>
57 #include <visp3/core/vpRotationMatrix.h>
58 #include <visp3/core/vpRxyzVector.h>
61 #include <OgreFrameListener.h>
63 #if (VISP_HAVE_OGRE_VERSION >= (1<<16 | 10 <<8 | 0))
64 #include <Bites/OgreBitesConfigDialog.h>
67 #if (VISP_HAVE_OGRE_VERSION >= (1<<16 | 11<<8 | 0))
68 #include <Bites/OgreWindowEventUtilities.h>
71 #if (VISP_HAVE_OGRE_VERSION >= (1<<16 | 12 <<8 | 0))
72 #include <OgreComponents.h>
73 #elif (VISP_HAVE_OGRE_VERSION >= (1<<16 | 10 <<8 | 0))
74 #include <OgreBuildSettings.h>
77 #if defined(OGRE_BUILD_COMPONENT_RTSHADERSYSTEM) & (VISP_HAVE_OGRE_VERSION >= (1<<16 | 10 <<8 | 0))
78 #include <RTShaderSystem/OgreShaderGenerator.h>
79 #include <Bites/OgreSGTechniqueResolverListener.h>
104 class VISP_EXPORT
vpAROgre :
public Ogre::FrameListener,
105 public Ogre::WindowEventListener
108 public OIS::KeyListener
113 const char *resourcePath =
114 #ifdef VISP_HAVE_OGRE_RESOURCES_PATH
115 VISP_HAVE_OGRE_RESOURCES_PATH,
119 const char *pluginsPath =
120 #ifdef VISP_HAVE_OGRE_PLUGINS_PATH
121 VISP_HAVE_OGRE_PLUGINS_PATH
142 mOptionalResourceLocation.push_back(resourceLocation);
145 void addRotation(
const std::string &sceneName,
const vpRotationMatrix &wRo);
147 bool continueRendering(
void);
149 virtual bool customframeStarted(
const Ogre::FrameEvent &evt);
151 virtual bool customframeEnded(
const Ogre::FrameEvent &evt);
180 virtual void init(
vpImage<vpRGBa> &I,
bool bufferedKeys =
false,
bool hidden =
false);
193 virtual bool keyPressed(
const OIS::KeyEvent & ) {
return true; }
200 void load(
const std::string &entityName,
const std::string &model);
216 updateCameraProjection();
219 void setMaterial(
const std::string &entityName,
const std::string &materialName);
228 mNearClipping = dist;
229 updateCameraProjection();
243 inline void setPluginsPath(
const char *pluginsPath) { mPluginsPath = pluginsPath; }
259 inline void setResourcePath(
const char *resourcePath) { mResourcePath = resourcePath; }
261 void setRotation(
const std::string &sceneName,
const vpRotationMatrix &wRo);
263 void setScale(
const std::string &sceneName,
float factorx,
float factory,
float factorz);
276 void setVisibility(
const std::string &sceneName,
bool isVisible);
299 if (mWindow ==
nullptr) {
302 mWindow->reposition(
static_cast<int>(win_x),
static_cast<int>(win_y));
305 virtual bool windowClosing(Ogre::RenderWindow *rw) VP_OVERRIDE;
307 virtual void windowClosed(Ogre::RenderWindow *rw) VP_OVERRIDE;
310 virtual void init(
bool bufferedKeys =
false,
bool hidden =
false);
311 virtual void createCamera(
void);
319 virtual void closeOIS(
void);
326 virtual bool updateScene(
const Ogre::FrameEvent & ) {
return true; };
346 mSceneMgr->destroyAllCameras();
347 mSceneMgr->clearScene();
348 mRoot->destroySceneManager(mSceneMgr);
354 virtual void updateCameraProjection(
void);
364 bool frameStarted(
const Ogre::FrameEvent &evt);
366 bool frameEnded(
const Ogre::FrameEvent &evt);
368 bool stopTest(
const Ogre::FrameEvent &evt);
370 bool initialiseRTShaderSystem();
372 void destroyRTShaderSystem();
396 #if defined(OGRE_BUILD_COMPONENT_RTSHADERSYSTEM) & (VISP_HAVE_OGRE_VERSION >= (1<<16 | 10 <<8 | 0))
397 Ogre::RTShader::ShaderGenerator *mShaderGenerator;
398 OgreBites::SGTechniqueResolverListener *mMaterialMgrListener;
Implementation of an augmented reality viewer using Ogre3D 3rd party.
OIS::InputManager * mInputManager
double getNearClippingDistance() const
virtual bool updateScene(const Ogre::FrameEvent &)
OIS::Keyboard * mKeyboard
void setWindowName(const Ogre::String &n)
virtual bool processInputEvent(const Ogre::FrameEvent &)
virtual bool keyReleased(const OIS::KeyEvent &)
unsigned int mBackgroundWidth
void setShowConfigDialog(bool showConfigDialog)
vpImage< vpRGBa > mImageRGBA
vpImage< unsigned char > mImage
void setFarClippingDistance(const double &dist)
void setNearClippingDistance(const double &dist)
Ogre::String mSceneManagerName
virtual bool keyPressed(const OIS::KeyEvent &)
void setWindowPosition(unsigned int win_x, unsigned int win_y)
virtual bool destroyScene(void)
static unsigned int sRTSSUsers
unsigned int mBackgroundHeight
void addResource(const std::string &resourceLocation)
Ogre::String mPluginsPath
Ogre::Rectangle2D * mBackground
virtual void createScene(void)
Ogre::SceneManager * getSceneManager()
unsigned int mWindowHeight
Ogre::Camera * getCamera()
void setPluginsPath(const char *pluginsPath)
double getFarClippingDistance() const
std::list< std::string > mOptionalResourceLocation
Ogre::SceneManager * mSceneMgr
Ogre::HardwarePixelBufferSharedPtr mPixelBuffer
Ogre::String mResourcePath
Ogre::RenderWindow * mWindow
void setResourcePath(const char *resourcePath)
unsigned int mWindowWidth
Generic class defining intrinsic camera parameters.
error that can be emitted by ViSP classes.
@ notInitialized
Used to indicate that a parameter is not initialized.
Implementation of an homogeneous matrix and operations on such kind of matrices.
Implementation of a rotation matrix and operations on such kind of matrices.
Class that consider the case of a translation vector.