AvogadroLibs 2.1.0-20261111
Loading...
Searching...
No Matches
TessellatingVisitor Class Reference

Visitor that converts every drawable into triangle meshes. More...

#include <tessellatingvisitor.h>

Inheritance diagram for TessellatingVisitor:
Visitor PLYVisitor

Public Member Functions

void begin ()
void clear ()
const std::vector< TessellatedMesh > & meshes () const
bool bounds (Vector3f &minimum, Vector3f &maximum) const
void setSphereLevelRange (unsigned int minLevel, unsigned int maxLevel)
unsigned int sphereLevelForRadius (float radius)
float sphereMaxEdgeAngle (unsigned int level)
void visit (Node &) override
void visit (GroupNode &) override
void visit (GeometryNode &) override
void visit (Drawable &) override
void visit (SphereGeometry &geometry) override
void visit (CurveGeometry &geometry) override
void visit (CylinderGeometry &geometry) override
void visit (MeshGeometry &geometry) override
void visit (TextLabel2D &) override
void visit (TextLabel3D &) override
void visit (LineStripGeometry &geometry) override
void visit (WideLineGeometry &geometry) override
void visit (DashedLineGeometry &geometry) override
void visit (ArrowGeometry &geometry) override
void visit (VolumeGeometry &) override
void setTessellationTolerance (float angstrom)
float tessellationTolerance () const
void setSphereSubdivisions (unsigned int level)
unsigned int sphereSubdivisions () const
void useAdaptiveSpheres ()
void setCylinderSides (unsigned int sides)
unsigned int cylinderSides () const
void useAdaptiveCylinders ()
unsigned int cylinderSidesForRadius (float radius) const
void setLineRadius (float radius)
float lineRadius () const

Detailed Description

<avogadro/rendering/tessellatingvisitor.h>

This is the shared basis of the mesh-based scene exporters (PLY, glTF, ...). One TessellatedMesh is recorded per visited drawable (curve geometry with several lines is merged into a single mesh), in visiting order. Colors are not shaded: lighting is left to the consumer.

Text labels and volume rendering cannot be expressed as triangle meshes and are skipped.

Member Function Documentation

◆ begin()

void begin ( )

Discard all meshes recorded so far. Equivalent to clear().

◆ bounds()

bool bounds ( Vector3f & minimum,
Vector3f & maximum ) const

Axis-aligned bounding box of all vertices in meshes().

Returns
false (leaving the arguments untouched) if there are none.

◆ setTessellationTolerance()

void setTessellationTolerance ( float angstrom)

Geometric tolerance in Angstrom: the largest distance between a tessellated sphere or cylinder surface and the true surface. Unless fixed explicitly (below), the sphere subdivision level and the cylinder side count are chosen per primitive from its radius to meet this tolerance. Non-finite or non-positive values are ignored. Default 0.05.

◆ tessellationTolerance()

float tessellationTolerance ( ) const

Geometric tolerance in Angstrom: the largest distance between a tessellated sphere or cylinder surface and the true surface. Unless fixed explicitly (below), the sphere subdivision level and the cylinder side count are chosen per primitive from its radius to meet this tolerance. Non-finite or non-positive values are ignored. Default 0.05.

◆ setSphereLevelRange()

void setSphereLevelRange ( unsigned int minLevel,
unsigned int maxLevel )

Range (0 to 6) of icosphere subdivision levels the adaptive choice may use. Default 1 (42 vertices) to 5 (10242 vertices).

◆ sphereLevelForRadius()

unsigned int sphereLevelForRadius ( float radius)

Smallest level in the range whose maximum sagitta, radius * (1 - cos(theta / 2)) with theta the largest angle subtended by an edge of that level's icosphere, is within the tolerance (the maximum level if none is).

◆ sphereMaxEdgeAngle()

float sphereMaxEdgeAngle ( unsigned int level)

The largest angle (radians) subtended by an edge of a level's mesh.

◆ setSphereSubdivisions()

void setSphereSubdivisions ( unsigned int level)

Use a fixed number of icosphere subdivisions (0 to 6) for every sphere, instead of the adaptive choice. Level 3 has 1280 triangles, 642 vertices.

◆ sphereSubdivisions()

unsigned int sphereSubdivisions ( ) const

The fixed level, or the minimum level of the range when adaptive.

◆ useAdaptiveSpheres()

void useAdaptiveSpheres ( )

Use a fixed number of icosphere subdivisions (0 to 6) for every sphere, instead of the adaptive choice. Level 3 has 1280 triangles, 642 vertices.

◆ setCylinderSides()

void setCylinderSides ( unsigned int sides)

Use a fixed number of sides (at least 3) for every cylinder instead of the adaptive choice, which is the smallest n >= 8 (at most 48) with radius * (1 - cos(pi / n)) within the tolerance.

◆ cylinderSides()

unsigned int cylinderSides ( ) const

Use a fixed number of sides (at least 3) for every cylinder instead of the adaptive choice, which is the smallest n >= 8 (at most 48) with radius * (1 - cos(pi / n)) within the tolerance.

◆ useAdaptiveCylinders()

void useAdaptiveCylinders ( )

Use a fixed number of sides (at least 3) for every cylinder instead of the adaptive choice, which is the smallest n >= 8 (at most 48) with radius * (1 - cos(pi / n)) within the tolerance.

◆ cylinderSidesForRadius()

unsigned int cylinderSidesForRadius ( float radius) const

Use a fixed number of sides (at least 3) for every cylinder instead of the adaptive choice, which is the smallest n >= 8 (at most 48) with radius * (1 - cos(pi / n)) within the tolerance.

◆ setLineRadius()

void setLineRadius ( float radius)

Tube radius (in scene units, Angstrom) of one pixel of GL line width. Dashed lines, line strips and flat curves have no world-space width, only a width in pixels, so their tubes get radius lineRadius * width (width is at least 1). WideLineGeometry already has a world-space width and ignores this value. Default 0.02.

◆ lineRadius()

float lineRadius ( ) const

Tube radius (in scene units, Angstrom) of one pixel of GL line width. Dashed lines, line strips and flat curves have no world-space width, only a width in pixels, so their tubes get radius lineRadius * width (width is at least 1). WideLineGeometry already has a world-space width and ignores this value. Default 0.02.

◆ visit() [1/15]

void visit ( Node & )
overridevirtual

The overloaded visit functions, the base versions of which do nothing.

Reimplemented from Visitor.

◆ visit() [2/15]

void visit ( GroupNode & )
overridevirtual

Reimplemented from Visitor.

◆ visit() [3/15]

void visit ( GeometryNode & )
overridevirtual

Reimplemented from Visitor.

◆ visit() [4/15]

void visit ( Drawable & )
overridevirtual

Reimplemented from Visitor.

◆ visit() [5/15]

void visit ( SphereGeometry & geometry)
overridevirtual

Reimplemented from Visitor.

◆ visit() [6/15]

void visit ( CurveGeometry & geometry)
overridevirtual

Reimplemented from Visitor.

◆ visit() [7/15]

void visit ( CylinderGeometry & geometry)
overridevirtual

Reimplemented from Visitor.

◆ visit() [8/15]

void visit ( MeshGeometry & geometry)
overridevirtual

Reimplemented from Visitor.

◆ visit() [9/15]

void visit ( TextLabel2D & )
overridevirtual

Reimplemented from Visitor.

◆ visit() [10/15]

void visit ( TextLabel3D & )
overridevirtual

Reimplemented from Visitor.

◆ visit() [11/15]

void visit ( LineStripGeometry & geometry)
overridevirtual

Reimplemented from Visitor.

◆ visit() [12/15]

void visit ( WideLineGeometry & geometry)
overridevirtual

Reimplemented from Visitor.

◆ visit() [13/15]

void visit ( DashedLineGeometry & geometry)
overridevirtual

Reimplemented from Visitor.

◆ visit() [14/15]

void visit ( ArrowGeometry & geometry)
overridevirtual

Reimplemented from Visitor.

◆ visit() [15/15]

void visit ( VolumeGeometry & )
overridevirtual

Reimplemented from Visitor.


The documentation for this class was generated from the following file: