00001 #ifndef _CAMERA_H
00002 #define _CAMERA_H
00003
00004 #include "main.h"
00005
00006 #include <ClanLib/display.h>
00007
00008 #include <gfx/vec3.h>
00009
00018 class Camera {
00019 public:
00020
00022 enum ProjectType {
00023 ORTHOGRAPHIC,
00024 PERSPECTIVE
00025 };
00026
00027 Camera(ProjectType pt = PERSPECTIVE);
00028
00029 void set_radius( const double radius );
00030 void set_elevation( const double elevation );
00031 void set_azimuth( const double azimuth );
00032
00033 double get_radius( ) const { return _radius; }
00034 double get_elevation( ) const { return _elevation; }
00035 double get_azimuth( ) const { return _azimuth; }
00036
00037 Vec3 get_position() const { return _position; }
00038
00039 Vec3 get_right_vec() const { return _right_vec; }
00040 Vec3 get_up_vec() const { return _up_vec; }
00041 Vec3 get_forward_vec() const { return _forward_vec; }
00042
00046 void apply_projection();
00047
00051 void apply_view();
00052
00053 friend std::ostream& operator<<(std::ostream & os, const Camera& camera);
00054 protected:
00055
00056
00057 void _update();
00058
00059 double _radius;
00060 double _elevation;
00061 double _azimuth;
00062
00063 ProjectType _project_type;
00064
00065 double _min_radius;
00066 double _max_radius;
00067 double _min_elevation;
00068 double _max_elevation;
00069
00070 Vec3 _position;
00071 Vec3 _right_vec;
00072 Vec3 _up_vec;
00073 Vec3 _forward_vec;
00074 };
00075
00076 #endif // header guard