44 #include <visp3/core/vpConfig.h>
48 #include <visp3/ar/vpAROgre.h>
49 #include <visp3/core/vpIoTools.h>
51 #include <OgreRectangle2D.h>
53 #if (VISP_HAVE_OGRE_VERSION >= (1<<16 | 11<<8 | 0))
54 #include <OgreMatrix4.h>
55 #include <Bites/OgreWindowEventUtilities.h>
56 typedef OgreBites::WindowEventUtilities OgreWindowEventUtilities;
58 typedef Ogre::WindowEventUtilities OgreWindowEventUtilities;
81 const char *pluginsPath)
82 : name(
"ViSP - Augmented Reality"), mInitialized(false), mRoot(0), mCamera(0), mSceneMgr(0), mWindow(0), mResourcePath(resourcePath),
83 mPluginsPath(pluginsPath),
85 mInputManager(0), mKeyboard(0),
88 mImageRGBA(), mImage(), mPixelBuffer(), mBackground(nullptr), mBackgroundHeight(0), mBackgroundWidth(0),
89 mWindowHeight(height), mWindowWidth(width), windowHidden(false), mNearClipping(0.001), mFarClipping(200), mcam(cam),
90 mshowConfigDialog(true), mOptionalResourceLocation()
92 std::stringstream nameSceneManager;
93 nameSceneManager <<
"SceneManagerInstance" <<
sID;
96 #if defined(OGRE_BUILD_COMPONENT_RTSHADERSYSTEM) & (VISP_HAVE_OGRE_VERSION >= (1<<16 | 10 <<8 | 0))
97 mMaterialMgrListener = NULL;
98 mShaderGenerator = NULL;
105 bool vpAROgre::initialiseRTShaderSystem()
107 #if defined(OGRE_BUILD_COMPONENT_RTSHADERSYSTEM) & (VISP_HAVE_OGRE_VERSION >= (1<<16 | 10 <<8 | 0))
108 if (Ogre::RTShader::ShaderGenerator::initialize() || (
sRTSSUsers > 0)) {
110 mShaderGenerator = Ogre::RTShader::ShaderGenerator::getSingletonPtr();
113 if (!mMaterialMgrListener) {
114 mMaterialMgrListener =
new OgreBites::SGTechniqueResolverListener(mShaderGenerator);
115 Ogre::MaterialManager::getSingleton().addListener(mMaterialMgrListener);
126 void vpAROgre::destroyRTShaderSystem()
128 #if defined(OGRE_BUILD_COMPONENT_RTSHADERSYSTEM) & (VISP_HAVE_OGRE_VERSION >= (1<<16 | 10 <<8 | 0))
130 Ogre::MaterialManager::getSingleton().setActiveScheme(Ogre::MaterialManager::DEFAULT_SCHEME_NAME);
133 if (mMaterialMgrListener != NULL) {
134 Ogre::MaterialManager::getSingleton().removeListener(mMaterialMgrListener);
135 delete mMaterialMgrListener;
136 mMaterialMgrListener = NULL;
140 if (mShaderGenerator != NULL) {
145 Ogre::RTShader::ShaderGenerator::destroy();
147 mShaderGenerator = NULL;
199 #if (VISP_HAVE_OGRE_VERSION >= (13 <<16 | 0 <<8 | 0))
255 #if (VISP_HAVE_OGRE_VERSION >= (13 <<16 | 0 <<8 | 0))
297 bool pluginsFileExists =
false;
298 std::string pluginFile;
300 for (
size_t i = 0; i < plugingsPaths.size(); i++) {
301 #if defined(NDEBUG) || !defined(_WIN32)
302 pluginFile = plugingsPaths[i] +
"/plugins.cfg";
304 pluginFile = plugingsPaths[i] +
"/plugins_d.cfg";
308 pluginsFileExists =
true;
312 if (!pluginsFileExists) {
313 std::string errorMsg = std::string(
"Error: the requested plugins file \"")
314 #if defined(NDEBUG) || !defined(_WIN32)
315 +std::string(
"plugins.cfg")
317 + std::string(
"plugins_d.cfg")
319 + std::string(
"\" doesn't exist in ") + std::string(
mPluginsPath);
320 std::cout << errorMsg << std::endl;
324 std::cout <<
"######################### Load plugin file: " << pluginFile << std::endl;
326 if (Ogre::Root::getSingletonPtr() ==
nullptr) {
327 mRoot =
new Ogre::Root(pluginFile,
"ogre.cfg",
"Ogre.log");
330 mRoot = Ogre::Root::getSingletonPtr();
336 mRoot->restoreConfig();
337 #if (VISP_HAVE_OGRE_VERSION < (1<<16 | 10<<8 | 0))
338 bool isOK =
mRoot->showConfigDialog();
340 bool isOK =
mRoot->showConfigDialog(OgreBites::getNativeConfigDialog());
347 if (!
mRoot->restoreConfig()) {
352 if (!
mRoot->isInitialised()) {
354 const Ogre::RenderSystemList &lRenderSystemList =
mRoot->getAvailableRenderers();
355 if (lRenderSystemList.size() == 0) {
356 throw "ConfigDialog aborted";
359 Ogre::RenderSystem *lRenderSystem = lRenderSystemList.at(0);
360 std::cout <<
"Using " << lRenderSystem->getName() <<
" as renderer." << std::endl;
361 mRoot->setRenderSystem(lRenderSystem);
364 mRoot->initialise(
false);
367 #if (VISP_HAVE_OGRE_VERSION < (1<<16 | 10<<8 | 0))
369 #elif (VISP_HAVE_OGRE_VERSION < (14<<16 | 0<<8 | 0))
375 bool fullscreen =
false;
376 Ogre::NameValuePairList misc;
377 Ogre::ConfigOptionMap config =
mRoot->getRenderSystem()->getConfigOptions();
378 Ogre::ConfigOptionMap::const_iterator it = config.begin();
380 while (it != config.end()) {
381 Ogre::String leftconf = (*it).first;
382 Ogre::String rightconf = (*it).second.currentValue;
384 if (leftconf ==
"Video Mode") {
386 std::stringstream ss(rightconf.c_str());
390 std::cout <<
"Cannot read Ogre video mode" << std::endl;
398 else if (leftconf ==
"Full Screen") {
399 if (canInit && (rightconf ==
"Yes")) {
404 misc[leftconf] = rightconf;
412 #if (OGRE_VERSION >= (1 << 16 | 8 << 8 | 1))
413 misc[
"hidden"] =
"true";
431 bool resourcesFileExists =
false;
432 std::string resourceFile;
434 for (
size_t i = 0; i < resourcesPaths.size(); i++) {
435 resourceFile = resourcesPaths[i] +
"/resources.cfg";
439 resourcesFileExists =
true;
440 std::cout <<
"######################### Load resource file: " << resourceFile << std::endl;
442 cf.load(resourceFile);
444 #if (VISP_HAVE_OGRE_VERSION < (1<<16 | 11<<8 | 0))
445 Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
447 Ogre::String secName, typeName, archName;
448 while (seci.hasMoreElements()) {
449 secName = seci.peekNextKey();
450 Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();
451 Ogre::ConfigFile::SettingsMultiMap::iterator i;
452 for (i = settings->begin(); i != settings->end(); ++i) {
454 archName = i->second;
456 if (doesResourceExist) {
457 if (!Ogre::ResourceGroupManager::getSingleton().resourceLocationExists(archName, secName)) {
458 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(archName, typeName, secName);
461 std::cout <<
"INFO: Resource location \"" << archName <<
"\" of type \"" << typeName <<
"\" has already been added to the list of known resource locations." << std::endl;
464 else if (!doesResourceExist) {
465 std::cout <<
"INFO: Resource \"" << archName <<
"\" of type \"" << typeName <<
"\" does not exist." << std::endl;
470 const Ogre::ConfigFile::SettingsBySection_ §ionsNamesAndSettigns = cf.getSettingsBySection();
471 Ogre::String secName, typeName, archName;
472 for (std::pair<Ogre::String, Ogre::ConfigFile::SettingsMultiMap> name_settings : sectionsNamesAndSettigns) {
473 secName = name_settings.first;
474 Ogre::ConfigFile::SettingsMultiMap settings = name_settings.second;
475 Ogre::ConfigFile::SettingsMultiMap::iterator i;
476 for (i = settings.begin(); i != settings.end(); ++i) {
478 archName = i->second;
480 if (doesResourceExist) {
481 if (!Ogre::ResourceGroupManager::getSingleton().resourceLocationExists(archName, secName)) {
482 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(archName, typeName, secName);
485 std::cout <<
"INFO: Resource location \"" << archName <<
"\" of type \"" << typeName <<
"\" has already been added to the list of known resource locations." << std::endl;
488 else if (!doesResourceExist) {
489 std::cout <<
"INFO: Resource \"" << archName <<
"\" of type \"" << typeName <<
"\" does not exist." << std::endl;
495 if (!resourcesFileExists) {
496 std::string errorMsg = std::string(
"Error: the requested resource file \"resources.cfg\"") +
497 std::string(
"doesn't exist in ") + std::string(
mResourcePath);
499 std::cout << errorMsg << std::endl << std::flush;
505 std::cout <<
"##################### add optional resource locations given by the user" << std::endl;
508 const Ogre::String typeName(
"FileSystem");
510 if (doesResourceExist) {
511 if (!Ogre::ResourceGroupManager::getSingleton().resourceLocationExists(*iter, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME)) {
512 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(*iter, typeName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
515 std::cout <<
"INFO: Resource location \"" << *iter <<
"\" of type \"" << typeName <<
"\" has already been added to the list of known resource locations." << std::endl;
518 else if (!doesResourceExist) {
519 std::cout <<
"INFO: Resource \"" << *iter <<
"\" of type \"" << typeName <<
"\" does not exist." << std::endl;
524 #if (VISP_HAVE_OGRE_VERSION >= (1<<16 | 10 <<8 | 0))
526 bool hasInitializedTheRTSS = initialiseRTShaderSystem();
527 if (!hasInitializedTheRTSS) {
528 std::cout <<
"[vpAROgre::init] RTSS is not available." << std::endl;
533 std::cout <<
"##################### add resources" << std::endl;
534 Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
551 viewPort->setClearEveryFrame(
true);
559 mRoot->addFrameListener(
this);
562 OgreWindowEventUtilities::addWindowEventListener(
mWindow,
this);
563 OgreWindowEventUtilities::_addRenderWindow(
mWindow);
567 Ogre::LogManager::getSingletonPtr()->logMessage(
"*** Initializing OIS ***");
570 size_t windowHnd = 0;
571 std::ostringstream windowHndStr;
573 mWindow->getCustomAttribute(
"WINDOW", &windowHnd);
574 windowHndStr << windowHnd;
575 pl.insert(std::make_pair(std::string(
"WINDOW"), windowHndStr.str()));
577 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)))
578 pl.insert(std::make_pair(std::string(
"x11_keyboard_grab"), std::string(
"false")));
585 mKeyboard =
static_cast<OIS::Keyboard *
>(
mInputManager->createInputObject(OIS::OISKeyboard, bufferedKeys));
593 Ogre::TexturePtr Texture = Ogre::TextureManager::getSingleton().createManual(
594 "rtf", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D,
mWindow->getWidth(),
595 mWindow->getHeight(), 0, Ogre::PF_R8G8B8A8, Ogre::TU_RENDERTARGET);
597 Ogre::RenderTexture *RTarget = Texture->getBuffer()->getRenderTarget();
599 RTarget->getViewport(0)->setClearEveryFrame(
true);
600 RTarget->getViewport(0)->setOverlaysEnabled(
false);
602 catch (
const Ogre::Exception &e) {
603 std::cout <<
"Info: Texture rtf is already known by the resource manager." << std::endl;
617 #if (VISP_HAVE_OGRE_VERSION >= (1<<16 | 11<<8 | 0))
628 destroyRTShaderSystem();
631 OgreWindowEventUtilities::removeWindowEventListener(
mWindow,
this);
632 OgreWindowEventUtilities::_removeRenderWindow(
mWindow);
637 bool hasNoMoreElements =
false;
638 #if (VISP_HAVE_OGRE_VERSION < (1<<16 | 11<<8 | 0))
639 if (Ogre::Root::getSingletonPtr()) {
640 hasNoMoreElements = !Ogre::Root::getSingletonPtr()->getSceneManagerIterator().hasMoreElements();
643 if (Ogre::Root::getSingletonPtr()) {
644 hasNoMoreElements = Ogre::Root::getSingletonPtr()->getSceneManagers().empty();
648 if (hasNoMoreElements &&
mRoot) {
659 bool vpAROgre::stopTest(
const Ogre::FrameEvent &evt)
679 bool vpAROgre::frameStarted(
const Ogre::FrameEvent &evt)
685 OgreWindowEventUtilities::messagePump();
690 return stopTest(evt);
701 bool vpAROgre::frameEnded(
const Ogre::FrameEvent &evt)
708 return stopTest(evt);
730 if (
mKeyboard->isKeyDown(OIS::KC_ESCAPE))
789 return mRoot->renderOneFrame();
806 return mRoot->renderOneFrame();
861 Ogre::Entity *newEntity =
mSceneMgr->createEntity(entityName, model);
862 Ogre::SceneNode *newNode =
mSceneMgr->getRootSceneNode()->createChildSceneNode(entityName);
863 newNode->attachObject(newEntity);
874 Ogre::Entity *entity =
mSceneMgr->getEntity(entityName);
875 entity->setMaterialName(materialName);
887 Ogre::SceneNode *node =
mSceneMgr->getSceneNode(sceneName);
888 node->setPosition((Ogre::Real)wTo[0], (Ogre::Real)wTo[1], (Ogre::Real)wTo[2]);
898 Ogre::Vector3 translation =
mSceneMgr->getSceneNode(sceneName)->getPosition();
899 return vpTranslationVector((Ogre::Real)translation[0], (Ogre::Real)translation[1], (Ogre::Real)translation[2]);
910 mSceneMgr->getSceneNode(sceneName)->resetOrientation();
912 Ogre::Matrix3 rotationOgre = Ogre::Matrix3((Ogre::Real)wRo[0][0], (Ogre::Real)wRo[0][1], (Ogre::Real)wRo[0][2],
913 (Ogre::Real)wRo[1][0], (Ogre::Real)wRo[1][1], (Ogre::Real)wRo[1][2],
914 (Ogre::Real)wRo[2][0], (Ogre::Real)wRo[2][1], (Ogre::Real)wRo[2][2]);
915 Ogre::Quaternion q(rotationOgre);
916 mSceneMgr->getSceneNode(sceneName)->rotate(q);
927 Ogre::Matrix3 rotationOgre = Ogre::Matrix3((Ogre::Real)wRo[0][0], (Ogre::Real)wRo[0][1], (Ogre::Real)wRo[0][2],
928 (Ogre::Real)wRo[1][0], (Ogre::Real)wRo[1][1], (Ogre::Real)wRo[1][2],
929 (Ogre::Real)wRo[2][0], (Ogre::Real)wRo[2][1], (Ogre::Real)wRo[2][2]);
930 Ogre::Quaternion q(rotationOgre);
931 mSceneMgr->getSceneNode(sceneName)->rotate(q);
961 mSceneMgr->getSceneNode(sceneName)->setVisible(isVisible);
974 mSceneMgr->getSceneNode(sceneName)->scale(Ogre::Vector3(1, 1, 1) /
mSceneMgr->getSceneNode(sceneName)->getScale());
976 mSceneMgr->getSceneNode(sceneName)->scale(Ogre::Vector3(factorx, factory, factorz));
995 mBackground->setBoundingBox(Ogre::AxisAlignedBox(-100000.0 * Ogre::Vector3::UNIT_SCALE,
996 100000.0 * Ogre::Vector3::UNIT_SCALE));
999 Ogre::MaterialManager::getSingleton().setDefaultTextureFiltering(Ogre::TFO_NONE);
1000 Ogre::MaterialManager::getSingleton().setDefaultAnisotropy(1);
1005 if (
mRoot->getRenderSystem()->getName() ==
"OpenGL Rendering Subsystem") {
1007 Ogre::TextureManager::getSingleton().createManual(
1008 "BackgroundTexture", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D,
1012 Ogre::PF_BYTE_L, Ogre::TU_DYNAMIC_WRITE_ONLY_DISCARDABLE);
1014 catch (
const Ogre::Exception &e) {
1015 std::cout <<
"Info: Texture BackgroundTexture is already known by the resource manager." << std::endl;
1020 Ogre::TextureManager::getSingleton().createManual(
1021 "BackgroundTexture", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D,
1025 Ogre::PF_BYTE_L, Ogre::TU_DEFAULT);
1027 catch (
const Ogre::Exception &e) {
1028 std::cout <<
"Info: Texture BackgroundTexture is already known by the resource manager." << std::endl;
1033 Ogre::TexturePtr dynTexPtr = Ogre::TextureManager::getSingleton().getByName(
"BackgroundTexture");
1043 Ogre::MaterialPtr Backgroundmaterial = Ogre::MaterialManager::getSingleton().create(
1044 "BackgroundMaterial", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
1045 Ogre::Technique *Backgroundtechnique = Backgroundmaterial->createTechnique();
1046 Backgroundtechnique->createPass();
1047 Backgroundmaterial->getTechnique(0)->getPass(0)->setLightingEnabled(
false);
1048 Backgroundmaterial->getTechnique(0)->getPass(0)->setDepthCheckEnabled(
false);
1049 Backgroundmaterial->getTechnique(0)->getPass(0)->setDepthWriteEnabled(
false);
1050 Backgroundmaterial->getTechnique(0)->getPass(0)->createTextureUnitState(
"BackgroundTexture");
1051 #if (VISP_HAVE_OGRE_VERSION >= (1<<16 | 11<<8 | 0))
1057 catch (
const Ogre::Exception &e) {
1058 std::cout <<
"Info: Material BackgroundMaterial is already known by the resource manager." << std::endl;
1062 Ogre::SceneNode *BackgroundNode =
mSceneMgr->getRootSceneNode()->createChildSceneNode(
"BackgoundNode");
1077 mBackground->setBoundingBox(Ogre::AxisAlignedBox(-100000.0 * Ogre::Vector3::UNIT_SCALE,
1078 100000.0 * Ogre::Vector3::UNIT_SCALE));
1081 Ogre::MaterialManager::getSingleton().setDefaultTextureFiltering(Ogre::TFO_NONE);
1082 Ogre::MaterialManager::getSingleton().setDefaultAnisotropy(1);
1087 if (
mRoot->getRenderSystem()->getName() ==
"OpenGL Rendering Subsystem") {
1089 Ogre::TextureManager::getSingleton().createManual(
1090 "BackgroundTexture", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D,
1094 Ogre::PF_BYTE_BGRA, Ogre::TU_DYNAMIC_WRITE_ONLY_DISCARDABLE);
1096 catch (
const Ogre::Exception &e) {
1097 std::cout <<
"Info: Texture BackgroundTexture is already known by the resource manager." << std::endl;
1103 Ogre::TextureManager::getSingleton().createManual(
1104 "BackgroundTexture", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D,
1108 Ogre::PF_BYTE_BGRA, Ogre::TU_DEFAULT);
1110 catch (
const Ogre::Exception &e) {
1111 std::cout <<
"Info: Texture BackgroundTexture is already known by the resource manager." << std::endl;
1116 Ogre::TexturePtr dynTexPtr = Ogre::TextureManager::getSingleton().getByName(
"BackgroundTexture");
1128 Ogre::MaterialPtr Backgroundmaterial = Ogre::MaterialManager::getSingleton().create(
1129 "BackgroundMaterial", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
1130 Ogre::Technique *Backgroundtechnique = Backgroundmaterial->createTechnique();
1131 Backgroundtechnique->createPass();
1132 Backgroundmaterial->getTechnique(0)->getPass(0)->setLightingEnabled(
false);
1133 Backgroundmaterial->getTechnique(0)->getPass(0)->setDepthCheckEnabled(
false);
1134 Backgroundmaterial->getTechnique(0)->getPass(0)->setDepthWriteEnabled(
false);
1135 Backgroundmaterial->getTechnique(0)->getPass(0)->createTextureUnitState(
"BackgroundTexture");
1137 #if (VISP_HAVE_OGRE_VERSION >= (1<<16 | 11<<8 | 0))
1143 catch (
const Ogre::Exception &e) {
1144 std::cout <<
"Info: Material BackgroundMaterial is already known by the resource manager." << std::endl;
1146 mBackground->setRenderQueueGroup(Ogre::RENDER_QUEUE_BACKGROUND);
1149 Ogre::SceneNode *BackgroundNode =
mSceneMgr->getRootSceneNode()->createChildSceneNode(
"BackgoundNode");
1162 #ifdef VISP_HAVE_OIS
1180 Ogre::Real f, n, f_m_n, f_p_n, px, py, u0, v0;
1183 f_m_n = (Ogre::Real)(f - n);
1184 f_p_n = (Ogre::Real)(f + n);
1189 Ogre::Matrix4 Projection = Ogre::Matrix4(
1192 (Ogre::Real)(-1.0 * f_p_n / f_m_n), (Ogre::Real)(-2.0 * f * n / f_m_n), 0, 0, -1.0, 0);
1193 mCamera->setCustomProjectionMatrix(
true, Projection);
1207 const Ogre::PixelBox &pixelBox =
mPixelBuffer->getCurrentLock();
1209 Ogre::uint8 *pDest =
static_cast<Ogre::uint8 *
>(pixelBox.data);
1227 const Ogre::PixelBox &pixelBox =
mPixelBuffer->getCurrentLock();
1229 Ogre::uint8 *pDest =
static_cast<Ogre::uint8 *
>(pixelBox.data);
1239 *pDest++ = I[i][j].B;
1240 *pDest++ = I[i][j].G;
1241 *pDest++ = I[i][j].R;
1261 Ogre::Matrix4 ModelView
1264 = Ogre::Matrix4((Ogre::Real)cMw[0][0], (Ogre::Real)cMw[0][1], (Ogre::Real)cMw[0][2], (Ogre::Real)cMw[0][3],
1265 (Ogre::Real)-cMw[1][0], (Ogre::Real)-cMw[1][1], (Ogre::Real)-cMw[1][2], (Ogre::Real)-cMw[1][3],
1266 (Ogre::Real)-cMw[2][0], (Ogre::Real)-cMw[2][1], (Ogre::Real)-cMw[2][2], (Ogre::Real)-cMw[2][3],
1267 (Ogre::Real)0, (Ogre::Real)0, (Ogre::Real)0, (Ogre::Real)1);
1268 #if (VISP_HAVE_OGRE_VERSION >= (1 << 16 | 11 << 8 | 0))
1269 Ogre::Affine3 ModelViewAsAffine(ModelView);
1270 mCamera->setCustomViewMatrix(
true, ModelViewAsAffine);
1272 mCamera->setCustomViewMatrix(
true, ModelView);
1285 Ogre::TexturePtr dynTexPtr = Ogre::TextureManager::getSingleton().getByName(
"rtf");
1291 Ogre::RenderTexture *RTarget = dynTexPtr->getBuffer()->getRenderTarget();
1299 const Ogre::PixelBox &pixelBox =
mPixelBuffer->getCurrentLock();
1300 dynTexPtr->getBuffer()->blitToMemory(pixelBox);
1301 Ogre::uint8 *pDest =
static_cast<Ogre::uint8 *
>(pixelBox.data);
1303 for (
unsigned int i = 0; i < I.
getHeight(); i++) {
1304 for (
unsigned int j = 0; j < I.
getWidth(); j++) {
1306 I[i][j].B = *pDest++;
1307 I[i][j].G = *pDest++;
1308 I[i][j].R = *pDest++;
1309 I[i][j].A = *pDest++;
1320 #elif !defined(VISP_BUILD_SHARED_LIBS)
1322 void dummy_vpAROgre() { };
OIS::InputManager * mInputManager
void setCameraParameters(const vpCameraParameters &cameraP)
bool continueRendering(void)
virtual bool updateScene(const Ogre::FrameEvent &)
virtual bool customframeEnded(const Ogre::FrameEvent &evt)
OIS::Keyboard * mKeyboard
virtual bool processInputEvent(const Ogre::FrameEvent &)
virtual void windowClosed(Ogre::RenderWindow *rw) VP_OVERRIDE
void addRotation(const std::string &sceneName, const vpRotationMatrix &wRo)
unsigned int mBackgroundWidth
void getRenderingOutput(vpImage< vpRGBa > &I, const vpHomogeneousMatrix &cMo)
vpAROgre(const vpCameraParameters &cam=vpCameraParameters(), unsigned int width=0, unsigned int height=0, const char *resourcePath=VISP_HAVE_OGRE_RESOURCES_PATH, const char *pluginsPath=VISP_HAVE_OGRE_PLUGINS_PATH)
void setMaterial(const std::string &entityName, const std::string &materialName)
Ogre::String mSceneManagerName
virtual bool destroyScene(void)
virtual void updateCameraProjection(void)
virtual bool windowClosing(Ogre::RenderWindow *rw) VP_OVERRIDE
Check if the window that is currently closing is the one attached to the object.
void setRotation(const std::string &sceneName, const vpRotationMatrix &wRo)
virtual void closeOIS(void)
static unsigned int sRTSSUsers
unsigned int mBackgroundHeight
virtual bool customframeStarted(const Ogre::FrameEvent &evt)
Ogre::String mPluginsPath
Ogre::Rectangle2D * mBackground
vpTranslationVector getPosition(const std::string &sceneName) const
virtual void createScene(void)
Ogre::SceneManager * getSceneManager()
unsigned int mWindowHeight
void setVisibility(const std::string &sceneName, bool isVisible)
virtual void init(vpImage< unsigned char > &I, bool bufferedKeys=false, bool hidden=false)
virtual void display(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMw)
bool renderOneFrame(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMw)
void load(const std::string &entityName, const std::string &model)
virtual void createCamera(void)
virtual void updateCameraParameters(const vpHomogeneousMatrix &cMo)
std::list< std::string > mOptionalResourceLocation
Ogre::SceneManager * mSceneMgr
Ogre::HardwarePixelBufferSharedPtr mPixelBuffer
Ogre::String mResourcePath
void setPosition(const std::string &sceneName, const vpTranslationVector &wTo)
Ogre::RenderWindow * mWindow
unsigned int mWindowWidth
virtual void updateBackgroundTexture(const vpImage< unsigned char > &I)
void setScale(const std::string &sceneName, float factorx, float factory, float factorz)
Generic class defining intrinsic camera parameters.
error that can be emitted by ViSP classes.
Implementation of an homogeneous matrix and operations on such kind of matrices.
void extract(vpRotationMatrix &R) const
unsigned int getWidth() const
void resize(unsigned int h, unsigned int w)
resize the image : Image initialization
Type * bitmap
points toward the bitmap
unsigned int getHeight() const
Implementation of a rotation matrix and operations on such kind of matrices.
Class that consider the case of a translation vector.