Reference_Geometry

Functions

HC_KEY Reference_Geometry (const char *segname)
 Directs HOOPS to create a reference to some geometry when processing a segment. More...
 
HC_KEY Reference_Geometry_By_Key (HC_KEY geom_key)
 Similar to Reference_Geometry(), but references a particular item, rather than a segment and all of its contents. More...
 
HC_KEY Reference_Geometry_Key_By_Key (HC_KEY target_segment, HC_KEY reference_key)
 Similar to Reference_Geometry(), but operates on the segment identified by target_segment instead of the currently open segment. More...
 

Detailed Description

Function Documentation

◆ Reference_Geometry()

HC_KEY Reference_Geometry ( const char *  segname)

Directs HOOPS to create a reference to some geometry when processing a segment.

Parameters
segname- Name, possibly including wildcards and lists, of extra segment(s) from which the geometry should be included when displaying the current segment.
Returns
Unique numeric identifier to the reference. This is not the same as the key of the geometry being referenced.

DETAILS

Reference_Geometry() inserts a request into the currently open segment. The request asks that whenever this segment is displayed, the referenced geometry should be searched for and included as part of the scene, as if it had already existed in the segment. If the referenced geometry is a segment, all the geometry within that segment is included.

The difference between Reference_Geometry() and Copy_Geometry() is that Copy_Geometry() actually makes a copy of the referenced geometry. The user would call Copy_Geometry() to make changes and leave the original geometry alone. To simply 'reuse' a piece of geometry by referencing it, use Reference_Geometry() and gain the memory savings.

Referenced geometry does not come with any of the attributes from the segment in which it resides, unless the geometry has attributes applied to it directly via Open_Geometry(). To correct referenced geometry for its original color and/or modelling matrix, simply open up the reference via Open_Geometry() and apply the needed attributes to it. For example:

     HC_KEY shellKey = HC_Insert_Shell(...);

     HC_Open_Segment("front axle")
       HC_KEY ref_key = HC_Reference_Geometry_By_Key (shellKey);
       HC_Open_Geometry (ref_key);
       HC_Translate_Object (-0.5, 0.5, 0.0);
       HC_Set_Color ("red");
       HC_Close_Geometry ();
     HC_Close_Segment();

See also
Copy_Geometry, Open_Geometry, Conditional_Reference, Show_Conditional_Reference, Show_Reference_Geometry

◆ Reference_Geometry_By_Key()

HC_KEY Reference_Geometry_By_Key ( HC_KEY  geom_key)

Similar to Reference_Geometry(), but references a particular item, rather than a segment and all of its contents.

Parameters
geom_key- Key to the geometry that should be included when displaying the current segment.
Returns
Unique numeric identifier to the reference. This is not the same as the key of the geometry being referenced.

DETAILS

No additional details. See Reference_Geometry().

◆ Reference_Geometry_Key_By_Key()

HC_KEY Reference_Geometry_Key_By_Key ( HC_KEY  target_segment,
HC_KEY  reference_key 
)

Similar to Reference_Geometry(), but operates on the segment identified by target_segment instead of the currently open segment.

Parameters
target_segment- Key to a segment that will reference the geometry.
reference_key- Key to the geometry that should be included when displaying the target segment.
Returns
Unique numeric identifier to the reference. This is not the same as the key of the geometry being referenced.

DETAILS

No additional details. See Reference_Geometry().