Subversion Repositories gelsvn

Rev

Rev 67 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 67 Rev 94
Line 28... Line 28...
28
		centre(_centre), rad(_rad),
28
		centre(_centre), rad(_rad),
29
		button_down(false),
29
		button_down(false),
30
		spin(false)
30
		spin(false)
31
	{
31
	{
32
		float view_dist = rad/sin(FOV_RAD/2.0f);
32
		float view_dist = rad/sin(FOV_RAD/2.0f);
33
		ball = new TrackBall(centre, view_dist, WINX, WINY);
33
		ball = new QuatTrackBall(centre, view_dist, WINX, WINY);
34
		znear = view_dist - rad;
34
		znear = view_dist - rad;
35
		zfar  = view_dist + rad;
35
		zfar  = view_dist + rad;
36
 
36
 
37
		reset_projection();
37
		reset_projection();
38
	}
38
	}
Line 106... Line 106...
106
 
106
 
107
	bool GLViewController::load(std::ifstream& ifs)
107
	bool GLViewController::load(std::ifstream& ifs)
108
	{
108
	{
109
		if(ifs)
109
		if(ifs)
110
			{
110
			{
111
				TrackBall* ball_tmp = ball;
111
				QuatTrackBall* ball_tmp = ball;
112
				ifs.read(reinterpret_cast<char*>(this),
112
				ifs.read(reinterpret_cast<char*>(this),
113
								 sizeof(GLViewController));		
113
								 sizeof(GLViewController));		
114
				ball = ball_tmp;
114
				ball = ball_tmp;
115
				ifs.read(reinterpret_cast<char*>(ball),sizeof(TrackBall));		
115
				ifs.read(reinterpret_cast<char*>(ball),sizeof(QuatTrackBall));		
116
				reset_projection();
116
				reset_projection();
117
				ball->set_screen_window(WINX, WINY);
117
				ball->set_screen_window(WINX, WINY);
118
				return true;
118
				return true;
119
			}
119
			}
120
		return false;
120
		return false;
Line 123... Line 123...
123
	{
123
	{
124
		if(ofs)
124
		if(ofs)
125
			{
125
			{
126
				ofs.write(reinterpret_cast<const char*>(this),
126
				ofs.write(reinterpret_cast<const char*>(this),
127
									sizeof(GLViewController));
127
									sizeof(GLViewController));
128
				ofs.write(reinterpret_cast<const char*>(ball),sizeof(TrackBall));
128
				ofs.write(reinterpret_cast<const char*>(ball),sizeof(QuatTrackBall));
129
				return true;
129
				return true;
130
			}
130
			}
131
		return false;
131
		return false;
132
 	}
132
 	}
133
 
133