Subversion Repositories gelsvn

Rev

Rev 152 | Rev 178 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
147 jab 1
#include <fstream>
2
#include "QuatTrackBall.h"
3
 
152 jab 4
namespace GLGraphics
147 jab 5
{
6
 
7
	class GLViewController
8
	{
9
		float FOV_DEG;
10
		float FOV_RAD;
11
		int WINX, WINY;
12
		float znear, zfar;
13
		float aspect;
14
		CGLA::Vec3f centre;
15
		float rad;
16
		bool button_down;
17
		TrackBallAction last_action;
18
		CGLA::Vec2i old_pos;
19
		bool spin;
20
 
21
		QuatTrackBall *ball;
22
	public:
23
 
24
		GLViewController(int _WINX, int _WINY,
25
										 const CGLA::Vec3f& _centre, float _rad);
26
		void grab_ball(TrackBallAction action, const CGLA::Vec2i& pos);
27
		void roll_ball(const CGLA::Vec2i& pos);
28
		void release_ball();
29
		bool try_spin();
30
		void reset_projection();
31
		void set_gl_modelview();
32
		void reshape(int W, int H);
33
		void set_near_and_far();
34
 
35
		float get_fovy_rad() const {return FOV_RAD;}
36
 
37
		float get_eye_dist() const
38
		{
39
			return ball->get_eye_dist();
40
		}
41
 
42
		void get_view_param(CGLA::Vec3f& e, 
43
												CGLA::Vec3f& c, CGLA::Vec3f& u) const
44
		{
45
			ball->get_view_param(e,c,u);
46
		}
47
 
48
		bool load(std::ifstream&);
49
		bool save(std::ofstream&) const;
50
	};
51
 
52
}