49 #include <visp/vpOpenCVGrabber.h>
50 #include <visp/vpV4l2Grabber.h>
51 #include <visp/vp1394TwoGrabber.h>
52 #include <visp/vpHomogeneousMatrix.h>
53 #include <visp/vpImage.h>
54 #include <visp/vpCameraParameters.h>
55 #include <visp/vpAROgre.h>
57 #if defined(VISP_HAVE_OGRE)
59 #ifndef DOXYGEN_SHOULD_SKIP_THIS
61 class vpAROgreAdvanced :
public vpAROgre
65 Ogre::AnimationState * mAnimationState;
69 unsigned int width = 640,
unsigned int height = 480)
72 mAnimationState = NULL;
79 Ogre::Entity* robot = mSceneMgr->createEntity(
"Robot",
"robot.mesh");
81 Ogre::SceneNode* RobotNode = mSceneMgr->getRootSceneNode()->createChildSceneNode(
"Robot");
82 RobotNode->
setPosition((Ogre::Real)-0.3, (Ogre::Real)0.2, (Ogre::Real)0);
83 RobotNode->attachObject(robot);
84 RobotNode->scale((Ogre::Real)0.001,(Ogre::Real)0.001,(Ogre::Real)0.001);
85 RobotNode->pitch(Ogre::Degree(180));
86 RobotNode->yaw(Ogre::Degree(-90));
90 mAnimationState = robot->getAnimationState(
"Idle" );
92 mAnimationState->setLoop(
true );
94 mAnimationState->setEnabled(
true );
101 mAnimationState->addTime( evt.timeSinceLastFrame );
112 #if defined(VISP_HAVE_OGRE)
113 #if defined(VISP_HAVE_V4L2) || defined(VISP_HAVE_DC1394_2) || (VISP_HAVE_OPENCV_VERSION >= 0x020100)
122 #if defined(VISP_HAVE_V4L2)
130 #elif defined(VISP_HAVE_DC1394_2)
138 #elif defined(VISP_HAVE_OPENCV)
140 cv::VideoCapture grabber(0);
141 if(!grabber.isOpened()) {
142 std::cout <<
"Failed to open the camera" << std::endl;
166 while(ogre.continueRendering()){
168 #if defined(VISP_HAVE_V4L2) || defined(VISP_HAVE_DC1394_2)
170 #elif defined(VISP_HAVE_OPENCV)
178 ogre.display(I, cMo);
181 std::cout <<
"You need an available framegrabber to run this example" << std::endl;
184 std::cout <<
"You need Ogre3D to run this example" << std::endl;
189 std::cout <<
"Catch an exception: " << e << std::endl;
193 std::cout <<
"Catch an exception " << std::endl;
void acquire(vpImage< unsigned char > &I)
void open(vpImage< unsigned char > &I)
unsigned int getWidth() const
static void convert(const vpImage< unsigned char > &src, vpImage< vpRGBa > &dest)
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
virtual bool customframeEnded(const Ogre::FrameEvent &evt)
void setPosition(const vpHomogeneousMatrix &cMw)
error that can be emited by ViSP classes.
Implementation of an augmented reality viewer.
void acquire(vpImage< unsigned char > &I)
void open(vpImage< unsigned char > &I)
Generic class defining intrinsic camera parameters.
Class for the Video4Linux2 video device.
virtual void createScene(void)
void init()
Basic initialisation (identity).
unsigned int getHeight() const
Class for firewire ieee1394 video devices using libdc1394-2.x api.