Line shapes

As its name says, the line shape is intended to display lines. It can display two kinds of lines:

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:

RED::ILineShapeLine management API.
RED::IShapeGlobal shape API. Controls shape tree navigation and shape attributes.
RED::IUserDataUser data API to store application custom data associated to a shape.
RED::IChunkSaverShape serialization interface.
RED::IReferenceSolvingShape serialization interface.

The line shape works exactly as the mesh does: APIs are very similar for the management of data arrays: See Geometry definition APIs for all the details. However, the registration of segments to draw or strip to draw uses other methods:

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.

Also 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 REDsdk. However, line thickness and line stipple patterns are only available in GPU rendering modes.