00001
00002 #ifndef RC_CAMERA_H
00003 #define RC_CAMERA_H
00004
00006 typedef enum {
00007
00008 RC_PROJECTION_TYPE_FREE_TRANSFORM = 0,
00009 RC_PROJECTION_TYPE_PERSPECTIVE,
00010 RC_PROJECTION_TYPE_ORTHOGONAL,
00011
00012 RC_PROJECTION_TYPE_LAST
00013
00014 } ProjectionType_t;
00015
00019 class Camera : public Transformable {
00020 friend class SceneGraph;
00021 friend class World;
00022
00023
00024
00025 protected:
00026
00027 Camera(
00028 const char *nname
00029 );
00030
00031 ~Camera();
00032
00033 public:
00034
00035 static void registerCommands();
00036
00052 void setOrthogonalProjection(
00053 f32 left,
00054 f32 right,
00055 f32 bottom,
00056 f32 top,
00057 f32 nnear,
00058 f32 nfar
00059 );
00060
00081 void setPerspectiveProjection(
00082 f32 fovy,
00083 f32 aspect,
00084 f32 nnear,
00085 f32 nfar
00086 );
00087
00096 void setProjection(
00097 mat4f &matrix
00098 );
00099
00111 vec3f unproject(
00112 vec3f screen_coord
00113 );
00114
00115 mat4f getProjectionMatrix() const;
00116 mat4f getProjectionMatrixInverse();
00117
00118 mat4f getViewMatrix();
00119 mat4f getViewMatrixInverse();
00120
00121 mat4f getViewProjectionMatrix();
00122 mat4f getViewProjectionMatrixInverse();
00123
00124 void calculateFrustum(
00125 vec4f frustum[6]
00126 );
00127
00132 void toggleIndicator(
00133 bool visible
00134 );
00135
00136 bool getIndicator();
00137
00138 void logInfo();
00139
00140 private:
00141
00148 Node *duplicateSelf();
00149
00150 void drawSelf();
00151
00152
00153
00154 private:
00155 f32 nearPlane;
00156 f32 farPlane;
00157 mat4f projectionMatrix;
00158
00159 mat4f projectionMatrixInverse;
00160
00165 ProjectionType_t projectionType;
00166
00167 bool projectionChanged;
00168
00169 bool indicatorVisible;
00170
00171 };
00172
00173
00174 #endif
00175