cond_call_segment(3G)
NAME
cond_call_segment − insert a conditional segment call element into the currently open segment
SYNOPSIS
C Syntax:
void cond_call_segment(fildes, cond_index_select, comp_flag, segno)
int fildes, cond_index_select, comp_flag, segno;
FORTRAN77 Syntax:
subroutine cond_call_segment(fildes, cond_index_select, comp_flag, segno)
integer*4 fildes, cond_index_select, comp_flag, segno
Pascal Syntax:
procedure cond_call_segment(fildes, cond_index_select, comp_flag, segno:integer);
DESCRIPTION
Input Parameters
fildes Integer file descriptor returned by gopen when an I/O path to a graphics device is opened.
cond_index_select
Condition to test. One of
CI_FALSE (0): constant value test always equal to FALSE.
CI_PRUNE (1): prune condition, set by set_extent.
CI_CULL (2): cull condition, set by set_extent.
comp_flag Comparison flag against which the value of the condition index selected by cond_index_select is tested. Either TRUE (1) or FALSE (0).
segno Segment to be called if the value of the condition index selected by cond_index_select equals comp_flag.
Discussion
Cond_call_segment inserts a cond_call_segment element into the currently open segment of the specified graphics device. If segno does not exist, an empty segment with that name is created.
When a cond_call_segment element is encountered during display list traversal, the value of the condition index selected by cond_index_select is compared against the value of comp_flag. If they differ, traversal continues to the next element in the current segment. If they are equal, a call is made to segment segno.
If adapt_clip_to_extent has been called with mode set to TRUE (1), cond_call_segment may disable some or all clipping planes while traversing segment segno, thereby improving performance. The conditions under which this disabling can occur are i) cond_index_select is CI_PRUNE (1), ii) comp_flag is FALSE (0) and iii) set_extent has set the prune condition FALSE. Under these conditions, clipping may be disabled for the planes that set_extent determined were not crossed by the bounding box of the extent specified in that call. If that extent surrounds all primitives in segment segno, including any segments it calls, the clip-plane disabling will have no visual effect on the drawing of the segment, nor will it affect which primitives are picked in the segment. However, any disabling performed will improve drawing or picking speed within segment segno.
EXAMPLES
Typical uses of cond_call_segment are illustrated by the following examples. (In all examples, cond_execute_segment can be substituted for cond_call_segment with equivalent results.)
1. cond_call_segment( fd, CI_FALSE, TRUE, 1 );
During traversal, the above element will never traverse segment 1.
2. adapt_clip_to_extent( fd, TRUE );
set_extent( fd, mc_extent );
cond_call_segment( fd, CI_PRUNE, FALSE, 2 );
The cond_call_segment element above will call segment 2 if and only if set_extent sets the prune condition to FALSE. Assuming that the extent described by mc_extent surrounds the primitives in segment 2, segment 2 is not drawn needlessly if it is outside the clip boundaries. Furthermore, because adapt_clip_to_extent was called with a TRUE value, unnecessary clipping is disabled, thereby further improving performance.
3. set_cull_size( fd, 10.0 );
set_extent( fd, mc_extent );
cond_call_segment( fd, CI_CULL, TRUE, 3 );
cond_call_segment( fd, CI_CULL, FALSE, 4 );
When the above elements are traversed, if the length of the diagonal computed from mc_extent is less than 10 DC units, segment 3 is drawn. Otherwise, segment 4 is drawn. Typically, segment 3 would contain a less detailed representation of the contents of segment 4.
ERRORS
1 Graphics device is not initialized for this operation.
20 Parameter value is out of range.
24 Segment not open.
SEE ALSO
adapt_clip_to_extent(3G), call_segment(3G), cond_execute_segment(3G),
cond_return(3G), inq_cond_index(3G), set_extent(3G).
Hewlett-Packard Company — HP-UX Release 9.0: August 1992