|
GRASS 8 Programmer's Manual 8.6.0dev(2026)-5f4f7ad06c
|

Go to the source code of this file.
Change z-exag value.
| data | nviz data |
| exag | exag value |
Definition at line 238 of file change_view.c.
References G_debug(), GS_global_exag(), GS_set_global_exag(), and Nviz_update_ranges().
Get color value from color string (name or RGB triplet)
| color_str | color string |
Definition at line 125 of file nviz.c.
References _, BLU_MASK, G_str_to_color(), G_warning(), GRN_MASK, and RED_MASK.
| int Nviz_create_render_window | ( | struct render_window * | rwin, |
| void * | display, | ||
| int | width, | ||
| int | height | ||
| ) |
Create render window.
| rwin | pointer to render_window struct |
| display | display instance (NULL for offscreen) [unused] |
| width | window width |
| height | window height |
Definition at line 157 of file nviz/render.c.
References _, G_fatal_error(), G_warning(), render_window::height, NULL, and render_window::width.
Delete texture.
| texture_id | texture id |
Definition at line 408 of file nviz/draw.c.
References t.
Deletes the North Arrow.
| data | nviz data |
Definition at line 315 of file nviz.c.
References nv_data::draw_arrow.
Deletes scale bar.
When scalebar is freed, array then contains NULL, which must be tested during drawing.
| data | nviz data |
Definition at line 435 of file nviz.c.
References G_free(), NULL, and nv_data::scalebar.
Free allocated space by nv_data struct.
| data | nviz data |
Definition at line 68 of file nviz.c.
References nv_data::arrow, nv_data::draw_arrow, nv_data::fringe, G_free(), NULL, nv_data::num_fringes, nv_data::num_scalebars, and nv_data::scalebar.
| void Nviz_destroy_render_window | ( | struct render_window * | rwin | ) |
Free render window.
| win | pointer to render_window struct |
Definition at line 123 of file nviz/render.c.
References G_free().
Draw all map objects (in full resolution) and decorations.
| data | nviz data |
Definition at line 204 of file nviz/draw.c.
References nv_data::arrow, nv_data::bgcolor, fringe_data::color, scalebar_data::color, nv_data::draw_arrow, fringe_data::elev, nv_data::fringe, GS_clear(), GS_done_draw(), GS_draw_fringe(), GS_ready_draw(), GS_set_draw(), GSD_BACK, gsd_north_arrow(), gsd_scalebar_v2(), fringe_data::id, nv_data::num_fringes, nv_data::num_scalebars, Nviz_draw_all_site(), Nviz_draw_all_surf(), Nviz_draw_all_vect(), Nviz_draw_all_vol(), nv_data::scalebar, scalebar_data::size, scalebar_data::where, and fringe_data::where.
Draw all loaded vector point sets.
Definition at line 146 of file nviz/draw.c.
References G_free(), GP_draw_site(), GP_get_site_list(), GS_done_draw(), GS_ready_draw(), GS_set_draw(), GSD_BACK, and GSD_BOTH.
Referenced by Nviz_draw_all().
Draw all loaded surfaces.
| dc | nviz data |
Definition at line 32 of file nviz/draw.c.
References G_free(), GS_draw_cplane_fence(), GS_draw_surf(), GS_get_surf_list(), GS_setlight_position(), MAX_CPLANES, MAX_SURFS, and x.
Referenced by Nviz_draw_all().
Draw all loaded vector sets (lines)
Definition at line 121 of file nviz/draw.c.
References GS_done_draw(), GS_ready_draw(), GS_set_draw(), GSD_BACK, GSD_BOTH, and GV_alldraw_vect().
Referenced by Nviz_draw_all().
Draw all loaded volume sets.
Definition at line 175 of file nviz/draw.c.
References G_free(), GS_done_draw(), GS_ready_draw(), GS_set_draw(), GSD_BACK, GSD_BOTH, GVL_draw_vol(), and GVL_get_vol_list().
Referenced by Nviz_draw_all().
Draws the North Arrow.
| data | nviz data |
Definition at line 298 of file nviz.c.
References nv_data::arrow, nv_data::draw_arrow, and gsd_north_arrow().
Draw the clip plane.
| data | nviz data |
| bound1 | |
| bound2 |
Definition at line 78 of file cplanes_obj.c.
References nv_data::cur_cplane.
Draw fringe
| data | nviz data |
Definition at line 234 of file nviz.c.
References fringe_data::color, fringe_data::elev, nv_data::fringe, GS_draw_fringe(), fringe_data::id, nv_data::num_fringes, and fringe_data::where.
Draw image as texture.
| x,y | image coordinates |
| width,height | image size |
| texture_id | texture id |
Definition at line 379 of file nviz/draw.c.
References GS_done_draw(), GS_set_draw(), GSD_FRONT, and x.
Draw lighting model.
| data | nviz data [unused] |
Definition at line 186 of file lights.c.
References GS_done_draw(), GS_draw_lighting_model(), GS_ready_draw(), GS_set_draw(), GSD_BACK, and GSD_FRONT.
Draw all surfaces in wireframe (quick mode)
Draw modes:
| data | nviz data |
| draw_mode | draw mode |
Definition at line 281 of file nviz/draw.c.
References nv_data::bgcolor, DRAW_QUICK_SURFACE, DRAW_QUICK_VLINES, DRAW_QUICK_VOLUME, DRAW_QUICK_VPOINTS, GP_alldraw_site(), GS_alldraw_wire(), GS_clear(), GS_done_draw(), GS_ready_draw(), GS_set_draw(), GSD_BACK, GV_alldraw_vect(), and GVL_alldraw_wire().
Draws the Scale bar.
| data | nviz data |
Definition at line 412 of file nviz.c.
References scalebar_data::color, gsd_scalebar_v2(), nv_data::num_scalebars, nv_data::scalebar, scalebar_data::size, and scalebar_data::where.
Fly through the scene.
Computes parameters needed for moving scene. Changes viewpoint and viewdir. Based on visualization/nviz/src/togl_flythrough.c and simplified.
| data | nviz data [unused] |
| fly_info | values computed from mouse movement |
| scale | rate of movement |
| lateral | type of movement |
Definition at line 324 of file change_view.c.
References GS_get_from(), GS_get_viewdir(), GS_moveto(), GS_set_viewdir(), M_PI, X, Y, and Z.
Get background color.
| data | nviz data |
Definition at line 113 of file nviz.c.
References nv_data::bgcolor.
Get the rotation values for the current clip plane.
| data | nviz data |
| id | id of current clip plane |
| dx,dy,dz | rotation parameters |
Definition at line 196 of file cplanes_obj.c.
References nv_data::cp_rot, X, Y, and Z.
Get the translation values for the current clip plane.
| data | nviz data |
| id | id of current clip plane |
| dx,dy,dz | translation parameters |
Definition at line 236 of file cplanes_obj.c.
References nv_data::cp_trans, X, Y, and Z.
Referenced by Nviz_set_cplane_here().
Get the current active cutplane.
| data | nviz data |
Definition at line 157 of file cplanes_obj.c.
References nv_data::cur_cplane.
Get view z-exag value.
Call after initial data has been loaded
Definition at line 79 of file exag.c.
References G_debug(), G_free(), GS_get_exag_guess(), GS_get_surf_list(), and NULL.
Get view height.
Call after initial data has been loaded
| [out] | val | height value |
| [out] | min | min value (or NULL) |
| [out] | max | max value (or NULL) |
Definition at line 29 of file exag.c.
References G_debug(), G_free(), GS_get_exag_guess(), GS_get_longdim(), GS_get_surf_list(), GS_get_zrange_nz(), max, min, and NULL.
Get focus.
| data | nviz data [unused] |
| x,y,z | focus coordinates |
Definition at line 120 of file position.c.
References GS_get_focus(), and x.
Get largest dimension.
| data | nviz data [unused] |
Definition at line 197 of file position.c.
References GS_get_longdim().
Get maximum texture size.
Definition at line 420 of file nviz/draw.c.
References scalebar_data::size.
Get current modelview matrix.
Definition at line 272 of file change_view.c.
Definition at line 181 of file change_view.c.
References G_debug(), GS_get_from_real(), and Z.
Definition at line 131 of file change_view.c.
References G_debug(), GS_get_from(), RANGE, RANGE_OFFSET, X, and Y.
Get xy range.
| data | nviz data |
Definition at line 175 of file position.c.
References nv_data::xyrange.
Get z range.
| data | nviz data [unused] |
| min,max | z range |
Definition at line 186 of file position.c.
References GS_get_zrange_nz(), max, and min.
Test focus.
| data | nviz data [unused] |
Definition at line 160 of file position.c.
References GS_get_focus().
Initialize Nviz data.
| data | nviz data |
Definition at line 26 of file nviz.c.
References nv_data::arrow, nv_data::cur_cplane, nv_data::draw_arrow, nv_data::fringe, GS_set_light_reset(), MAX_CPLANES, MAX_LIGHTS, NULL, nv_data::num_cplanes, nv_data::num_fringes, nv_data::num_scalebars, Nviz_new_cplane(), Nviz_new_light(), Nviz_off_cplane(), nv_data::scalebar, nv_data::xyrange, and nv_data::zrange.
Init new light.
| data | nviz data |
| num | light num (starts at 1) |
Definition at line 134 of file lights.c.
References light_data::ab, light_data::ag, light_data::ar, light_data::b, light_data::brt, light_data::g, G_debug(), light_data::id, nv_data::light, MAX_LIGHTS, light_data::r, light_data::w, light_data::x, light_data::y, and light_data::z.
Referenced by Nviz_new_light().
| void Nviz_init_render_window | ( | struct render_window * | rwin | ) |
Initialize render window.
| rwin | pointer to render_window struct |
Definition at line 94 of file nviz/render.c.
References NULL.
Initialize view, position, lighting settings (focus)
Set position to center of view
Definition at line 24 of file position.c.
References GS_init_view(), Nviz_set_focus_state(), Nviz_set_light_ambient(), Nviz_set_light_bright(), Nviz_set_light_color(), and Nviz_set_light_position().
Load image into texture.
| image_data | image data |
| width,height | image screen size |
| alpha | has alpha channel |
Definition at line 318 of file nviz/draw.c.
References GL_CLAMP_TO_EDGE.
Change focused point.
| sx,sy | screen coordinates |
Definition at line 262 of file change_view.c.
References G_debug(), and GS_look_here().
| int Nviz_make_current_render_window | ( | const struct render_window * | rwin | ) |
Make window current for rendering.
| rwin | pointer to render_window struct |
Definition at line 325 of file nviz/render.c.
References _, and G_warning().
Creates a clip plane object.
The number of clip planes is fixed (MAX_CPLANES) and we'll create them all ahead of time anyway we just let the user decide on the id for each.
| data | nviz data |
| id | cplane id |
Definition at line 31 of file cplanes_obj.c.
References nv_data::cp_on, nv_data::cp_rot, nv_data::cp_trans, nv_data::num_cplanes, X, Y, and Z.
Referenced by Nviz_init_data().
| struct fringe_data * Nviz_new_fringe | ( | nv_data * | data, |
| int | id, | ||
| unsigned long | color, | ||
| double | elev, | ||
| int | nw, | ||
| int | ne, | ||
| int | sw, | ||
| int | se | ||
| ) |
Add new fringe
| data | nviz data |
| id | surface id |
| color | color |
| elev | fringe elevation |
| nw,ne,sw,se | 1 (turn on) 0 (turn off) |
Definition at line 150 of file nviz.c.
References fringe_data::color, fringe_data::elev, nv_data::fringe, G_free(), G_malloc, G_realloc, GS_get_surf_list(), GS_surf_exists(), fringe_data::id, NULL, nv_data::num_fringes, and fringe_data::where.
Referenced by Nviz_set_fringe().
Define new light.
| data | nviz data |
Definition at line 165 of file lights.c.
References _, G_warning(), GS_new_light(), and Nviz_init_light().
Referenced by Nviz_init_data().
Create a new map object which can be one of surf, vect, vol or site.
This routine creates the object internally in the gsf libraryb. Optionally, a logical name may be specified for the new map object. If no name is specified, a logical name is assigned to the new object automatically. Note that maintaining unique logical names is not the responsibility of the library (currently).
Initially map objects contain no data, use the attribute commands to set attributes such as topology, color, etc.
| type | map object type |
| name | map name (NULL for constant) |
| value | constant (used if name is NULL) |
| data | nviz data |
Definition at line 46 of file map_obj.c.
References _, ATT_TOPO, CONST_ATT, G_free(), G_warning(), GP_delete_site(), GP_load_site(), GP_new_site(), GP_num_sites(), GP_select_surf(), GP_set_style(), GS_get_surf_list(), GS_new_surface(), GS_num_surfs(), GV_delete_vector(), GV_load_vector(), GV_new_vector(), GV_num_vects(), GV_select_surf(), GV_set_style(), GVL_delete_vol(), GVL_load_vol(), GVL_new_vol(), GVL_num_vols(), MAP_ATT, MAP_OBJ_SITE, MAP_OBJ_SURF, MAP_OBJ_VECT, MAP_OBJ_VOL, MAX_SITES, MAX_SURFS, MAX_VECTS, MAX_VOLS, name, NULL, Nviz_set_attr(), Nviz_set_volume_attr_default(), Nviz_set_vpoint_attr_default(), and ST_X.
| struct render_window * Nviz_new_render_window | ( | void | ) |
Allocate memory for render window.
Definition at line 79 of file nviz/render.c.
References G_malloc.
| struct scalebar_data * Nviz_new_scalebar | ( | nv_data * | data, |
| int | bar_id, | ||
| float * | coords, | ||
| float | size, | ||
| unsigned int | color | ||
| ) |
Add new scalebar
| data | nviz data |
| bar_id | scale bar id |
| coords | real(?) coordinates |
| size | scale bar length |
| color | scalebar/text color |
Definition at line 333 of file nviz.c.
References scalebar_data::color, G_malloc, G_realloc, scalebar_data::id, nv_data::num_scalebars, nv_data::scalebar, scalebar_data::size, and scalebar_data::where.
Referenced by Nviz_set_scalebar().
Return the number of clip planes objects currently allocated.
| data | nviz data |
Definition at line 147 of file cplanes_obj.c.
References nv_data::num_cplanes.
Turn off (make inactive) the given clip plane.
| data | nviz data |
| id | cplane id |
Definition at line 63 of file cplanes_obj.c.
References nv_data::cp_on, and GS_unset_cplane().
Referenced by Nviz_init_data().
Turn on (make current) the given clip plane.
| data | nviz data |
| id | cplane id |
Definition at line 48 of file cplanes_obj.c.
References nv_data::cp_on, nv_data::cur_cplane, and GS_set_cplane().
GL canvas resized.
| width | window width |
| height | window height |
Definition at line 30 of file change_view.c.
References G_debug(), GS_alldraw_wire(), GS_done_draw(), GS_ready_draw(), GS_set_draw(), GS_set_viewport(), and GSD_BACK.
Set ortho view for drawing images.
| width,height | image screen size |
Definition at line 355 of file nviz/draw.c.
Sets the North Arrow position and return world coords.
| data | nviz data |
| sx,sy | screen coordinates |
| size | arrow length |
| color | arrow/text color |
Definition at line 253 of file nviz.c.
References nv_data::arrow, arrow_data::color, G_free(), G_malloc, GS_get_surf_list(), GS_num_surfs(), GS_set_Narrow(), fringe_data::id, and arrow_data::size.
| int Nviz_set_attr | ( | int | id, |
| int | type, | ||
| int | desc, | ||
| int | src, | ||
| const char * | str_value, | ||
| double | num_value, | ||
| nv_data * | data | ||
| ) |
Set map object attribute
| id | map object id |
| type | map object type (MAP_OBJ_SURF, MAP_OBJ_VECT, ...) |
| desc | attribute descriptor |
| src | attribute source |
| str_value | attribute value as string (if NULL, check for num_value) |
| num_value | attribute value as double |
Definition at line 182 of file map_obj.c.
References ATT_COLOR, ATT_TOPO, CONST_ATT, DM_GOURAUD, DM_GRID_SURF, DM_POLY, FALLTHROUGH, GS_get_dims(), GS_load_att_map(), GS_set_att_const(), GS_set_drawmode(), GS_set_drawres(), MAP_ATT, MAP_OBJ_SURF, max, and Nviz_update_ranges().
Referenced by Nviz_new_map_obj().
Set background color.
| data | nviz data |
| color | color value |
Definition at line 99 of file nviz.c.
References nv_data::bgcolor.
Definition at line 258 of file cplanes_obj.c.
References FROM, GS_distance(), GS_get_region(), GS_get_selected_point_on_surface(), gs_get_surf(), GS_v3dir(), GS_v3mult(), gsd_get_los(), Nviz_get_cplane_translation(), Nviz_set_cplane_translation(), TO, X, x, Y, and Z.
Set the rotation for the current clip plane.
| data | nviz data |
| id | id of current clip plane |
| dx,dy,dz | rotation parameters |
Definition at line 172 of file cplanes_obj.c.
References nv_data::cp_rot, nv_data::cur_cplane, GS_set_cplane_rot(), X, Y, and Z.
Set the translation for the current clip plane.
| data | nviz data |
| id | id of current clip plane |
| dx,dy,dz | values for setting translation |
Definition at line 215 of file cplanes_obj.c.
References nv_data::cp_trans, nv_data::cur_cplane, GS_set_cplane_trans(), X, Y, and Z.
Referenced by Nviz_set_cplane_here().
Set appropriate fence color.
| type | type of fence (FC_ABOVE, FC_BELOW, FC_BLEND, FC_GREY, FC_OFF) |
Definition at line 251 of file cplanes_obj.c.
References GS_set_fencecolor().
Set focus.
| data | nviz data [unused] |
| x,y,z | focus coordinates |
Definition at line 141 of file position.c.
References GS_set_focus(), and x.
Set focus based on loaded map.
If map is MAP_OBJ_UNDEFINED, set focus from first surface/volume in the list.
| type | map object type |
| id | map object id |
Definition at line 76 of file position.c.
References G_free(), GS_get_surf_list(), GS_num_surfs(), GS_set_focus_center_map(), GS_set_nofocus(), GVL_get_vol_list(), GVL_num_vols(), GVL_set_focus_center_map(), MAP_OBJ_SURF, MAP_OBJ_UNDEFINED, and MAP_OBJ_VOL.
Set focus state.
| state_flag | 1 for center view, 0 use viewdir |
Definition at line 50 of file position.c.
References _, G_warning(), GS_set_infocus(), and GS_set_nofocus().
Referenced by Nviz_init_view().
| struct fringe_data * Nviz_set_fringe | ( | nv_data * | data, |
| int | id, | ||
| unsigned long | color, | ||
| double | elev, | ||
| int | nw, | ||
| int | ne, | ||
| int | sw, | ||
| int | se | ||
| ) |
Set fringe
| data | nviz data |
| id | surface id |
| color | color |
| elev | fringe elevation |
| nw,ne,sw,se | 1 (turn on) 0 (turn off) |
Definition at line 194 of file nviz.c.
References fringe_data::color, fringe_data::elev, nv_data::fringe, G_free(), GS_get_surf_list(), GS_surf_exists(), fringe_data::id, NULL, nv_data::num_fringes, Nviz_new_fringe(), and fringe_data::where.
Set light ambient.
| data | nviz data |
| num | light num (starts at 1) |
| value | ambient value (same for R/G/B) (0-1) |
Definition at line 116 of file lights.c.
References light_data::ab, light_data::ag, light_data::ar, G_debug(), GS_setlight_ambient(), and nv_data::light.
Referenced by Nviz_init_view().
Set light brightness.
| data | nviz data |
| num | light num (starts at 1) |
| value | brightness value |
Definition at line 65 of file lights.c.
References light_data::b, b, light_data::brt, light_data::g, g, G_debug(), GS_setlight_color(), nv_data::light, light_data::r, and r.
Referenced by Nviz_init_view().
Set light color.
| data | nviz data |
| num | light num (starts at 1) |
| red,green,blue | RGB values (0-255) |
Definition at line 90 of file lights.c.
References light_data::b, b, light_data::brt, light_data::g, g, G_debug(), GS_setlight_color(), nv_data::light, light_data::r, and r.
Referenced by Nviz_init_view().
Set light position.
| data | nviz data |
| num | light num (starts at 1) |
| x,y,z,w | position, model coordinates |
Definition at line 28 of file lights.c.
References G_debug(), GS_setlight_position(), light_data::id, nv_data::light, light_data::w, light_data::x, x, light_data::y, and light_data::z.
Referenced by Nviz_init_view().
Set rotation parameters.
Rotate scene by given parameters related to mouse drag event (difference from current state). Coordinates determine the second point of rotation axis, the first point is (0, 0, 0).
| angle | angle |
| x,y,z | axis coordinate |
Definition at line 288 of file change_view.c.
References G_debug(), GS_set_rotation(), and x.
| struct scalebar_data * Nviz_set_scalebar | ( | nv_data * | data, |
| int | bar_id, | ||
| int | sx, | ||
| int | sy, | ||
| float | size, | ||
| unsigned int | color | ||
| ) |
Sets the scale bar position and return world coords.
| data | nviz data |
| bar_id | scale bar id |
| sx,sy | screen coordinates |
| size | scale bar length |
| color | scalebar/text color |
Definition at line 367 of file nviz.c.
References scalebar_data::color, G_free(), GS_get_surf_list(), GS_num_surfs(), GS_set_Narrow(), scalebar_data::id, NULL, nv_data::num_scalebars, Nviz_new_scalebar(), nv_data::scalebar, scalebar_data::size, and scalebar_data::where.
Set default surface attributes.
Definition at line 279 of file map_obj.c.
References ATT_COLOR, ATT_EMIT, ATT_MASK, ATT_SHINE, ATT_TOPO, ATT_TRANSP, DEFAULT_SURF_COLOR, GS_set_att_defaults(), and MAX_ATTS.
Change viewpoint height.
| height | height value (world coordinates) |
Definition at line 157 of file change_view.c.
References G_debug(), GS_get_from_real(), GS_moveto_real(), and Z.
Change viewpoint perspective (field of view)
| persp | perspective value (0-100, in degrees) |
Definition at line 199 of file change_view.c.
References G_debug(), and GS_set_fov().
Change position of view.
| x_pos | x position (model coordinates) |
| y_pos | y position (model coordinates) |
Definition at line 97 of file change_view.c.
References G_debug(), GS_get_from(), GS_moveto(), RANGE, RANGE_OFFSET, X, and Y.
Change viewpoint twist.
| twist | persp twist value (-180-180, in degrees) |
Definition at line 220 of file change_view.c.
References G_debug(), and GS_set_twist().
Set default volume attributes.
| id | volume set id |
Definition at line 323 of file map_obj.c.
References DM_GOURAUD, DM_POLY, GVL_get_dims(), GVL_isosurf_set_drawmode(), GVL_isosurf_set_drawres(), GVL_slice_set_drawmode(), GVL_slice_set_drawres(), and max.
Referenced by Nviz_new_map_obj().
Set default vector point attributes.
| id | vector point set id |
Definition at line 303 of file map_obj.c.
References gp_get_site().
Referenced by Nviz_new_map_obj().
Unset map object attribute
| id | map object id |
| type | map object type (MAP_OBJ_SURF, MAP_OBJ_VECT, ...) |
| desc | attribute descriptor |
Definition at line 363 of file map_obj.c.
References GS_unset_att(), and MAP_OBJ_SURF.
Update ranges.
Call whenever a new surface is added, deleted, or exag changes
Definition at line 61 of file change_view.c.
References GS_get_longdim(), GS_get_zrange_nz(), and GS_global_exag().
Referenced by Nviz_change_exag(), and Nviz_set_attr().