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

Visitor that visits scene elements and creates an ASCII PLY file. More...

#include <avogadro/rendering/plyvisitor.h>

Inheritance diagram for PLYVisitor:
TessellatingVisitor Visitor

Public Member Functions

 PLYVisitor (const Camera &camera)
void setBinary (bool binary)
bool binary () const
bool write (std::ostream &out) const
std::string end ()
void setCamera (const Camera &c)
Camera camera () const
void setBackgroundColor (const Vector3ub &c)
void setAmbientColor (const Vector3ub &c)
void setAspectRatio (float ratio)
void setCenter (const Vector3f &center)
Vector3f center () const
void setScale (float scale)
float scale () const
Public Member Functions inherited from TessellatingVisitor
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

The scene is tessellated by TessellatingVisitor; write() and end() output all the resulting triangles as one PLY mesh with per-vertex positions, normals and RGBA colours (uchar).

The default format is binary_little_endian, written byte by byte so it does not depend on the host byte order: 28 bytes per vertex (6 floats, 4 uchar) and 13 bytes per face (uchar 3, 3 uint). Detailed scenes have millions of vertices, so prefer write() to a stream over end(). ASCII is available with setBinary(false).

Member Function Documentation

◆ setCenter()

void setCenter ( const Vector3f & center)

Output transform, applied to positions when writing only: p_out = (p - center) * scale. Normals are unchanged. The tessellated meshes (and the tessellation tolerance) stay in Angstrom. The defaults (origin, 1) leave positions as they are. A non-finite or non-positive scale is ignored.

◆ center()

Vector3f center ( ) const

Output transform, applied to positions when writing only: p_out = (p - center) * scale. Normals are unchanged. The tessellated meshes (and the tessellation tolerance) stay in Angstrom. The defaults (origin, 1) leave positions as they are. A non-finite or non-positive scale is ignored.

◆ setScale()

void setScale ( float scale)

Output transform, applied to positions when writing only: p_out = (p - center) * scale. Normals are unchanged. The tessellated meshes (and the tessellation tolerance) stay in Angstrom. The defaults (origin, 1) leave positions as they are. A non-finite or non-positive scale is ignored.

◆ scale()

float scale ( ) const

Output transform, applied to positions when writing only: p_out = (p - center) * scale. Normals are unchanged. The tessellated meshes (and the tessellation tolerance) stay in Angstrom. The defaults (origin, 1) leave positions as they are. A non-finite or non-positive scale is ignored.

◆ setBinary()

void setBinary ( bool binary)

Binary little-endian (default) or ASCII output.

◆ write()

bool write ( std::ostream & out) const

Stream the PLY file for everything visited since begin().

Returns
false if the stream failed.

◆ end()

std::string end ( )

The whole PLY file in memory (via write()); binary data if binary().


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