Line Shapes
As its name says, the line shape is intended to display lines. It can display two kinds of lines:
Line strip
Line segments
The line shape is created using the RED::Factory
and the CID_REDLineShape
, as all other shapes: See Creating and Destroying Shapes for details. It implements the given set of interfaces:
Interface |
Description |
---|---|
|
Line management API. |
|
Global shape API. Controls shape tree navigation and shape attributes. |
|
User data API to store application custom data associated to a shape. |
|
Shape serialization interface. |
|
Shape serialization interface. |
The line shape works exactly as the mesh does: APIs are very similar for the management of data arrays: See the section Geometry Definition APIs
in the doc Mesh Shapes for all the details. However, the registration of segments to draw or strip to draw uses other methods:
RED::ILineShape::AddSegments
: used to register a list of segments to be drawn
RED::ILineShape::SetStrip
: used to register a single line strip to be drawn
As the Mesh Shapes, line shapes have a few topological services, such as the RED::ILineShape::Collapse
or RED::ILineShape::Parametrize
methods. As mesh shapes, line shapes can share their source data channels or segments array with an external provider.
Line Strip vs. Line Segments
The RED::ILineShape
interface allow the storage of one single line strip in the shape. The reason why the shape does not store many strips is all about rendering performances. Rendering several line strips require several rendering calls, whereas as many line segments as wished can be rendered using a single rendering call at the driver level. Therefore, unless strips are really needed, it’s better to use line segments for the performance of the display.
Line strips may be needed for the display of line stipple patterns, that can be defined by the RED::StateShader
of a rendering material. But even in this case, the RED::ILineShape::Parametrize
method can be used to get consistent stipple patterns with multiple line segments. Please refer to the method for details.
Note
That RED::ILineShape::AddStrips
turns the specified strips into line segments (and the display is made of line segments) while RED::ILineShape::SetStrip
sets the line shape to display the unique specified line strip.
Rendering Lines on the GPU or on the CPU
Line shapes can be fully processed by the GPU rendering. Line shapes can also be displayed by the software ray-tracer of HOOPS Luminate. However, line thickness and line stipple patterns are only available in GPU rendering modes.