Revision: 7052 http://playerstage.svn.sourceforge.net/playerstage/?rev=7052&view=rev Author: natepak Date: 2008-09-29 18:43:10 +0000 (Mon, 29 Sep 2008)
Log Message: ----------- Updated to work with ogre 1.6 Modified Paths: -------------- code/gazebo/trunk/server/rendering/MovableText.cc code/gazebo/trunk/server/rendering/MovableText.hh code/gazebo/trunk/server/rendering/OgreCamera.cc code/gazebo/trunk/server/rendering/SConscript code/gazebo/trunk/server/sensors/camera/StereoCameraSensor.cc Modified: code/gazebo/trunk/server/rendering/MovableText.cc =================================================================== --- code/gazebo/trunk/server/rendering/MovableText.cc 2008-09-29 03:01:33 UTC (rev 7051) +++ code/gazebo/trunk/server/rendering/MovableText.cc 2008-09-29 18:43:10 UTC (rev 7052) @@ -8,7 +8,6 @@ * @update 2007 by independentCreations see [EMAIL PROTECTED] */ - #include "MovableText.hh" #include <OgreFontManager.h> @@ -17,6 +16,8 @@ #define POS_TEX_BINDING 0 #define COLOUR_BINDING 1 +using namespace gazebo; + //////////////////////////////////////////////////////////////////////////////// // Constructor MovableText::MovableText() @@ -685,3 +686,13 @@ queue->addRenderable(this, mRenderQueueID, OGRE_RENDERABLE_DEFAULT_PRIORITY); } } + +//////////////////////////////////////////////////////////////////////////////// +/// Method to allow a caller to abstractly iterate over the Renderable instances +void MovableText::visitRenderables( Ogre::Renderable::Visitor* /*visitor*/, + bool /*debug*/) +{ + return; +} + + Modified: code/gazebo/trunk/server/rendering/MovableText.hh =================================================================== --- code/gazebo/trunk/server/rendering/MovableText.hh 2008-09-29 03:01:33 UTC (rev 7051) +++ code/gazebo/trunk/server/rendering/MovableText.hh 2008-09-29 18:43:10 UTC (rev 7052) @@ -1,4 +1,3 @@ - /* * Gazebo - Outdoor Multi-Robot Simulator * Copyright (C) 2003 @@ -29,139 +28,150 @@ #define MOVABLETEXT_HH #include <Ogre.h> +#include <OgreMovableObject.h> +#include <OgreRenderable.h> +#include <OgreUserDefinedObject.h> #include <string> -/// \brief Movable text -class MovableText : public Ogre::MovableObject, public Ogre::Renderable +namespace gazebo { - /// \brief Horizontal alignment - public: enum HorizAlign {H_LEFT, H_CENTER}; + /// \brief Movable text + class MovableText : public Ogre::MovableObject, public Ogre::Renderable + { + /// \brief Horizontal alignment + public: enum HorizAlign {H_LEFT, H_CENTER}; + + /// \brief vertical alignment + public: enum VertAlign {V_BELOW, V_ABOVE}; + + /// \brief Constructor + public: MovableText(); + + /// \brief Destructor + public: virtual ~MovableText(); + + /// \brief Loads text and font info + public: void Load(const std::string &name, + const Ogre::UTFString &text, + const std::string &fontName = "Arial", + float charHeight = 1.0, + const Ogre::ColourValue &color = Ogre::ColourValue::White); + + /// \brief Set the font + public: void SetFontName(const std::string &font); + + /// \brief Get the font + public: const std::string &GetFont() const; + + /// \brief Set the text to display + public: void SetText(const Ogre::UTFString & caption); + + /// \brief Get the displayed text + public: const Ogre::UTFString & GetText() const; + + /// \brief Set the text color + public: void SetColor(const Ogre::ColourValue & color); + + /// \brief Get the text color + public: const Ogre::ColourValue & GetColor() const; + + /// \brief Set the height of a character + public: void SetCharHeight(float height); + + /// \brief Set the height of a characters + public: float GetCharHeight() const; + + /// \brief Set the width of a space + public:void SetSpaceWidth(float width); + + /// \brief Get the width of a space + public: float GetSpaceWidth() const; + + /// \brief Set the alignment of the text + public: void SetTextAlignment(const HorizAlign &hAlign, + const VertAlign &vAlign); + + /// \brief Set the baseline height of the text + public: void SetBaseline(float height); + + /// \brief Get the baseline height + public: float GetBaseline() const; + + /// \brief True=text always is displayed ontop + public: void SetShowOnTop(bool show); + + /// \brief True=text is displayed on top + public: bool GetShowOnTop() const; + + /// \brief Get the axis aligned bounding box of the text + public: Ogre::AxisAlignedBox GetAABB(); + + /// \brief Method to allow a caller to abstractly iterate over the + // Renderable instances + public: virtual void visitRenderables( Ogre::Renderable::Visitor* visitor, + bool debug = false ); + + /// \brief setup the geometry (from MovableText) + protected: void _setupGeometry(); + + /// \brief update the color(from MovableText) + protected: void _updateColors(); + + /// \brief Get the world transform (from MovableObject) + protected: void getWorldTransforms(Ogre::Matrix4 *xform) const; + + /// \brief Get the bounding radiu (from MovableObject) + protected: float getBoundingRadius() const; + + /// \brief Get the squared view depth (from MovableObject) + protected: float getSquaredViewDepth(const Ogre::Camera *cam) const; + + private: std::string fontName; + private: Ogre::UTFString text; + + private: Ogre::ColourValue color; + private: Ogre::RenderOperation renderOp; + private: Ogre::AxisAlignedBox aabb; + private: Ogre::LightList lightList; + + private: float charHeight; + + private: bool needUpdate; + + private: float radius; + + private: Ogre::Camera *camera; + private: Ogre::RenderWindow *renderWindow; + private: float viewportAspectCoef; + private: Ogre::Font *font; + private: float spaceWidth; + private: bool updateColors; + private: VertAlign vertAlign; + private: HorizAlign horizAlign; + private: bool onTop; + private: float baseline; + private: Ogre::MaterialPtr material; + private: Ogre::MaterialPtr backgroundMaterial; + + private: const Ogre::Quaternion &getWorldOrientation(void) const; + private: const Ogre::Vector3 &getWorldPosition(void) const; + private: const Ogre::AxisAlignedBox &getBoundingBox(void) const; + + private: const Ogre::String &getMovableType() const; + + private: void _notifyCurrentCamera(Ogre::Camera *cam); + private: void _updateRenderQueue(Ogre::RenderQueue* queue); + + /// \brief Get the render operation + protected: void getRenderOperation(Ogre::RenderOperation &op); + + /// \brief Get the material + protected: const Ogre::MaterialPtr &getMaterial(void) const; + + /// \brief Get the lights + protected: const Ogre::LightList &getLights(void) const; //{return mLList;}; + + }; + } - /// \brief vertical alignment - public: enum VertAlign {V_BELOW, V_ABOVE}; - - /// \brief Constructor - public: MovableText(); - - /// \brief Destructor - public: virtual ~MovableText(); - - /// \brief Loads text and font info - public: void Load(const std::string &name, - const Ogre::UTFString &text, - const std::string &fontName = "Arial", - float charHeight = 1.0, - const Ogre::ColourValue &color = Ogre::ColourValue::White); - - /// \brief Set the font - public: void SetFontName(const std::string &font); - - /// \brief Get the font - public: const std::string &GetFont() const; - - /// \brief Set the text to display - public: void SetText(const Ogre::UTFString & caption); - - /// \brief Get the displayed text - public: const Ogre::UTFString & GetText() const; - - /// \brief Set the text color - public: void SetColor(const Ogre::ColourValue & color); - - /// \brief Get the text color - public: const Ogre::ColourValue & GetColor() const; - - /// \brief Set the height of a character - public: void SetCharHeight(float height); - - /// \brief Set the height of a characters - public: float GetCharHeight() const; - - /// \brief Set the width of a space - public:void SetSpaceWidth(float width); - - /// \brief Get the width of a space - public: float GetSpaceWidth() const; - - /// \brief Set the alignment of the text - public: void SetTextAlignment(const HorizAlign &hAlign, - const VertAlign &vAlign); - - /// \brief Set the baseline height of the text - public: void SetBaseline(float height); - - /// \brief Get the baseline height - public: float GetBaseline() const; - - /// \brief True=text always is displayed ontop - public: void SetShowOnTop(bool show); - - /// \brief True=text is displayed on top - public: bool GetShowOnTop() const; - - /// \brief Get the axis aligned bounding box of the text - public: Ogre::AxisAlignedBox GetAABB(); - - /// \brief setup the geometry (from MovableText) - protected: void _setupGeometry(); - - /// \brief update the color(from MovableText) - protected: void _updateColors(); - - /// \brief Get the world transform (from MovableObject) - protected: void getWorldTransforms(Ogre::Matrix4 *xform) const; - - /// \brief Get the bounding radiu (from MovableObject) - protected: float getBoundingRadius() const; - - /// \brief Get the squared view depth (from MovableObject) - protected: float getSquaredViewDepth(const Ogre::Camera *cam) const; - - private: std::string fontName; - private: Ogre::UTFString text; - - private: Ogre::ColourValue color; - private: Ogre::RenderOperation renderOp; - private: Ogre::AxisAlignedBox aabb; - private: Ogre::LightList lightList; - - private: float charHeight; - - private: bool needUpdate; - - private: float radius; - - private: Ogre::Camera *camera; - private: Ogre::RenderWindow *renderWindow; - private: float viewportAspectCoef; - private: Ogre::Font *font; - private: float spaceWidth; - private: bool updateColors; - private: VertAlign vertAlign; - private: HorizAlign horizAlign; - private: bool onTop; - private: float baseline; - private: Ogre::MaterialPtr material; - private: Ogre::MaterialPtr backgroundMaterial; - - private: const Ogre::Quaternion &getWorldOrientation(void) const; - private: const Ogre::Vector3 &getWorldPosition(void) const; - private: const Ogre::AxisAlignedBox &getBoundingBox(void) const; - - private: const Ogre::String &getMovableType() const; - - private: void _notifyCurrentCamera(Ogre::Camera *cam); - private: void _updateRenderQueue(Ogre::RenderQueue* queue); - - /// \brief Get the render operation - protected: void getRenderOperation(Ogre::RenderOperation &op); - - /// \brief Get the material - protected: const Ogre::MaterialPtr &getMaterial(void) const; - - /// \brief Get the lights - protected: const Ogre::LightList &getLights(void) const; //{return mLList;}; - -}; - #endif Modified: code/gazebo/trunk/server/rendering/OgreCamera.cc =================================================================== --- code/gazebo/trunk/server/rendering/OgreCamera.cc 2008-09-29 03:01:33 UTC (rev 7051) +++ code/gazebo/trunk/server/rendering/OgreCamera.cc 2008-09-29 18:43:10 UTC (rev 7052) @@ -183,13 +183,13 @@ this->camera->setPolygonMode(Ogre::PM_SOLID); } - Ogre::Vector3 v = this->sceneNode->getWorldPosition(); + Ogre::Vector3 v = this->sceneNode->_getDerivedPosition(); this->pose.pos.x = v.x; this->pose.pos.y = v.y; this->pose.pos.z = v.z; - Ogre::Quaternion q = this->pitchNode->getWorldOrientation(); + Ogre::Quaternion q = this->pitchNode->_getDerivedOrientation(); this->pose.rot.u = q.w; this->pose.rot.x = q.x; Modified: code/gazebo/trunk/server/rendering/SConscript =================================================================== --- code/gazebo/trunk/server/rendering/SConscript 2008-09-29 03:01:33 UTC (rev 7051) +++ code/gazebo/trunk/server/rendering/SConscript 2008-09-29 18:43:10 UTC (rev 7052) @@ -1,14 +1,15 @@ #Import variable Import('env sharedObjs headers') -sources = ['OgreCreator.cc', +sources = [ + 'MovableText.cc', + 'OgreCreator.cc', 'OgreAdaptor.cc', 'OgreFrameListener.cc', 'OgreDynamicRenderable.cc', 'OgreDynamicLines.cc', 'OgreSimpleShape.cc', 'OgreHUD.cc', - 'MovableText.cc', 'OgreVisual.cc', 'OgreCamera.cc', 'CameraManager.cc', Modified: code/gazebo/trunk/server/sensors/camera/StereoCameraSensor.cc =================================================================== --- code/gazebo/trunk/server/sensors/camera/StereoCameraSensor.cc 2008-09-29 03:01:33 UTC (rev 7051) +++ code/gazebo/trunk/server/sensors/camera/StereoCameraSensor.cc 2008-09-29 18:43:10 UTC (rev 7052) @@ -254,8 +254,8 @@ autoParamDataSource.setCurrentViewport(vp); autoParamDataSource.setCurrentRenderTarget(this->renderTargets[i]); autoParamDataSource.setCurrentSceneManager(sceneMgr); - autoParamDataSource.setCurrentCamera(this->GetOgreCamera()); - pass->_updateAutoParamsNoLights(autoParamDataSource); + autoParamDataSource.setCurrentCamera(this->GetOgreCamera(), true); + pass->_updateAutoParamsNoLights(&autoParamDataSource); // These two lines don't seem to do anything useful renderSys->_setProjectionMatrix(this->GetOgreCamera()->getProjectionMatrixRS()); @@ -381,9 +381,9 @@ fprintf( fp, "P6\n# Gazebo\n%d %d\n255\n", this->imageSizeP->GetValue().x, this->imageSizeP->GetValue().y); - for (unsigned int i = 0; i<this->imageSizeP->GetValue().x; i++) + for (unsigned int i = 0; i< (unsigned int)this->imageSizeP->GetValue().x; i++) { - for (unsigned int j =0; j<this->imageSizeP->GetValue().y; j++) + for (unsigned int j =0; j<(unsigned int)this->imageSizeP->GetValue().y; j++) { double f = this->depthBuffer[0][i*this->imageSizeP->GetValue().x+j]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Playerstage-commit mailing list Playerstage-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/playerstage-commit