#include <DrawMesh.h>
Base class for mesh drawing using Curiously Recurring Template Pattern (CRTP) More...

Base class for mesh drawing using Curiously Recurring Template Pattern (CRTP)
Public Attributes | |
| SReal | elementSpace { 0.125_sreal } |
Static Public Attributes | |
| static constexpr std::size_t | NumberColors { NumberColors_ } |
Protected Attributes | |
| std::array< sofa::type::vector< sofa::type::Vec3 >, NumberColors > | renderedPoints |
| Pre-allocated point buffers for rendering different color channels. More... | |
Public Member Functions | |
| template<class PositionContainer > | |
| void | drawAllElements (sofa::helper::visual::DrawTool *drawTool, const PositionContainer &position, sofa::core::topology::BaseMeshTopology *topology, const ColorContainer &colors=Derived::defaultColors) |
| Draws all elements of the mesh using provided colors. More... | |
| template<class PositionContainer , class IndicesContainer > | |
| void | drawSomeElements (sofa::helper::visual::DrawTool *drawTool, const PositionContainer &position, sofa::core::topology::BaseMeshTopology *topology, const IndicesContainer &elementIndices, const ColorContainer &colors=Derived::defaultColors) |
| Draws a subset of elements of the mesh using provided colors. More... | |
Protected Member Functions | |
| template<class PositionType > | |
| PositionType | applyElementSpace (const PositionType &position, const PositionType &elementCenter) const |
Static Protected Member Functions | |
| template<class PositionContainer , class ElementType > | |
| static PositionContainer::value_type | elementCenter (const PositionContainer &position, const ElementType &element) |
| SReal sofa::core::visual::BaseDrawMesh< Derived, NumberColors_ >::elementSpace { 0.125_sreal } |
|
staticconstexpr |
|
protected |
Pre-allocated point buffers for rendering different color channels.
This static array holds pre-allocated vertex position buffers for each color channel.
Key characteristics:
NumberColors color channels (e.g., 3 for triangles)
|
inlineprotected |
|
inline |
Draws all elements of the mesh using provided colors.
This function draws all elements of the mesh (from index 0 to the total number of elements) using the specified colors. It serves as a convenience wrapper that calls drawSomeElements with all element indices.
| PositionContainer | The type of the position container (e.g., sofa::type::vector<sofa::type::Vec3>) |
| drawTool | The drawing tool to use for rendering |
| position | The container of vertex positions |
| topology | The mesh topology |
| colors | The colors to use for each element. If not specified, the default colors of the derived class are used. |
|
inline |
Draws a subset of elements of the mesh using provided colors.
This function draws a specific subset of elements (specified by element indices) using the provided colors.
| PositionContainer | The type of the position container (e.g., sofa::type::vector<sofa::type::Vec3>) |
| IndicesContainer | The type of container holding element indices (e.g., sofa::type::vector<sofa::Index>) |
| drawTool | The drawing tool to use for rendering |
| position | The container of vertex positions |
| topology | The mesh topology |
| elementIndices | The indices of elements to draw |
| colors | The colors to use for each element. If not specified, the default colors of the derived class are used. |
|
inlinestaticprotected |