|
AvogadroLibs 2.0.0
|
Renders line segments as camera-facing quads for wide line support. More...
#include <widelinegeometry.h>
Classes | |
| struct | PackedVertex |
Public Member Functions | |
| WideLineGeometry (const WideLineGeometry &other) | |
| WideLineGeometry & | operator= (WideLineGeometry) |
| void | accept (Visitor &) override |
| void | render (const Camera &camera) override |
| Render the wide line geometry. | |
| void | clear () override |
| void | addLine (const Vector3f &start, const Vector3f &end, const Vector3ub &colorStart, const Vector3ub &colorEnd, float lineWidth) |
| void | addLine (const Vector3f &start, const Vector3f &end, const Vector3ub &color, float lineWidth) |
| void | addLineStrip (const Core::Array< Vector3f > &vertices, const Vector3ub &color, float lineWidth) |
| void | addLineStrip (const Core::Array< Vector3f > &vertices, const Core::Array< Vector3ub > &colors, float lineWidth) |
| void | addDashedLine (const Vector3f &start, const Vector3f &end, const Vector3ub &color, float lineWidth, int dashCount) |
| void | reserve (size_t lineCount) |
| const std::vector< PackedVertex > & | vertices () const |
| size_t | lineCount () const |
| void | setColor (const Vector3ub &c) |
| Vector3ub | color () const |
| void | setOpacity (unsigned char opacity_) |
| unsigned char | opacity () const |
| Public Member Functions inherited from Drawable | |
| Drawable (const Drawable &other) | |
| Drawable & | operator= (Drawable) |
| const GeometryNode * | parent () const |
| Get a pointer to the drawable object's parent. | |
| GeometryNode * | parent () |
| void | setVisible (bool visibility) |
| Set the visibility of the drawable object. | |
| bool | isVisible () const |
| Get the current visibility of the drawable. | |
| Identifier & | identifier () |
| const Identifier & | identifier () const |
| virtual std::multimap< float, Identifier > | hits (const Vector3f &rayOrigin, const Vector3f &rayEnd, const Vector3f &rayDirection) const |
| virtual Core::Array< Identifier > | areaHits (const Frustrum &f) const |
| void | setRenderPass (RenderPass pass) |
| RenderPass | renderPass () const |
Static Public Attributes | |
| static constexpr float | lineWidthScale = 0.035f |
Additional Inherited Members | |
| Protected Member Functions inherited from Drawable | |
| void | setParent (GeometryNode *parent) |
| Set the parent node for the node. | |
| Protected Attributes inherited from Drawable | |
| GeometryNode * | m_parent |
| bool | m_visible |
| RenderPass | m_renderPass |
| Identifier | m_identifier |
<avogadro/rendering/widelinegeometry.h>
OpenGL 4.0 Core Profile does not guarantee glLineWidth() > 1.0. This class renders each line segment as a quad (two triangles) whose width is computed in the vertex shader, producing correct wide lines on all platforms.
Supports both solid and dashed lines. Dashing is implemented in the fragment shader using a per-vertex lineParam attribute — no extra geometry is needed.
Width is specified in world-space units.
|
overridevirtual |
Accept a visit from our friendly visitor.
Reimplemented from Drawable.
|
overridevirtual |
| camera | The current camera to be used for rendering. |
Reimplemented from Drawable.
|
overridevirtual |
Clear the contents of the node.
Reimplemented from Drawable.
| void addLine | ( | const Vector3f & | start, |
| const Vector3f & | end, | ||
| const Vector3ub & | colorStart, | ||
| const Vector3ub & | colorEnd, | ||
| float | lineWidth ) |
Add a single solid line segment.
| start | Start position of the line segment. |
| end | End position of the line segment. |
| colorStart | Color at the start. |
| colorEnd | Color at the end. |
| lineWidth | Width of the line in world-space units. |
| void addLine | ( | const Vector3f & | start, |
| const Vector3f & | end, | ||
| const Vector3ub & | color, | ||
| float | lineWidth ) |
Add a single solid line segment with a uniform color.
| void addLineStrip | ( | const Core::Array< Vector3f > & | vertices, |
| const Vector3ub & | color, | ||
| float | lineWidth ) |
Add a connected strip of line segments from consecutive vertices. Each adjacent pair of vertices becomes one line segment.
| vertices | The vertices forming the line strip. |
| color | Uniform color for the strip. |
| lineWidth | Width of the lines in world-space units. |
| void addLineStrip | ( | const Core::Array< Vector3f > & | vertices, |
| const Core::Array< Vector3ub > & | colors, | ||
| float | lineWidth ) |
Add a connected strip with per-vertex colors.
| void addDashedLine | ( | const Vector3f & | start, |
| const Vector3f & | end, | ||
| const Vector3ub & | color, | ||
| float | lineWidth, | ||
| int | dashCount ) |
Add a dashed line segment.
| start | Start position. |
| end | End position. |
| color | Line color. |
| lineWidth | Width in world-space units. |
| dashCount | Number of dashes. |
| void setColor | ( | const Vector3ub & | c | ) |
The default color of the lines.
| Vector3ub color | ( | ) | const |
The default color of the lines.
| void setOpacity | ( | unsigned char | opacity_ | ) |
The default opacity of the lines.
| unsigned char opacity | ( | ) | const |
The default opacity of the lines.
| void reserve | ( | size_t | lineCount | ) |
Reserve space for the given number of line segments. Each segment uses 4 vertices and 6 indices.
| const std::vector< PackedVertex > & vertices | ( | ) | const |
The vertex array (for geometry bounds computation).
| size_t lineCount | ( | ) | const |
The number of line segments.
|
staticconstexpr |
Scale factor converting legacy pixel-based widths to world-space units.