- dpy->tick();
-
- if(move_y)
- {
- cam_pos.x += cos(cam_yaw)*dt*move_y;
- cam_pos.y += sin(cam_yaw)*dt*move_y;
- }
- if(move_x)
- {
- cam_pos.x += sin(cam_yaw)*dt*move_x;
- cam_pos.y += -cos(cam_yaw)*dt*move_x;
- }
- if(zoom)
- {
- cam_pos.x += cos(cam_yaw)*cos(cam_pitch)*dt*zoom;
- cam_pos.y += sin(cam_yaw)*cos(cam_pitch)*dt*zoom;
- cam_pos.z += sin(cam_pitch)*dt*zoom;
- }
- if(rotate)
- {
- float vx = cos(cam_yaw)*cos(cam_pitch);
- float vy = sin(cam_yaw)*cos(cam_pitch);
- float vz = sin(cam_pitch);
-
- float gx = cam_pos.x-vx*cam_pos.z/vz;
- float gy = cam_pos.y-vy*cam_pos.z/vz;
- float d = sqrt(vx*vx+vy*vy)*cam_pos.z/vz;
-
- cam_yaw += M_PI*dt*rotate;
- if(cam_yaw>M_PI*2)
- cam_yaw -= M_PI*2;
- else if(cam_yaw<0)
- cam_yaw += M_PI*2;
-
- cam_pos.x = gx+cos(cam_yaw)*d;
- cam_pos.y = gy+sin(cam_yaw)*d;
- }
- if(pitch)
- {
- cam_pitch += M_PI/2*dt*pitch;
- if(cam_pitch>M_PI/12)
- cam_pitch = M_PI/12;
- else if(cam_pitch<-M_PI/2)
- cam_pitch = -M_PI/2;
- }
-
- if(tooltip_timeout && t>tooltip_timeout)
- {
- Track3D *t3d = 0;
-
- if(mode==CATALOGUE)
- t3d = pick_track(pointer_x, pointer_y);
- else
- t3d = pick_track(pointer_x, pointer_y);
-
- if(t3d)
- {
- const Track &track = t3d->get_track();
- const TrackType &ttype = track.get_type();
- string info = format("%d %s", ttype.get_article_number(), ttype.get_description());
- if(mode!=CATALOGUE && abs(track.get_slope())>1e-4)
- info += format(" (slope %.1f%%)", abs(track.get_slope()/ttype.get_total_length()*100));
- if(track.get_turnout_id())
- info += format(" (turnout %d)", track.get_turnout_id());
- else if(track.get_sensor_id())
- info += format(" (sensor %d)", track.get_sensor_id());
-
- set_tooltip(pointer_x, pointer_y, info);
- }
- else
- clear_tooltip();