CameraSensor.hh
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef CAMERASENSOR_HH
00028 #define CAMERASENSOR_HH
00029
00030 #include <OgrePrerequisites.h>
00031 #include <OgreTexture.h>
00032
00033 #include "Pose3d.hh"
00034 #include "Sensor.hh"
00035
00036
00037 namespace Ogre
00038 {
00039 class TexturePtr;
00040 class RenderTarget;
00041 class Camera;
00042 class Viewport;
00043 class SceneNode;
00044 }
00045
00046 namespace gazebo
00047 {
00053
00054
00055
00061 class CameraSensor : public Sensor
00062 {
00064 public: CameraSensor(Body *body);
00065
00067 public: virtual ~CameraSensor();
00068
00071 protected: virtual void LoadChild( XMLConfigNode *node );
00072
00074 protected: virtual void InitChild();
00075
00077 protected: virtual void UpdateChild(UpdateParams ¶ms);
00078
00080 protected: virtual void FiniChild();
00081
00083 public: Pose3d GetWorldPose() const;
00084
00086 public: virtual std::string GetMaterialName() const = 0;
00087
00089 public: void Translate( const Vector3 &direction );
00090
00092 public: void RotateYaw( float angle );
00093
00095 public: void RotatePitch( float angle );
00096
00098 public: double GetFOV() const;
00099
00101 public: unsigned int GetImageWidth() const;
00102
00104 public: unsigned int GetTextureWidth() const;
00105
00107 public: unsigned int GetImageHeight() const;
00108
00110 public: unsigned int GetTextureHeight() const;
00111
00113 public: size_t GetImageByteSize() const;
00114
00115 public: virtual const unsigned char *GetImageData(unsigned int i=0) = 0;
00116
00122 public: double GetZValue(int x, int y);
00123
00125 public: double GetNearClip();
00126
00128 public: double GetFarClip();
00129
00131 public: void EnableSaveFrame(bool enable);
00132
00134 public: void ToggleSaveFrame();
00135
00137 public: Ogre::Camera *GetOgreCamera() const;
00138
00139
00140 protected: virtual void SaveFrame() = 0;
00141
00142 protected: double hfov;
00143 protected: double nearClip, farClip;
00144 protected: unsigned int imageWidth, imageHeight;
00145 protected: unsigned int textureWidth, textureHeight;
00146
00147 protected: Ogre::Camera *camera;
00148 protected: Ogre::SceneNode *pitchNode;
00149
00150 protected: Pose3d pose;
00151
00152
00153 protected: Ogre::SceneNode *sceneNode;
00154
00155
00156 protected: unsigned char *saveFrameBuffer;
00157 protected: unsigned int saveCount;
00158 protected: bool saveFrames;
00159 protected: std::string savePathname;
00160
00161 protected: unsigned int visibilityMask;
00162 };
00163
00166 }
00167 #endif
00168