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
00021
00022 #ifndef __VR3CAMERA_H__
00023 #define __VR3CAMERA_H__
00024
00026
00050 class VR3Camera {
00051
00053 GLfloat m_fovy;
00055 GLfloat m_near;
00057 GLfloat m_far;
00059 GLfloat m_pos[3];
00061 GLfloat m_up[3];
00063 int m_mode;
00065 union {
00067 GLfloat m_target[3];
00069 GLfloat m_direction[3];
00070 } m_param;
00071
00073 VR3Camera(const VR3Camera&);
00075 VR3Camera& operator = (const VR3Camera&);
00076
00077
00078
00080
00081
00083
00089 void CheckTarget();
00090
00092
00099 void CheckUpVector();
00100
00102
00103 public:
00104
00105
00106
00108
00109
00111
00114 VR3Camera();
00115
00117
00118
00119
00121
00122
00124
00130 GLfloat GetFovY() { return m_fovy; }
00131
00133
00139 void SetFovY(GLfloat fov) { m_fovy = fov; }
00140
00142
00146 GLfloat GetZNear() { return m_near; }
00147
00149
00153 void SetZNear(GLfloat znear) { m_near = znear; }
00154
00156
00160 GLfloat GetZFar() { return m_far; }
00161
00163
00167 void SetZFar(GLfloat zfar) { m_far = zfar; }
00168
00170
00174 void GetPosition(GLfloat *p);
00175
00177
00180 const GLfloat* GetPosition() { return m_pos; }
00181
00183
00187 void SetPosition(GLfloat x, GLfloat y, GLfloat z);
00188
00190
00193 void SetPosition(const GLfloat *point);
00194
00196
00203 const GLfloat* GetUpVector() { return m_up; }
00204
00206
00214 void SetUpVector(GLfloat x, GLfloat y, GLfloat z);
00215
00217
00220 void SetUpVector(const GLfloat *up);
00221
00223
00228 void GetXAxis(GLfloat *a);
00229
00231
00236 void GetYAxis(GLfloat *a);
00237
00239
00244 void GetZAxis(GLfloat *a);
00245
00247
00254 void GetDirection(GLfloat *v);
00255
00257
00261 int GetMode() { return m_mode; }
00262
00264
00265
00266
00268
00269
00271
00275 void Free();
00276
00278
00283 void SetDirection(GLfloat x, GLfloat y, GLfloat z);
00284
00286
00289 void SetDirection(const GLfloat *dir);
00290
00292
00300 void RotateGlobal(GLfloat ang, GLfloat x, GLfloat y, GLfloat z);
00301
00303
00307 void RotateGlobal(GLfloat a, const GLfloat* d) { RotateGlobal(a, d[0], d[1], d[2]); }
00308
00310
00318 void RotateLocal(GLfloat ang, GLfloat x, GLfloat y, GLfloat z);
00319
00321
00325 void RotateLocal(GLfloat a, const GLfloat* d) { RotateLocal(a, d[0], d[1], d[2]); }
00326
00328
00329
00330
00332
00333
00335
00338 void LookAt();
00339
00341
00346 const GLfloat* GetTarget();
00347
00349
00356 void SetTarget(GLfloat x, GLfloat y, GLfloat z);
00357
00359
00362 void SetTarget(const GLfloat *t);
00363
00365
00366
00367
00369
00370
00372
00383 void GetViewMatrix(GLfloat* m);
00384
00386 };
00387
00388 #endif