Gazebo

OgreAdaptor.hh

00001 /*
00002  *  Gazebo - Outdoor Multi-Robot Simulator
00003  *  Copyright (C) 2003  
00004  *     Nate Koenig & Andrew Howard
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 /* Desc: Middleman between OGRE and Gazebo
00022  * Author: Nate Koenig
00023  * Date: 13 Feb 2006
00024  * SVN: $Id: OgreAdaptor.hh 156 2007-11-26 20:26:57Z natepak $
00025  */
00026 
00027 #ifndef OGREADAPTOR
00028 #define OGREADAPTOR
00029 
00030 #include <X11/Xlib.h>
00031 #include <X11/Xutil.h>
00032 
00033 #include "SingletonT.hh"
00034 #include "Pose3d.hh"
00035 
00036 namespace Ogre
00037 {
00038   class Root;
00039   class SceneManager;
00040   class RenderWindow;
00041   class Viewport;
00042   class InputReader;
00043   class Window;
00044   class Camera;
00045   class SceneNode;
00046   class LogManager;
00047   class Overlay;
00048   class OverlayContainer;
00049   class SceneNode;
00050   class RenderTarget;
00051   class ColourValue;
00052 }
00053 
00054 namespace gazebo
00055 {
00058 
00059 
00060 class XMLConfigNode;
00061 class OgreFrameListener;
00062 class Entity;
00063 
00065 class OgreAdaptor : public SingletonT<OgreAdaptor>
00066 {
00068   private: OgreAdaptor();
00069 
00071   private: virtual ~OgreAdaptor();
00072 
00075   public: void Init(XMLConfigNode *node);
00076 
00078   public: void Init(Display *display, XVisualInfo *visual, Window windowId, int width, int height); 
00080   public: int Render();
00081 
00083   public: void CreateLight(XMLConfigNode *node, Entity *entity);
00084 
00086   public: void SetSceneNodePose( Ogre::SceneNode *node, const Pose3d &pose );
00087 
00089   public: void SetSceneNodePosition(Ogre::SceneNode *node, const Vector3 &pos);
00090 
00092   public: void SetSceneNodeRotation(Ogre::SceneNode *node, const Quatern &rot);
00093 
00095   public: Ogre::Camera *CreateCamera(const std::string &name, double nearClip, 
00096               double farClip, Ogre::RenderTarget *renderTarget);
00097 
00099   public: void ResizeWindow(unsigned int w, unsigned int h);
00100 
00101   private: void LoadPlugins();
00102   private: void SetupResources();
00103   private: void SetupRenderSystem(bool create);
00104   private: void CreateWindow();
00105   private: void DrawGrid();
00106 
00108   public: Ogre::Root *root;
00109 
00111   public: Ogre::SceneManager *sceneMgr;
00112 
00114   public: Ogre::RenderWindow *window;
00115 
00117   public: Ogre::Camera *camera;
00118 
00120   public: Ogre::Viewport *viewport;
00121 
00123   public: Ogre::InputReader *inputDevice;
00124 
00125   private: Ogre::LogManager *logManager;
00126 
00127   // Our custom frame listener
00128   private: OgreFrameListener *frameListener;
00129 
00130   private: Ogre::ColourValue *backgroundColor;
00131 
00132   private: std::string videoMode;
00133 
00134   private: bool ogreWindow;
00135 
00136   private: Vector3 terrainSize;
00137   private: unsigned int terrainVertSize;
00138   private: std::string terrainImage;
00139 
00140   private: friend class DestroyerT<OgreAdaptor>;
00141   private: friend class SingletonT<OgreAdaptor>;
00142 };
00143 
00144 /*/// \brief 
00145 class OgreGLXWindowInterface
00146 {
00147   public: virtual ~OgreGLXWindowInterface() = 0;
00148 
00149   // Call this with true when the window is mapped/visible, false when the window is unmapped/invisible
00150   public: virtual void exposed(bool active) = 0;
00151 
00152   // Call this to notify the window was resized
00153   public: virtual void resized(size_t width, size_t height) = 0;
00154 };
00155 */
00156 
00158 
00159 }
00160 #endif

Last updated Aug 04 2007