Subversion Repositories gelsvn

Rev

Rev 394 | Rev 594 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 394 Rev 424
Line 13... Line 13...
13
		glLoadIdentity();
13
    glLoadIdentity();
14
		gluPerspective(FOV_DEG, aspect, znear, zfar);
14
    gluPerspective(FOV_DEG, aspect, znear, zfar);
15
		glMatrixMode(GL_MODELVIEW);
15
    glMatrixMode(GL_MODELVIEW);
16
	}
16
  }
17
 
17
 
18
	GLViewController::GLViewController(int _WINX, int _WINY,
18
  GLViewController::GLViewController(int _WINX, int _WINY, const CGLA::Vec3f& centre, float rad)
19
									 const CGLA::Vec3f& centre, float rad):
-
 
20
		FOV_DEG(53),
19
    : FOV_DEG(53),
21
		WINX(_WINX), WINY(_WINY), 
20
      WINX(_WINX), WINY(_WINY), 
22
		aspect(WINX/WINY),
21
      aspect(WINX/WINY),
23
		button_down(false),
22
      button_down(false),
24
		spin(false),
23
      spin(false),
25
		ball(centre, rad, WINX, WINY)
24
      ball(centre, rad, WINX, WINY)
Line 27... Line 26...
27
		znear = 0.01f*rad;
26
    znear = 0.01f*rad;
28
		zfar  = 3*rad;
27
    zfar  = 3*rad;
29
		reset_projection();
28
    reset_projection();
30
	}
29
  }
31
 
30
 
32
	void GLViewController::grab_ball(TrackBallAction action, 
31
  void GLViewController::grab_ball(TrackBallAction action, const CGLA::Vec2i& pos)
33
																	 const CGLA::Vec2i& pos)
-
 
34
	{
32
  {
35
		ball.grab_ball(action,pos);
33
    ball.grab_ball(action,pos);
36
		if(action==ZOOM_ACTION)
34
    if(action==ZOOM_ACTION)
37
			set_near_and_far();
35
      set_near_and_far();
38
 
36
 
Line 101... Line 99...
101
 
99
 
102
	bool GLViewController::load(std::ifstream& ifs)
100
  bool GLViewController::load(std::ifstream& ifs)
103
	{
101
  {
104
		if(ifs)
102
    if(ifs)
105
			{
103
    {
106
				ifs.read(reinterpret_cast<char*>(this),
104
      ifs.read(reinterpret_cast<char*>(this), sizeof(GLViewController));
107
								 sizeof(GLViewController));reset_projection();
105
      reset_projection();
108
				ball.set_screen_window(WINX, WINY);
106
      ball.set_screen_window(WINX, WINY);
109
				return true;
107
      return true;
110
			}
108
    }
111
		return false;
109
    return false;
112
	}
110
  }
113
	bool GLViewController::save(std::ofstream& ofs) const
111
  bool GLViewController::save(std::ofstream& ofs) const
114
	{
112
  {
115
		if(ofs)
113
    if(ofs)
116
			{
114
    {
117
				ofs.write(reinterpret_cast<const char*>(this),
115
      ofs.write(reinterpret_cast<const char*>(this), sizeof(GLViewController));
118
									sizeof(GLViewController));
-
 
119
				return true;
116
      return true;
120
			}
117
    }
121
		return false;
118
    return false;
122
 	}
119
   }
123
 
-
 
124
}
120
}