hit_mode(3G)
NAME
inquire_hit, set_hit_mode − inquire status of hit testing; enable/disable hit detection
SYNOPSIS
C Syntax:
void set_hit_mode(fildes,hit_mode)
int fildes,hit_mode;
void inquire_hit(fildes,hit)
int fildes,*hit;
FORTRAN77 Syntax:
subroutine set_hit_mode(fildes,hit_mode)
integer*4 fildes,hit_mode
subroutine inquire_hit(fildes,hit)
integer*4 fildes,hit
Pascal Syntax:
procedure set_hit_mode(fildes,hit_mode:integer);
procedure inquire_hit(fildes:integer; var hit:integer);
DESCRIPTION
Input Parameters
fildes Integer file descriptor returned by gopen when an I/O path to a graphics device is opened.
hit_mode If TRUE (1), Starbase hit detection mode is enabled.
If FALSE (0), hit detection is disabled.
Output Parameters
hit TRUE (1) if a previous Starbase primitive generated a hit. Otherwise it is FALSE (0).
Discussion
Set_hit_mode and inquire_hit provide a mechanism for detecting hits on primitives. These are useful in application programs that implement their own display list.
Set_hit_mode is used to enable and disable the Starbase hit mode. When in hit mode, primitives are not displayed, but are tested for a hit. The status of this hit testing is saved for return by inquire_hit . If a hit has occurred since the last invocation of inquire_hit, hit will be TRUE (1). Calling inquire_hit resets the status of the hit test to FALSE (0).
A hit on a primitive occurs when a visible primitive intersects the pick aperture (see set_pick_window(3G) and set_pick_depth(3G)). Here is a list of pickable objects:
| append_text | inttext2d |
| arc | polygon2d |
| block_move | polygon3d |
| block_write | polygon_with_data3d |
| draw2d | polyhedron_with_data |
| draw3d | polyline2d |
| ellipse | polyline3d |
| file_to_bitmap | polyline_with_data3d |
| file_to_intbitmap | polymarker2d |
| intarc | polymarker3d |
| intblock_move | polymarker_with_data3d |
| intblock_write | quadrilateral_mesh |
| intcircle | quadrilateral_mesh_with_data |
| intdraw2d | rectangle |
| intpolycircle | spline_curve2d |
| intpolygon2d | spline_curve3d |
| intpolyline2d | spline_surface |
| intpolymarker2d | text2d |
| intpolyrectangle | text3d |
| intrectangle | triangular_strip |
Starbase Radiosity and Ray Tracing only:
spline_cone
spline_sphere
spline_torus
Note that the device coordinate (DC) primitives and clear_view_surface are not pickable, and never generate hits. Partial_polygon, partial_ellipse, partial_arc, intpartial_polygon2d, intpartial_arc, and intpartial_circle primitives are not directly pickable because they do not produce immediate output. However, they can contribute to the pickable output produced by a subsequent polygon, rectangle, ellipse, arc, intpolygon2d, intrectangle, intcircle, or intarc call. The same delayed reporting occurs for text primitives with the more flag set.
Hit_mode interacts with hidden_surface. If hit mode and hidden surface removal are both enabled, the Z-buffer area is restricted to the area determined by set_pick_window and set_pick_depth. This may affect the number of zbuffer_switch calls required (See hidden_surface(3G)). Since a primitive in the background may be drawn before a primitive in the foreground obscures it, a hit may be recorded for a primitive that is not ultimately visible. This can be prevented by drawing the complete image twice, and only calling inquire_hit during the second time through. The first time through sets the Z-buffer values so that each primitive is compared with all other primitives on the second time through.
You may want to re-enable the Starbase hit mode after calling the pick_from_segment routine because pick_from_segment assumes the Starbase hit mode was turned on when it is called, and disables (turns off) the Starbase hit mode after executing, leaving the hit mode with possibly unexpected results.
ERRORS
1 Graphics device is not initialized for this operation.
DEFAULTS
Hit mode is disabled.
NOTE
This call can be used in both float (gopen with FLOAT_XFORM) and integer (gopen with INT_XFORM) mode.
SEE ALSO
pick_from_segment(3G), set_pick_depth(3G), set_pick_window(3G).
Hewlett-Packard Company — HP-UX Release 9.0: August 1992