35 if (width < 1 || height < 1) {
41 G_debug(1,
"Nviz_resize_window(): width = %d height = %d", width, height);
62 float zmin, zmax, exag;
79 zmax = zmin + (3. * dc->
xyrange / exag);
80 zmin = zmin - (2. * dc->
xyrange / exag);
82 if ((zmax - zmin) > dc->
zrange)
98 float xpos, ypos, from[3];
102 xpos = (xpos < 0) ? 0 : (xpos > 1.0) ? 1.0 : xpos;
104 ypos = (ypos < 0) ? 0 : (ypos > 1.0) ? 1.0 : ypos;
106 if (x_pos < 0.0 || x_pos > 1.0 || y_pos < 0.0 || y_pos > 1.0) {
107 G_debug(3,
"Invalid view position coordinates, using %f,%f",
111 G_debug(1,
"Nviz_set_viewpoint_position(): x = %f y = %f", x_pos, y_pos);
117 if ((from[
X] != tempx) || (from[
Y] != tempy)) {
139 *x_pos = (*x_pos < 0) ? 0 : (*x_pos > 1.0) ? 1.0 : *x_pos;
141 *y_pos = (*y_pos < 0) ? 0 : (*y_pos > 1.0) ? 1.0 : *y_pos;
143 if (xpos < 0.0 || xpos > 1.0 || ypos < 0.0 || ypos > 1.0) {
144 G_debug(3,
"Invalid view position coordinates, using %f,%f",
145 *x_pos, 1.0 - *y_pos);
160 G_debug(1,
"Nviz_set_viewpoint_height(): value = %f", height);
164 if (height != from[
Z]) {
184 G_debug(1,
"Nviz_get_viewpoint_height():");
201 G_debug(1,
"Nviz_set_viewpoint_persp(): value = %d", persp);
203 fov = (int)(10 * persp);
220 G_debug(1,
"Nviz_set_viewpoint_twist(): value = %d", twist);
240 G_debug(1,
"Nviz_change_exag(): value = %f", exag);
261 G_debug(1,
"Nviz_look_here(): screen coordinates = %f %f", sx, sy);
271 glGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix);
287 G_debug(3,
"Nviz_set_rotation(): angle = %f, x = %f, y = %f, z = %f", angle, x, y, z);
322 float dir[3], from[4], cur_from[4], cur_dir[4];
323 float speed, h, p, sh, ch, sp, cp;
324 float diff_x, diff_y, diff_z;
332 p = asin(cur_dir[
Z]);
333 h = atan2(- cur_dir[
X], - cur_dir[
Y]);
335 speed = scale[0] * fly_info[0];
337 h += scale[1] * fly_info[1];
339 p -= scale[1] * fly_info[2];
353 from[
X] = cur_from[
X] + speed * dir[
Y];
354 from[
Y] = cur_from[
Y] - speed * dir[
X];
355 from[
Z] = cur_from[
Z] + scale[0] * fly_info[2];
358 from[
X] = cur_from[
X] + speed * dir[
X];
359 from[
Y] = cur_from[
Y] + speed * dir[
Y];
361 from[
Z] = cur_from[
Z];
364 diff_x = fabs(cur_dir[X] - dir[X]);
365 diff_y = fabs(cur_dir[Y] - dir[Y]);
366 diff_z = fabs(cur_dir[Z] - dir[Z]);
369 (diff_x > quasi_zero) || (diff_y > quasi_zero) ||
370 (diff_z > quasi_zero) || (cur_from[X] != from[X]) ||
371 (cur_from[Y] != from[Y]) || (cur_from[Z] != from[Z])
int Nviz_set_viewpoint_height(double height)
Change viewpoint height.
void GS_set_viewdir(float *)
Set viewdir.
void Nviz_get_viewpoint_position(double *x_pos, double *y_pos)
void GS_set_viewport(int, int, int, int)
Set viewport.
void GS_init_rotation(void)
Reset scene rotation.
int GS_look_here(int, int)
Send screen coords sx and sy, lib traces through surfaces; sets new center to point of nearest inters...
void GS_set_rotation(double, double, double, double)
Set rotation params.
int Nviz_resize_window(int width, int height)
GL canvas resized.
int Nviz_update_ranges(nv_data *dc)
Update ranges.
void Nviz_init_rotation(void)
Stop scene rotation.
void GS_get_from(float *)
Get viewpoint 'from' position.
int Nviz_set_viewpoint_persp(int persp)
Change viewpoint perspective (field of view)
void Nviz_flythrough(nv_data *data, float *fly_info, int *scale, int lateral)
Fly through the scene.
void GS_unset_rotation(void)
Stop scene rotation.
void GS_moveto_real(float *)
Move position to (real)
void GS_alldraw_wire(void)
Draw all wires.
int Nviz_change_exag(nv_data *data, double exag)
Change z-exag value.
void Nviz_set_rotation(double angle, double x, double y, double z)
Set rotation parameters.
void GS_get_zrange_nz(float *, float *)
Get Z extents for all loaded surfaces.
void Nviz_get_modelview(double *modelMatrix)
Get current modelview matrix.
void GS_set_twist(int)
Set viewpoint twist value.
void GS_get_from_real(float *)
Get viewpoint 'from' real coordinates.
void Nviz_get_viewpoint_height(double *height)
void GS_done_draw(void)
Draw done, swap buffers.
int Nviz_set_viewpoint_twist(int twist)
Change viewpoint twist.
float GS_global_exag(void)
Get global z-exag value.
int Nviz_look_here(double sx, double sy)
Change focused point.
int Nviz_set_viewpoint_position(double x_pos, double y_pos)
Change position of view.
void GS_get_viewdir(float *)
Get viewdir.
void GS_moveto(float *)
Move viewpoint.
int GS_get_longdim(float *)
Get largest dimension.
void Nviz_unset_rotation(void)
Stop scene rotation.
void GS_set_global_exag(float)
Set global z-exag value.
void GS_set_draw(int)
Sets which buffer to draw to.
int G_debug(int, const char *,...) __attribute__((format(printf
void GS_set_fov(int)
Set field of view.