Main Page
Namespaces
Classes
Files
File List
File Members
navigator_tool.hpp
Go to the documentation of this file.
1
/*
2
** TP CPE Lyon
3
** Copyright (C) 2013 Damien Rohmer
4
**
5
** This program is free software: you can redistribute it and/or modify
6
** it under the terms of the GNU General Public License as published by
7
** the Free Software Foundation, either version 3 of the License, or
8
** (at your option) any later version.
9
**
10
** This program is distributed in the hope that it will be useful,
11
** but WITHOUT ANY WARRANTY; without even the implied warranty of
12
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
** GNU General Public License for more details.
14
**
15
** You should have received a copy of the GNU General Public License
16
** along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
20
21
#ifndef NAVIGATOR_TOOL_HPP_
22
#define NAVIGATOR_TOOL_HPP_
23
24
#include <
trackball.hpp
>
25
#include <
vec3.hpp
>
26
27
#include <vector>
28
29
namespace
cpe
30
{
31
43
class
navigator_tool
44
{
45
public
:
46
47
// ********************************************* //
48
// ********************************************* //
49
// CONSTRUCTORS
50
// ********************************************* //
51
// ********************************************* //
52
54
navigator_tool
();
55
56
57
// ********************************************* //
58
// ********************************************* //
59
// Screen parameters
60
// ********************************************* //
61
// ********************************************* //
62
64
unsigned
int
&
screen_size_x
();
66
const
unsigned
int
&
screen_size_x
()
const
;
67
69
unsigned
int
&
screen_size_y
();
71
const
unsigned
int
&
screen_size_y
()
const
;
72
73
74
// ********************************************* //
75
// ********************************************* //
76
// Camera manipulation
77
// ********************************************* //
78
// ********************************************* //
79
81
double
&
dist_cam
();
83
const
double
&
dist_cam
()
const
;
84
86
void
go_forward
(
const
double
& dL);
88
void
go_right
(
const
double
& dL);
90
void
go_up
(
const
double
& dL);
91
92
94
void
trackball_rotate
(
const
int
& x,
const
int
&y);
96
void
trackball_zoom
(
const
int
& y);
97
98
99
// ********************************************* //
100
// ********************************************* //
101
// Mouse record
102
// ********************************************* //
103
// ********************************************* //
104
106
int
&
x_previous
();
108
const
int
&
x_previous
()
const
;
109
111
int
&
y_previous
();
113
const
int
&
y_previous
()
const
;
114
116
bool
&
left_button
();
118
const
bool
&
left_button
()
const
;
119
121
bool
&
right_button
();
123
const
bool
&
right_button
()
const
;
124
125
126
127
128
// ********************************************* //
129
// ********************************************* //
130
// Projection parameters
131
// ********************************************* //
132
// ********************************************* //
133
146
std::vector<double>
projection_param
()
const
;
147
148
149
// ********************************************* //
150
// ********************************************* //
151
// Camera orientation
152
// ********************************************* //
153
// ********************************************* //
154
156
matrix3
camera_orientation
()
const
;
158
vec3
camera_translation
()
const
;
159
161
vec3
camera_position
()
const
;
162
163
164
// ********************************************* //
165
// ********************************************* //
166
// FPS
167
// ********************************************* //
168
// ********************************************* //
169
171
void
increase_frame_number
();
172
174
const
unsigned
int
&
time
()
const
;
176
unsigned
int
&
time
();
177
179
double
update_fps
();
181
double
delta_time
();
182
184
double
fps
();
185
186
// ********************************************* //
187
// ********************************************* //
188
// Picking
189
// ********************************************* //
190
// ********************************************* //
194
std::pair<vec3,vec3>
ray_world_space_cam1
(
const
int
& x_screen,
const
int
& y_screen)
const
;
195
196
197
private
:
198
199
200
// ********************************************* //
201
// ********************************************* //
202
// Internal Camera Parameters
203
// ********************************************* //
204
// ********************************************* //
205
207
trackball
track
;
209
vec3
tr
;
211
double
dist
;
212
214
double
fov
;
216
double
znear
;
218
double
zfar
;
219
220
// ********************************************* //
221
// ********************************************* //
222
// Window and mouse parameters
223
// ********************************************* //
224
// ********************************************* //
225
227
unsigned
int
x_size
;
229
unsigned
int
y_size
;
230
232
int
mouse_x_previous
;
234
int
mouse_y_previous
;
235
236
238
bool
is_left_button
;
240
bool
is_right_button
;
241
242
// ********************************************* //
243
// ********************************************* //
244
// Time parameter
245
// ********************************************* //
246
// ********************************************* //
247
249
double
current_fps
;
251
unsigned
int
current_time
;
253
unsigned
int
old_time
;
255
unsigned
int
frame
;
256
257
};
258
}
259
260
#endif
libinterface
navigator_tool.hpp
Generated on Sun Apr 28 2013 11:28:19 by
1.8.3.1