Avogadro::Rendering::PLYVisitor#
-
class PLYVisitor : public TessellatingVisitor#
Visitor that visits scene elements and creates an ASCII PLY file.
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).
Unnamed Group
-
inline void setCenter(const Vector3f ¢er)#
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.
-
inline 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.
-
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.
-
inline 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.
Public Functions
-
~PLYVisitor() override#
-
inline void setBinary(bool binary)#
Binary little-endian (default) or ASCII output.
-
inline bool binary() const#
-
bool write(std::ostream &out) const#
Stream the PLY file for everything visited since begin().
- Returns:
false if the stream failed.
-
inline void setBackgroundColor(const Vector3ub &c)#
-
inline void setAmbientColor(const Vector3ub &c)#
-
inline void setAspectRatio(float ratio)#
-
inline void setCenter(const Vector3f ¢er)#