Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
vpAROgre.cpp
1/*
2 * ViSP, open source Visual Servoing Platform software.
3 * Copyright (C) 2005 - 2025 by Inria. All rights reserved.
4 *
5 * This software is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 * See the file LICENSE.txt at the root directory of this source
10 * distribution for additional information about the GNU GPL.
11 *
12 * For using ViSP with software that can not be combined with the GNU
13 * GPL, please contact Inria about acquiring a ViSP Professional
14 * Edition License.
15 *
16 * See https://visp.inria.fr for more information.
17 *
18 * This software was developed at:
19 * Inria Rennes - Bretagne Atlantique
20 * Campus Universitaire de Beaulieu
21 * 35042 Rennes Cedex
22 * France
23 *
24 * If you have questions regarding the use of this file, please contact
25 * Inria at visp@inria.fr
26 *
27 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29 *
30 * Description:
31 * Augmented Reality viewer using Ogre3D.
32 */
33
43
44#include <visp3/core/vpConfig.h>
45
46#ifdef VISP_HAVE_OGRE
47
48#include <visp3/ar/vpAROgre.h>
49#include <visp3/core/vpIoTools.h>
50
51#include <OgreRectangle2D.h>
52
53#if (VISP_HAVE_OGRE_VERSION >= (1<<16 | 11<<8 | 0))
54#include <OgreMatrix4.h>
55#include <Bites/OgreWindowEventUtilities.h>
56typedef OgreBites::WindowEventUtilities OgreWindowEventUtilities;
57#else
58typedef Ogre::WindowEventUtilities OgreWindowEventUtilities;
59#endif
60
62unsigned int vpAROgre::sID = 0;
63unsigned int vpAROgre::sRTSSUsers = 0;
64
80vpAROgre::vpAROgre(const vpCameraParameters &cam, unsigned int width, unsigned int height, const char *resourcePath,
81 const char *pluginsPath)
82 : name("ViSP - Augmented Reality"), mInitialized(false), mRoot(0), mCamera(0), mSceneMgr(0), mWindow(0), mResourcePath(resourcePath),
83 mPluginsPath(pluginsPath),
84#ifdef VISP_HAVE_OIS
86#endif
87 keepOn(true), // When created no reason to stop displaying
89 mWindowHeight(height), mWindowWidth(width), windowHidden(false), mNearClipping(0.001), mFarClipping(200), mcam(cam),
91{
92 std::stringstream nameSceneManager;
93 nameSceneManager << "SceneManagerInstance" << sID;
94 mSceneManagerName = nameSceneManager.str();
95 ++sID;
96#if defined(OGRE_BUILD_COMPONENT_RTSHADERSYSTEM) & (VISP_HAVE_OGRE_VERSION >= (1<<16 | 10 <<8 | 0))
97 mMaterialMgrListener = NULL;
98 mShaderGenerator = NULL;
99#endif
100}
101
105bool vpAROgre::initialiseRTShaderSystem()
106{
107#if defined(OGRE_BUILD_COMPONENT_RTSHADERSYSTEM) & (VISP_HAVE_OGRE_VERSION >= (1<<16 | 10 <<8 | 0))
108 if (Ogre::RTShader::ShaderGenerator::initialize() || (sRTSSUsers > 0)) {
109 ++sRTSSUsers;
110 mShaderGenerator = Ogre::RTShader::ShaderGenerator::getSingletonPtr();
111
112// Create and register the material manager listener if it doesn't exist yet.
113 if (!mMaterialMgrListener) {
114 mMaterialMgrListener = new OgreBites::SGTechniqueResolverListener(mShaderGenerator);
115 Ogre::MaterialManager::getSingleton().addListener(mMaterialMgrListener);
116 }
117 return true;
118 }
119#endif
120 return false;
121}
122
126void vpAROgre::destroyRTShaderSystem()
127{
128#if defined(OGRE_BUILD_COMPONENT_RTSHADERSYSTEM) & (VISP_HAVE_OGRE_VERSION >= (1<<16 | 10 <<8 | 0))
129 // Restore default scheme.
130 Ogre::MaterialManager::getSingleton().setActiveScheme(Ogre::MaterialManager::DEFAULT_SCHEME_NAME);
131
132 // Unregister the material manager listener.
133 if (mMaterialMgrListener != NULL) {
134 Ogre::MaterialManager::getSingleton().removeListener(mMaterialMgrListener);
135 delete mMaterialMgrListener;
136 mMaterialMgrListener = NULL;
137 }
138
139 // Destroy RTShader system.
140 if (mShaderGenerator != NULL) {
141 if (sRTSSUsers > 0) {
142 --sRTSSUsers;
143 }
144 if (sRTSSUsers == 0) {
145 Ogre::RTShader::ShaderGenerator::destroy();
146 }
147 mShaderGenerator = NULL;
148 }
149#endif
150}
151
181 bool
182#ifdef VISP_HAVE_OIS
183 bufferedKeys
184#endif
185 ,
186 bool hidden)
187{
188 mBackgroundWidth = I.getWidth();
189 mBackgroundHeight = I.getHeight();
190
191 init(
192#ifdef VISP_HAVE_OIS
193 bufferedKeys,
194#else
195 false,
196#endif
197 hidden);
198
199#if (VISP_HAVE_OGRE_VERSION >= (13 <<16 | 0 <<8 | 0))
200// Register the scene manager.
201 Ogre::RTShader::ShaderGenerator::getSingleton().addSceneManager(Ogre::Root::getSingletonPtr()->getSceneManager(mSceneManagerName));
202#endif
203
204 // Create the background image which will come from the grabber
205 createBackground(I);
206}
207
237 bool
238#ifdef VISP_HAVE_OIS
239 bufferedKeys
240#endif
241 ,
242 bool hidden)
243{
244 mBackgroundWidth = I.getWidth();
245 mBackgroundHeight = I.getHeight();
246
247 init(
248#ifdef VISP_HAVE_OIS
249 bufferedKeys,
250#else
251 false,
252#endif
253 hidden);
254
255#if (VISP_HAVE_OGRE_VERSION >= (13 <<16 | 0 <<8 | 0))
256// Register the scene manager.
257 Ogre::RTShader::ShaderGenerator::getSingleton().addSceneManager(Ogre::Root::getSingletonPtr()->getSceneManager(mSceneManagerName));
258#endif
259
260 // Create the background image which will come from the grabber
261 createBackground(I);
262}
263
289#ifdef VISP_HAVE_OIS
290 bufferedKeys
291#endif
292 ,
293 bool hidden)
294{
295 // Create the root
296 // mPluginsPath may contain more than one folder location separated by ";"
297 bool pluginsFileExists = false;
298 std::string pluginFile;
299 std::vector<std::string> plugingsPaths = vpIoTools::splitChain(std::string(mPluginsPath), std::string(";"));
300 for (size_t i = 0; i < plugingsPaths.size(); i++) {
301#if defined(NDEBUG) || !defined(_WIN32)
302 pluginFile = plugingsPaths[i] + "/plugins.cfg";
303#else
304 pluginFile = plugingsPaths[i] + "/plugins_d.cfg";
305#endif
306
307 if (vpIoTools::checkFilename(pluginFile)) {
308 pluginsFileExists = true;
309 break;
310 }
311 }
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")
316#else
317 + std::string("plugins_d.cfg")
318#endif
319 + std::string("\" doesn't exist in ") + std::string(mPluginsPath);
320 std::cout << errorMsg << std::endl;
321
322 throw(vpException(vpException::ioError, errorMsg));
323 }
324 std::cout << "######################### Load plugin file: " << pluginFile << std::endl;
325
326 if (Ogre::Root::getSingletonPtr() == nullptr) {
327 mRoot = new Ogre::Root(pluginFile, "ogre.cfg", "Ogre.log");
328 }
329 else {
330 mRoot = Ogre::Root::getSingletonPtr();
331 }
332
333 // Create the window
334 bool canInit = true;
335 if (mshowConfigDialog) {
336 mRoot->restoreConfig();
337#if (VISP_HAVE_OGRE_VERSION < (1<<16 | 10<<8 | 0))
338 bool isOK = mRoot->showConfigDialog();
339#else
340 bool isOK = mRoot->showConfigDialog(OgreBites::getNativeConfigDialog());
341#endif
342 if (!isOK) {
343 canInit = false;
344 }
345 }
346 else {
347 if (!mRoot->restoreConfig()) {
348 canInit = false;
349 }
350 }
351
352 if (!mRoot->isInitialised()) {
353 if (!canInit) { // We set the default renderer system
354 const Ogre::RenderSystemList &lRenderSystemList = mRoot->getAvailableRenderers();
355 if (lRenderSystemList.size() == 0) {
356 throw "ConfigDialog aborted"; // Exit the application on cancel
357 }
358
359 Ogre::RenderSystem *lRenderSystem = lRenderSystemList.at(0);
360 std::cout << "Using " << lRenderSystem->getName() << " as renderer." << std::endl;
361 mRoot->setRenderSystem(lRenderSystem);
362 }
363
364 mRoot->initialise(false);
365 }
366
367#if (VISP_HAVE_OGRE_VERSION < (1<<16 | 10<<8 | 0))
368 mSceneMgr = mRoot->createSceneManager(Ogre::ST_GENERIC);
369#elif (VISP_HAVE_OGRE_VERSION < (14<<16 | 0<<8 | 0))
370 mSceneMgr = mRoot->createSceneManager(Ogre::DefaultSceneManagerFactory::FACTORY_TYPE_NAME, mSceneManagerName);
371#else
372 mSceneMgr = mRoot->createSceneManager(Ogre::SMT_DEFAULT, mSceneManagerName);
373#endif
374
375 bool fullscreen = false;
376 Ogre::NameValuePairList misc;
377 Ogre::ConfigOptionMap config = mRoot->getRenderSystem()->getConfigOptions();
378 Ogre::ConfigOptionMap::const_iterator it = config.begin();
379
380 while (it != config.end()) {
381 Ogre::String leftconf = (*it).first;
382 Ogre::String rightconf = (*it).second.currentValue;
383
384 if (leftconf == "Video Mode") {
385 if (canInit) {
386 std::stringstream ss(rightconf.c_str());
387 std::string dummy;
388 ss >> mWindowWidth >> dummy >> mWindowHeight;
389 if (ss.fail()) {
390 std::cout << "Cannot read Ogre video mode" << std::endl;
391 }
392 }
393 else if (mWindowWidth == 0 && mWindowHeight == 0) {
396 }
397 }
398 else if (leftconf == "Full Screen") {
399 if (canInit && (rightconf == "Yes")) {
400 fullscreen = true;
401 }
402 }
403 else {
404 misc[leftconf] = rightconf;
405 }
406
407 ++it;
408 }
409
410 // With Ogre version >= 1.8.1 we hide the window
411 if (hidden) {
412#if (OGRE_VERSION >= (1 << 16 | 8 << 8 | 1))
413 misc["hidden"] = "true";
414 windowHidden = true;
415#endif
416 }
417 mWindow = mRoot->createRenderWindow(name, mWindowWidth, mWindowHeight, fullscreen, &misc);
418
419 // Load resource paths from config file
420
421 // File format is:
422 // [ResourceGroupName]
423 // ArchiveType=Path
424 // .. repeat
425 // For example:
426 // [General]
427 // FileSystem=media/
428 // Zip=packages/level1.zip
429
430 // mResourcePath may contain more than one folder location separated by ";"
431 bool resourcesFileExists = false;
432 std::string resourceFile;
433 std::vector<std::string> resourcesPaths = vpIoTools::splitChain(std::string(mResourcePath), std::string(";"));
434 for (size_t i = 0; i < resourcesPaths.size(); i++) {
435 resourceFile = resourcesPaths[i] + "/resources.cfg";
436 if (!vpIoTools::checkFilename(resourceFile)) {
437 continue;
438 }
439 resourcesFileExists = true;
440 std::cout << "######################### Load resource file: " << resourceFile << std::endl;
441 Ogre::ConfigFile cf;
442 cf.load(resourceFile);
443 // Go through all sections & settings in the file
444#if (VISP_HAVE_OGRE_VERSION < (1<<16 | 11<<8 | 0))
445 Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
446
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) {
453 typeName = i->first;
454 archName = i->second;
455 bool doesResourceExist = vpIoTools::checkDirectory(archName) || vpIoTools::checkFilename(archName);
456 if (doesResourceExist) {
457 if (!Ogre::ResourceGroupManager::getSingleton().resourceLocationExists(archName, secName)) {
458 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(archName, typeName, secName);
459 }
460 else {
461 std::cout << "INFO: Resource location \"" << archName << "\" of type \"" << typeName << "\" has already been added to the list of known resource locations." << std::endl;
462 }
463 }
464 else if (!doesResourceExist) {
465 std::cout << "INFO: Resource \"" << archName << "\" of type \"" << typeName << "\" does not exist." << std::endl;
466 }
467 }
468 }
469#else
470 const Ogre::ConfigFile::SettingsBySection_ &sectionsNamesAndSettigns = 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) {
477 typeName = i->first;
478 archName = i->second;
479 bool doesResourceExist = vpIoTools::checkDirectory(archName) || vpIoTools::checkFilename(archName);
480 if (doesResourceExist) {
481 if (!Ogre::ResourceGroupManager::getSingleton().resourceLocationExists(archName, secName)) {
482 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(archName, typeName, secName);
483 }
484 else {
485 std::cout << "INFO: Resource location \"" << archName << "\" of type \"" << typeName << "\" has already been added to the list of known resource locations." << std::endl;
486 }
487 }
488 else if (!doesResourceExist) {
489 std::cout << "INFO: Resource \"" << archName << "\" of type \"" << typeName << "\" does not exist." << std::endl;
490 }
491 }
492 }
493#endif
494 }
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);
498
499 std::cout << errorMsg << std::endl << std::flush;
500
501 throw(vpException(vpException::ioError, errorMsg));
502 }
503
504 // Add Optional resources (given by the user).
505 std::cout << "##################### add optional resource locations given by the user" << std::endl;
506 for (std::list<std::string>::const_iterator iter = mOptionalResourceLocation.begin();
507 iter != mOptionalResourceLocation.end(); ++iter) {
508 const Ogre::String typeName("FileSystem");
509 bool doesResourceExist = vpIoTools::checkDirectory(*iter) || vpIoTools::checkFilename(*iter);
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);
513 }
514 else {
515 std::cout << "INFO: Resource location \"" << *iter << "\" of type \"" << typeName << "\" has already been added to the list of known resource locations." << std::endl;
516 }
517 }
518 else if (!doesResourceExist) {
519 std::cout << "INFO: Resource \"" << *iter << "\" of type \"" << typeName << "\" does not exist." << std::endl;
520 }
521 }
522
523
524#if (VISP_HAVE_OGRE_VERSION >= (1<<16 | 10 <<8 | 0))
525 // Initialize the RTShaderSystem, if available
526 bool hasInitializedTheRTSS = initialiseRTShaderSystem();
527 if (!hasInitializedTheRTSS) {
528 std::cout << "[vpAROgre::init] RTSS is not available." << std::endl;
529 }
530#endif
531
532 // Initialise resources
533 std::cout << "##################### add resources" << std::endl;
534 Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
535 //-----------------------------------------------------
536 // 4 Create the SceneManager
537 //
538 // ST_GENERIC = octree
539 // ST_EXTERIOR_CLOSE = simple terrain
540 // ST_EXTERIOR_FAR = nature terrain (depreciated)
541 // ST_EXTERIOR_REAL_FAR = paging landscape
542 // ST_INTERIOR = Quake3 BSP
543 //-----------------------------------------------------
544
545// Create the camera
546 createCamera();
547
548 // Create a viewport
549 Ogre::Viewport *viewPort = mWindow->addViewport(mCamera);
550 // Ogre::Viewport* viewPort = mCamera->getViewport();
551 viewPort->setClearEveryFrame(true);
552 // Set the projection parameters to match the camera intrinsic parameters
554
555 // Create the 3D scene
556 createScene();
557
558 // Initialise and register event handlers
559 mRoot->addFrameListener(this);
560
561 // Register as a Window listener
562 OgreWindowEventUtilities::addWindowEventListener(mWindow, this);
563 OgreWindowEventUtilities::_addRenderWindow(mWindow);
564
565#ifdef VISP_HAVE_OIS
566 // Initialise OIS
567 Ogre::LogManager::getSingletonPtr()->logMessage("*** Initializing OIS ***");
568 OIS::ParamList pl;
569
570 size_t windowHnd = 0;
571 std::ostringstream windowHndStr;
572 // Initialise window
573 mWindow->getCustomAttribute("WINDOW", &windowHnd);
574 windowHndStr << windowHnd;
575 pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
576// Let the user use the keyboard elsewhere
577#if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) // UNIX
578 pl.insert(std::make_pair(std::string("x11_keyboard_grab"), std::string("false")));
579#endif
580
581 mInputManager = OIS::InputManager::createInputSystem(pl);
582
583 // Create all devices
584 // Here we only consider the keyboard input
585 mKeyboard = static_cast<OIS::Keyboard *>(mInputManager->createInputObject(OIS::OISKeyboard, bufferedKeys));
586 if (!bufferedKeys) {
587 mKeyboard->setEventCallback(this);
588 }
589#endif
590
591 // Initialise a render to texture to be able to retrieve a screenshot
592 try {
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);
596
597 Ogre::RenderTexture *RTarget = Texture->getBuffer()->getRenderTarget();
598 RTarget->addViewport(mCamera);
599 RTarget->getViewport(0)->setClearEveryFrame(true);
600 RTarget->getViewport(0)->setOverlaysEnabled(false);
601 }
602 catch (const Ogre::Exception &) {
603 std::cout << "Info: Texture rtf is already known by the resource manager." << std::endl;
604 }
605
606 mInitialized = true;
607}
608
613{
614 if (!mInitialized) {
615 return;
616 }
617#if (VISP_HAVE_OGRE_VERSION >= (1<<16 | 11<<8 | 0))
618 mPixelBuffer.reset();
619#else
620 mPixelBuffer.setNull();
621#endif
622// Destroy 3D scene
623 destroyScene();
624 // Close OIS
625 closeOIS();
626
627 // Destroy the RTSS, if available
628 destroyRTShaderSystem();
629
630 if (mWindow) {
631 OgreWindowEventUtilities::removeWindowEventListener(mWindow, this);
632 OgreWindowEventUtilities::_removeRenderWindow(mWindow);
634 }
635
636// Delete root
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();
641 }
642#else
643 if (Ogre::Root::getSingletonPtr()) {
644 hasNoMoreElements = Ogre::Root::getSingletonPtr()->getSceneManagers().empty();
645 }
646#endif
647
648 if (hasNoMoreElements && mRoot) {
649 delete mRoot;
650 }
651 mRoot = 0;
652}
653
659bool vpAROgre::stopTest(const Ogre::FrameEvent &evt)
660{
661 // Always keep this part
662 if (keepOn) {
663 return updateScene(evt);
664 }
665 else {
666 return keepOn;
667 }
668}
669
679bool vpAROgre::frameStarted(const Ogre::FrameEvent &evt)
680{
681 // custom method telling what to do at the beginning of each frame
682 bool result = customframeStarted(evt);
683
684 // Listen to the window
685 OgreWindowEventUtilities::messagePump();
687
688 // See if we have to stop rendering
689 if (result)
690 return stopTest(evt);
691 else
692 return result;
693}
694
701bool vpAROgre::frameEnded(const Ogre::FrameEvent &evt)
702{
703 // custom method telling what to do at the end of each frame
704 bool result = customframeEnded(evt);
705
706 // See if we have to stop rendering
707 if (result)
708 return stopTest(evt);
709 else
710 return result;
711}
712
721bool vpAROgre::customframeStarted(const Ogre::FrameEvent & /*evt*/)
722{
723 // See if window was closed
724 if (mWindow->isClosed())
725 return false;
726
727#ifdef VISP_HAVE_OIS
728 // Get keyboard input
729 mKeyboard->capture();
730 if (mKeyboard->isKeyDown(OIS::KC_ESCAPE))
731 return false;
732#endif
733 return true;
734}
735
741bool vpAROgre::customframeEnded(const Ogre::FrameEvent & /*evt*/) { return true; }
742
750bool vpAROgre::windowClosing(Ogre::RenderWindow *rw)
751{
752 if (rw == mWindow) {
753 keepOn = false;
754 }
755 return !keepOn;
756}
757
768void vpAROgre::windowClosed(Ogre::RenderWindow *rw)
769{
770 // Only close for window that created OIS (the main window in these demos)
771 if (rw == mWindow)
772 closeOIS();
773}
774
781{
782 // Update the background to match the situation
784
785 // Update the camera parameters to match the grabbed image
787
788 // Display on Ogre Window
789 return mRoot->renderOneFrame();
790}
791
798{
799 // Update the background to match the situation
801
802 // Update the camera parameters to match the grabbed image
804
805 // Display on Ogre Window
806 return mRoot->renderOneFrame();
807}
808
815{
816 // Display on Ogre Window
817 if (renderOneFrame(I, cMw)) {
818 mWindow->update();
819 keepOn = true;
820 }
821 else {
822 keepOn = false;
823 }
824}
825
832{
833 // Display on Ogre Window
834 if (renderOneFrame(I, cMw)) {
835 mWindow->update();
836 keepOn = true;
837 }
838 else {
839 keepOn = false;
840 }
841}
842
848
852void vpAROgre::setCameraParameters(const vpCameraParameters &cameraP) { mcam = cameraP; }
853
859void vpAROgre::load(const std::string &entityName, const std::string &model)
860{
861 Ogre::Entity *newEntity = mSceneMgr->createEntity(entityName, model);
862 Ogre::SceneNode *newNode = mSceneMgr->getRootSceneNode()->createChildSceneNode(entityName);
863 newNode->attachObject(newEntity);
864}
865
871void vpAROgre::setMaterial(const std::string &entityName, const std::string &materialName)
872{
873 // Reset the position
874 Ogre::Entity *entity = mSceneMgr->getEntity(entityName);
875 entity->setMaterialName(materialName);
876}
877
884void vpAROgre::setPosition(const std::string &sceneName, const vpTranslationVector &wTo)
885{
886 // Reset the position
887 Ogre::SceneNode *node = mSceneMgr->getSceneNode(sceneName);
888 node->setPosition((Ogre::Real)wTo[0], (Ogre::Real)wTo[1], (Ogre::Real)wTo[2]);
889}
890
896vpTranslationVector vpAROgre::getPosition(const std::string &sceneName) const
897{
898 Ogre::Vector3 translation = mSceneMgr->getSceneNode(sceneName)->getPosition();
899 return vpTranslationVector((Ogre::Real)translation[0], (Ogre::Real)translation[1], (Ogre::Real)translation[2]);
900}
901
907void vpAROgre::setRotation(const std::string &sceneName, const vpRotationMatrix &wRo)
908{
909 // Get the node in its original position
910 mSceneMgr->getSceneNode(sceneName)->resetOrientation();
911 // Apply the new rotation
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);
917}
918
924void vpAROgre::addRotation(const std::string &sceneName, const vpRotationMatrix &wRo)
925{
926 // Apply the new rotation
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);
932}
933
942void vpAROgre::setPosition(const std::string &sceneName, const vpHomogeneousMatrix &wMo)
943{
944 // Extract the position and orientation data
945 vpRotationMatrix rotations;
946 vpTranslationVector translation;
947 wMo.extract(rotations);
948 wMo.extract(translation);
949 // Apply them to the node
950 setPosition(sceneName, translation);
951 setRotation(sceneName, rotations);
952}
953
959void vpAROgre::setVisibility(const std::string &sceneName, bool isVisible)
960{
961 mSceneMgr->getSceneNode(sceneName)->setVisible(isVisible);
962}
963
971void vpAROgre::setScale(const std::string &sceneName, float factorx, float factory, float factorz)
972{
973 // Reset the scale to its original value
974 mSceneMgr->getSceneNode(sceneName)->scale(Ogre::Vector3(1, 1, 1) / mSceneMgr->getSceneNode(sceneName)->getScale());
975 // Apply the new scale
976 mSceneMgr->getSceneNode(sceneName)->scale(Ogre::Vector3(factorx, factory, factorz));
977}
978
982void vpAROgre::createCamera(void) { mCamera = mSceneMgr->createCamera("Camera"); }
983
990void vpAROgre::createBackground(vpImage<unsigned char> & /* I */)
991{
992 // Create a rectangle to show the incoming images from the camera
993 mBackground = new Ogre::Rectangle2D(true); // true = textured
994 mBackground->setCorners(-1.0, 1.0, 1.0, -1.0); // Spread all over the window
995 mBackground->setBoundingBox(Ogre::AxisAlignedBox(-100000.0 * Ogre::Vector3::UNIT_SCALE,
996 100000.0 * Ogre::Vector3::UNIT_SCALE)); // To be shown everywhere
997
998 // Texture options
999 Ogre::MaterialManager::getSingleton().setDefaultTextureFiltering(Ogre::TFO_NONE);
1000 Ogre::MaterialManager::getSingleton().setDefaultAnisotropy(1);
1001
1002 // Dynamic texture
1003 // If we are using opengl we can boost a little bit performances with a
1004 // dynamic texture
1005 if (mRoot->getRenderSystem()->getName() == "OpenGL Rendering Subsystem") {
1006 try {
1007 Ogre::TextureManager::getSingleton().createManual(
1008 "BackgroundTexture", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D,
1009 mBackgroundWidth, // width
1010 mBackgroundHeight, // height
1011 0, // num of mip maps
1012 Ogre::PF_BYTE_L, Ogre::TU_DYNAMIC_WRITE_ONLY_DISCARDABLE);
1013 }
1014 catch (const Ogre::Exception &) {
1015 std::cout << "Info: Texture BackgroundTexture is already known by the resource manager." << std::endl;
1016 }
1017 }
1018 else {
1019 try {
1020 Ogre::TextureManager::getSingleton().createManual(
1021 "BackgroundTexture", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D,
1022 mBackgroundWidth, // width
1023 mBackgroundHeight, // height
1024 0, // num of mip maps
1025 Ogre::PF_BYTE_L, Ogre::TU_DEFAULT);
1026 }
1027 catch (const Ogre::Exception &) {
1028 std::cout << "Info: Texture BackgroundTexture is already known by the resource manager." << std::endl;
1029 }
1030 }
1031
1032 // Pointer to the dynamic texture
1033 Ogre::TexturePtr dynTexPtr = Ogre::TextureManager::getSingleton().getByName("BackgroundTexture");
1034 //#if ( OGRE_VERSION >= (1 << 16 | 9 << 8 | 0) )
1035 // .dynamicCast<Ogre::Texture>();// Get the pixel buffer
1036 //#else
1037 // ;
1038 //#endif
1039 mPixelBuffer = dynTexPtr->getBuffer();
1040
1041 // Material to apply the texture to the background
1042 try {
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); // Background
1049 Backgroundmaterial->getTechnique(0)->getPass(0)->setDepthWriteEnabled(false); // Background
1050 Backgroundmaterial->getTechnique(0)->getPass(0)->createTextureUnitState("BackgroundTexture");
1051#if (VISP_HAVE_OGRE_VERSION >= (1<<16 | 11<<8 | 0))
1052 mBackground->setMaterial(Backgroundmaterial); // Attach the material to the rectangle
1053#else
1054 mBackground->setMaterial("BackgroundMaterial"); // Attach the material to the rectangle
1055#endif
1056 }
1057 catch (const Ogre::Exception &) {
1058 std::cout << "Info: Material BackgroundMaterial is already known by the resource manager." << std::endl;
1059 }
1060
1061 // Add the background to the Scene Graph so it will be rendered
1062 Ogre::SceneNode *BackgroundNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("BackgoundNode");
1063 BackgroundNode->attachObject(mBackground);
1064}
1065
1072void vpAROgre::createBackground(vpImage<vpRGBa> & /* I */)
1073{
1074 // Create a rectangle to show the incoming images from the camera
1075 mBackground = new Ogre::Rectangle2D(true); // true = textured
1076 mBackground->setCorners(-1.0, 1.0, 1.0, -1.0); // Spread all over the window
1077 mBackground->setBoundingBox(Ogre::AxisAlignedBox(-100000.0 * Ogre::Vector3::UNIT_SCALE,
1078 100000.0 * Ogre::Vector3::UNIT_SCALE)); // To be shown everywhere
1079
1080 // Texture options
1081 Ogre::MaterialManager::getSingleton().setDefaultTextureFiltering(Ogre::TFO_NONE);
1082 Ogre::MaterialManager::getSingleton().setDefaultAnisotropy(1);
1083
1084 // Dynamic texture
1085 // If we are using opengl we can boost a little bit performances with a
1086 // dynamic texture
1087 if (mRoot->getRenderSystem()->getName() == "OpenGL Rendering Subsystem") {
1088 try {
1089 Ogre::TextureManager::getSingleton().createManual(
1090 "BackgroundTexture", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D,
1091 mBackgroundWidth, // width
1092 mBackgroundHeight, // height
1093 0, // num of mip maps
1094 Ogre::PF_BYTE_BGRA, Ogre::TU_DYNAMIC_WRITE_ONLY_DISCARDABLE);
1095 }
1096 catch (const Ogre::Exception &) {
1097 std::cout << "Info: Texture BackgroundTexture is already known by the resource manager." << std::endl;
1098 }
1099 }
1100 else { // As that texture does not seem to work properly with direct3D we
1101 // use a default texture
1102 try {
1103 Ogre::TextureManager::getSingleton().createManual(
1104 "BackgroundTexture", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D,
1105 mBackgroundWidth, // width
1106 mBackgroundHeight, // height
1107 0, // num of mip maps
1108 Ogre::PF_BYTE_BGRA, Ogre::TU_DEFAULT);
1109 }
1110 catch (const Ogre::Exception &) {
1111 std::cout << "Info: Texture BackgroundTexture is already known by the resource manager." << std::endl;
1112 }
1113 }
1114
1115 // Pointer to the dynamic texture
1116 Ogre::TexturePtr dynTexPtr = Ogre::TextureManager::getSingleton().getByName("BackgroundTexture");
1117 //#if ( OGRE_VERSION >= (1 << 16 | 9 << 8 | 0) )
1118 // .dynamicCast<Ogre::Texture>();// Get the pixel buffer
1119 //#else
1120 // ;
1121 //#endif
1122
1123 // Get the pixel buffer
1124 mPixelBuffer = dynTexPtr->getBuffer();
1125
1126 // Material to apply the texture to the background
1127 try {
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); // Background
1134 Backgroundmaterial->getTechnique(0)->getPass(0)->setDepthWriteEnabled(false); // Background
1135 Backgroundmaterial->getTechnique(0)->getPass(0)->createTextureUnitState("BackgroundTexture");
1136
1137#if (VISP_HAVE_OGRE_VERSION >= (1<<16 | 11<<8 | 0))
1138 mBackground->setMaterial(Backgroundmaterial); // Attach the material to the rectangle
1139#else
1140 mBackground->setMaterial("BackgroundMaterial"); // Attach the material to the rectangle
1141#endif
1142 }
1143 catch (const Ogre::Exception &) {
1144 std::cout << "Info: Material BackgroundMaterial is already known by the resource manager." << std::endl;
1145 }
1146 mBackground->setRenderQueueGroup(Ogre::RENDER_QUEUE_BACKGROUND); // To be rendered in Background
1147
1148 // Add the background to the Scene Graph so it will be rendered
1149 Ogre::SceneNode *BackgroundNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("BackgoundNode");
1150 BackgroundNode->attachObject(mBackground);
1151}
1152
1161{
1162#ifdef VISP_HAVE_OIS
1163 if (mInputManager) {
1164 mInputManager->destroyInputObject(mKeyboard);
1165
1166 OIS::InputManager::destroyInputSystem(mInputManager);
1167 mInputManager = 0;
1168 }
1169#endif
1170}
1171
1175// Note: equation taken from:
1176// http://strawlab.org/2011/11/05/augmented-reality-with-OpenGL/
1178{
1179 if (mCamera != 0) {
1180 Ogre::Real f, n, f_m_n, f_p_n, px, py, u0, v0;
1181 f = (Ogre::Real)(mFarClipping); // Far clip distance
1182 n = (Ogre::Real)(mNearClipping); // Near clip distance
1183 f_m_n = (Ogre::Real)(f - n);
1184 f_p_n = (Ogre::Real)(f + n);
1185 px = (Ogre::Real)mcam.get_px();
1186 py = (Ogre::Real)mcam.get_py();
1187 u0 = (Ogre::Real)mcam.get_u0();
1188 v0 = (Ogre::Real)mcam.get_v0();
1189 Ogre::Matrix4 Projection = Ogre::Matrix4(
1190 (Ogre::Real)(2.0 * px / mBackgroundWidth), 0, (Ogre::Real)(1.0 - 2.0 * (u0 / mBackgroundWidth)), 0, 0,
1191 (Ogre::Real)(2.0 * py / mBackgroundHeight), (Ogre::Real)(-1.0 + 2.0 * (v0 / mBackgroundHeight)), 0, 0, 0,
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);
1194 }
1195}
1196
1201{
1202 // Inspired from Ogre wiki :
1203 // http://www.ogre3d.org/tikiwiki/Creating+dynamic+textures Lock the pixel
1204 // buffer and get a pixel box. HBL_DISCARD is to use for best performance
1205 // than HBL_NORMAL
1206 mPixelBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD); // Lock the buffer
1207 const Ogre::PixelBox &pixelBox = mPixelBuffer->getCurrentLock();
1208 // Buffer data
1209 Ogre::uint8 *pDest = static_cast<Ogre::uint8 *>(pixelBox.data);
1210 // Fill in the data in the grey level texture
1211 memcpy(pDest, I.bitmap, mBackgroundHeight * mBackgroundWidth);
1212
1213 // Unlock the pixel buffer
1214 mPixelBuffer->unlock();
1215}
1216
1221{
1222 // Inspired from Ogre wiki :
1223 // http://www.ogre3d.org/tikiwiki/Creating+dynamic+textures Lock the pixel
1224 // buffer and get a pixel box. HBL_DISCARD is to use for best performance
1225 // than HBL_NORMAL
1226 mPixelBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD); // Lock the buffer
1227 const Ogre::PixelBox &pixelBox = mPixelBuffer->getCurrentLock();
1228 // Buffer data
1229 Ogre::uint8 *pDest = static_cast<Ogre::uint8 *>(pixelBox.data);
1230// Fill in the data in the grey level texture
1231#if 1 // if texture in BGRa format
1232 for (unsigned int i = 0; i < mBackgroundHeight; i++) {
1233 for (unsigned int j = 0; j < mBackgroundWidth; j++) {
1234 // Color Image
1235 // *pDest++=I[i][mBackgroundWidth-j].B; // Blue component
1236 // *pDest++=I[i][mBackgroundWidth-j].G; // Green component
1237 // *pDest++=I[i][mBackgroundWidth-j].R; // Red component
1238
1239 *pDest++ = I[i][j].B; // Blue component
1240 *pDest++ = I[i][j].G; // Green component
1241 *pDest++ = I[i][j].R; // Red component
1242
1243 *pDest++ = 255; // Alpha component
1244 }
1245 }
1246#else // if texture in RGBa format which is the format of the input image
1247 memcpy(pDest, I.bitmap, mBackgroundHeight * mBackgroundWidth * sizeof(vpRGBa));
1248#endif
1249
1250 // Unlock the pixel buffer
1251 mPixelBuffer->unlock();
1252}
1253
1258{
1259 // The matrix is given to Ogre with some changes to fit with the world
1260 // projection
1261 Ogre::Matrix4 ModelView
1262 // = Ogre::Matrix4( (Ogre::Real)-cMo[0][0], (Ogre::Real)-cMo[0][1],
1263 // (Ogre::Real)-cMo[0][2], (Ogre::Real)-cMo[0][3],
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);
1271#else
1272 mCamera->setCustomViewMatrix(true, ModelView);
1273#endif
1274}
1275
1283{
1285 Ogre::TexturePtr dynTexPtr = Ogre::TextureManager::getSingleton().getByName("rtf");
1286 //#if ( OGRE_VERSION >= (1 << 16 | 9 << 8 | 0) )
1287 // .dynamicCast<Ogre::Texture>();
1288 //#else
1289 // ;
1290 //#endif
1291 Ogre::RenderTexture *RTarget = dynTexPtr->getBuffer()->getRenderTarget();
1292 mWindow->update();
1293 RTarget->update();
1294 if (I.getHeight() != mWindow->getHeight() || I.getWidth() != mWindow->getWidth()) {
1295 I.resize(mWindow->getHeight(), mWindow->getWidth());
1296 }
1297 mPixelBuffer = dynTexPtr->getBuffer();
1298 mPixelBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD);
1299 const Ogre::PixelBox &pixelBox = mPixelBuffer->getCurrentLock();
1300 dynTexPtr->getBuffer()->blitToMemory(pixelBox);
1301 Ogre::uint8 *pDest = static_cast<Ogre::uint8 *>(pixelBox.data);
1302#if 1 // if texture in BGRa format
1303 for (unsigned int i = 0; i < I.getHeight(); i++) {
1304 for (unsigned int j = 0; j < I.getWidth(); j++) {
1305 // Color Image
1306 I[i][j].B = *pDest++; // Blue component
1307 I[i][j].G = *pDest++; // Green component
1308 I[i][j].R = *pDest++; // Red component
1309 I[i][j].A = *pDest++; // Alpha component
1310 }
1311 }
1312#else // if texture in RGBa format which is the format of the input image
1313 memcpy(I.bitmap, pDest, I.getHeight() * I.getWidth() * sizeof(vpRGBa));
1314#endif
1315
1316 // Unlock the pixel buffer
1317 mPixelBuffer->unlock();
1318}
1319END_VISP_NAMESPACE
1320#elif !defined(VISP_BUILD_SHARED_LIBS)
1321// Work around to avoid warning: libvisp_ar.a(vpAROgre.cpp.o) has no symbols
1322void dummy_vpAROgre() { }
1323#endif
OIS::InputManager * mInputManager
Definition vpAROgre.h:403
void setCameraParameters(const vpCameraParameters &cameraP)
Definition vpAROgre.cpp:852
bool continueRendering(void)
Definition vpAROgre.cpp:847
Ogre::SceneManager * getSceneManager()
Definition vpAROgre.h:188
virtual bool updateScene(const Ogre::FrameEvent &)
Definition vpAROgre.h:337
virtual bool customframeEnded(const Ogre::FrameEvent &evt)
Definition vpAROgre.cpp:741
OIS::Keyboard * mKeyboard
Definition vpAROgre.h:404
bool keepOn
Definition vpAROgre.h:413
virtual bool processInputEvent(const Ogre::FrameEvent &)
Definition vpAROgre.h:344
virtual void windowClosed(Ogre::RenderWindow *rw) VP_OVERRIDE
Definition vpAROgre.cpp:768
void addRotation(const std::string &sceneName, const vpRotationMatrix &wRo)
Definition vpAROgre.cpp:924
unsigned int mBackgroundWidth
Definition vpAROgre.h:420
vpImage< vpRGBa > mImageRGBA
Definition vpAROgre.h:415
vpCameraParameters mcam
Definition vpAROgre.h:428
vpImage< unsigned char > mImage
Definition vpAROgre.h:416
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)
Definition vpAROgre.cpp:80
bool windowHidden
Definition vpAROgre.h:423
void setMaterial(const std::string &entityName, const std::string &materialName)
Definition vpAROgre.cpp:871
double mNearClipping
Definition vpAROgre.h:426
Ogre::Root * mRoot
Definition vpAROgre.h:393
Ogre::String name
Definition vpAROgre.h:389
Ogre::String mSceneManagerName
Definition vpAROgre.h:395
virtual bool destroyScene(void)
Definition vpAROgre.h:351
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.
Definition vpAROgre.cpp:750
Ogre::Camera * mCamera
Definition vpAROgre.h:394
void setRotation(const std::string &sceneName, const vpRotationMatrix &wRo)
Definition vpAROgre.cpp:907
virtual void closeOIS(void)
static unsigned int sRTSSUsers
Definition vpAROgre.h:387
unsigned int mBackgroundHeight
Definition vpAROgre.h:419
virtual bool customframeStarted(const Ogre::FrameEvent &evt)
Definition vpAROgre.cpp:721
bool mInitialized
Definition vpAROgre.h:390
Ogre::String mPluginsPath
Definition vpAROgre.h:399
Ogre::Rectangle2D * mBackground
Definition vpAROgre.h:418
double mFarClipping
Definition vpAROgre.h:427
vpTranslationVector getPosition(const std::string &sceneName) const
Definition vpAROgre.cpp:896
virtual void createScene(void)
Definition vpAROgre.h:328
unsigned int mWindowHeight
Definition vpAROgre.h:421
void setVisibility(const std::string &sceneName, bool isVisible)
Definition vpAROgre.cpp:959
virtual void init(vpImage< unsigned char > &I, bool bufferedKeys=false, bool hidden=false)
Definition vpAROgre.cpp:180
virtual void display(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMw)
Definition vpAROgre.cpp:814
bool renderOneFrame(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMw)
Definition vpAROgre.cpp:780
void load(const std::string &entityName, const std::string &model)
Definition vpAROgre.cpp:859
virtual void createCamera(void)
Definition vpAROgre.cpp:982
virtual void updateCameraParameters(const vpHomogeneousMatrix &cMo)
std::list< std::string > mOptionalResourceLocation
Definition vpAROgre.h:433
Ogre::SceneManager * mSceneMgr
Definition vpAROgre.h:396
Ogre::HardwarePixelBufferSharedPtr mPixelBuffer
Definition vpAROgre.h:417
virtual ~vpAROgre(void)
Definition vpAROgre.cpp:612
bool mshowConfigDialog
Definition vpAROgre.h:430
static unsigned int sID
Definition vpAROgre.h:386
Ogre::String mResourcePath
Definition vpAROgre.h:398
void setPosition(const std::string &sceneName, const vpTranslationVector &wTo)
Definition vpAROgre.cpp:884
Ogre::RenderWindow * mWindow
Definition vpAROgre.h:397
unsigned int mWindowWidth
Definition vpAROgre.h:422
virtual void updateBackgroundTexture(const vpImage< unsigned char > &I)
void setScale(const std::string &sceneName, float factorx, float factory, float factorz)
Definition vpAROgre.cpp:971
Generic class defining intrinsic camera parameters.
error that can be emitted by ViSP classes.
Definition vpException.h:60
@ ioError
I/O error.
Definition vpException.h:67
Implementation of an homogeneous matrix and operations on such kind of matrices.
void extract(vpRotationMatrix &R) const
Definition of the vpImage class member functions.
Definition vpImage.h:131
static std::vector< std::string > splitChain(const std::string &chain, const std::string &sep)
static bool checkFilename(const std::string &filename)
static bool checkDirectory(const std::string &dirname)
Implementation of a rotation matrix and operations on such kind of matrices.
Class that consider the case of a translation vector.