Camera.hh
Go to the documentation of this file.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 CAMERA_HH
00028 #define CAMERA_HH
00029
00030 #include "Error.hh"
00031 #include "Sensor.hh"
00032 #include "Vector.hh"
00033 #include "RenderOptions.hh"
00034 #include "GLContext.hh"
00035
00036
00037
00038 class World;
00039 class WorldFile;
00040 class WorldFileNode;
00041 class Body;
00042
00043
00044
00045
00051 class Camera : public Sensor
00052 {
00053
00054 public: Camera( World *world );
00055
00056
00057 public: virtual ~Camera();
00058
00069 public: int Init(int width, int height, double hfov,
00070 double minDepth, double maxDepth, const char *method,
00071 int zBufferDepth);
00072
00073 public: void InitContext( GLContext &context );
00074
00076 public: int Fini();
00077
00079 public: void Update();
00080
00082 public: void SetPose(GzPose pose);
00083
00085 public: GzPose GetPose();
00086
00088 public: void SetFOV(double fov);
00089
00091 public: double GetFOV() const;
00092
00094 public: void SetRenderOptions(const RenderOptions *opt);
00095
00097 public: void GetRenderOptions(RenderOptions *opt) const;
00098
00100 public: void GetImageSize(int *w, int *h);
00101
00103 public: const unsigned char *GetImageData() const {return this->rgbImage;}
00104
00110 public: double GetZValue(int x, int y);
00111
00132 public: GzPose CalcCameraDelta(int mode, GzVector a, GzVector b);
00133
00134
00135 private: void Render();
00136
00137
00138 private: void RenderModels( int pass );
00139
00141 public: void SetSavePath(const char *pathname);
00142
00144 public: void EnableSaveFrame(bool enable);
00145
00146
00147 private: void SaveFrame();
00148
00149 private: GLuint LoadShader(GLenum target, const char *file);
00150
00151 private: float *Mult( float *a, float *b);
00152 private: void RenderDepthTexture();
00153
00154
00155 private: GLContext context;
00156
00157
00158 private: RenderOptions renderOpt;
00159
00160
00161 private: GzPose cameraPose;
00162
00163
00164 private: double hfov;
00165 private: double nearClip, farClip;
00166
00167
00168 private: int imageWidth, imageHeight;
00169
00170
00171 private: uint8_t *rgbImage;
00172
00173
00174 private: GLfloat cameraProjectionMatrix[16];
00175 private: GLfloat cameraViewMatrix[16];
00176
00177
00178 private: bool saveEnable;
00179 private: const char *savePathname;
00180 private: unsigned int saveCount;
00181
00182 private: GLfloat lightProjectionMatrix[16];
00183 private: GLfloat lightViewMatrix[16];
00184
00185
00186
00187 };
00188
00189 #endif
00190
Last updated 12 September 2005 21:38:45
|