/*! \brief Change z-exag value \param data nviz data \param exag exag value \return 1 */ int Nviz_change_exag(nv_data * data, double exag) { double temp; G_debug(1, "Nviz_change_exag(): value = %f", exag); temp = GS_global_exag(); if (exag != temp) { GS_set_global_exag(exag); Nviz_update_ranges(data); /* Nviz_draw_quick(data); */ } return 1; }
/*! \brief Load 3dview \param vname view name \param gv pointer to geoview struct \param gd pointer to geodisplay struct \param w current window \param defsurf default geosurf struct \return 1 */ int Gs_load_3dview(const char *vname, geoview * gv, geodisplay * gd, struct Cell_head *w, geosurf * defsurf) { const char *mapset; struct G_3dview v; int ret = -1; float pt[3]; mapset = G_find_file2("3d.view", vname, ""); if (mapset != NULL) { ret = G_get_3dview(vname, mapset, &v); } if (ret >= 0) { if (strcmp((v.pgm_id), "Nvision-ALPHA!")) { G_warning(_("View not saved by this program," "there may be some inconsistancies")); } /* set poly and mesh resolutions */ v.mesh_freq = (int)(v.mesh_freq * v.vwin.ns_res / w->ns_res); v.poly_freq = (int)(v.poly_freq * v.vwin.ns_res / w->ns_res); /* Set To and FROM positions */ /* TO */ pt[0] = (v.from_to[TO][X] - w->west) - w->ew_res / 2.; pt[1] = (v.from_to[TO][Y] - w->south) - w->ns_res / 2.; pt[2] = v.from_to[TO][Z]; GS_set_focus(pt); /* FROM */ pt[0] = (float)v.from_to[FROM][X]; pt[1] = (float)v.from_to[FROM][Y]; pt[2] = (float)v.from_to[FROM][Z]; GS_moveto_real(pt); if (defsurf) { int dmode = 0; GS_setall_drawres(v.poly_freq, v.poly_freq, v.mesh_freq, v.mesh_freq); while (v.display_type >= 10) { /* globe stuff not used */ v.display_type -= 10; } /* set drawing modes */ if (v.colorgrid) { dmode |= DM_COL_WIRE; } if (v.shading) { dmode |= DM_GOURAUD; } switch (v.display_type) { case 1: dmode |= DM_WIRE; break; case 2: dmode |= DM_POLY; break; case 3: dmode |= DM_WIRE_POLY; break; } GS_setall_drawmode(dmode); /* should also set nozeros here */ } /* set exaggeration */ if (v.exag) GS_set_global_exag(v.exag); /* Set FOV */ if (v.fov) { GS_set_fov((int) (v.fov > 0 ? v.fov * 10. + 0.5 : v.fov * 10. - 0.5)); } else { /* TODO: do ortho */ } /* Set twist */ if (v.twist) GS_set_twist((int)(v.twist > 0 ? v.twist + 0.5 : v.twist - 0.5)); /* TODO: OK to here - need to unravel/reverse lights stuff*** */ if (v.lightson) { /* Lights are on */ /* Light Position */ gv->lights[0].position[X] = v.lightpos[X]; gv->lights[0].position[Y] = v.lightpos[Y]; gv->lights[0].position[Z] = v.lightpos[Z]; /* Light Color */ gv->lights[0].color[0] = v.lightcol[0]; gv->lights[0].color[1] = v.lightcol[1]; gv->lights[0].color[2] = v.lightcol[2]; /* Light Shininess */ gv->lights[0].shine = v.shine; /* Light Ambient */ gv->lights[0].ambient[0] = gv->lights[0].ambient[1] = gv->lights[0].ambient[2] = v.ambient * 3.; } /* Done with lights */ GS_alldraw_wire(); } /* Done with file */ return (1); }