Debian Codegraph @

avogadro/rendering/vrmlvisitor.h

raw
1 /******************************************************************************
2 This source file is part of the Avogadro project.
3 This source code is released under the 3-Clause BSD License, (see "LICENSE").
4 ******************************************************************************/
5
6 #ifndef AVOGADRO_RENDERING_VRMLVISITOR_H
7 #define AVOGADRO_RENDERING_VRMLVISITOR_H
8
9 #include "visitor.h"
10
11 #include "avogadrorendering.h"
12 #include "camera.h"
13 #include <string>
14
15 namespace Avogadro {
16 namespace Rendering {
17
18 /**
19 * @class VRMLVisitor vrmlvisitor.h <avogadro/rendering/vrmlvisitor.h>
20 * @brief Visitor that visits scene elements and creates a VRML input file.
21 *
22 * This visitor will render elements in the scene to a text file that contains
23 * elements that can be rendered as VRML.
24 */
25
26 class AVOGADRORENDERING_EXPORT VRMLVisitor : public Visitor
27 {
28 public:
29 VRMLVisitor(const Camera& camera);
30 ~VRMLVisitor() override;
31
32 void begin();
33 std::string end();
34
35 /**
36 * The overloaded visit functions, the base versions of which do nothing.
37 */
38 void visit(Node&) override { return; }
39 void visit(GroupNode&) override { return; }
40 void visit(GeometryNode&) override { return; }
41 void visit(Drawable&) override;
42 void visit(SphereGeometry&) override;
43 void visit(AmbientOcclusionSphereGeometry&) override;
44 void visit(CurveGeometry&) override { return; }
45 void visit(CylinderGeometry&) override;
46 void visit(MeshGeometry&) override;
47 void visit(TextLabel2D&) override { return; }
48 void visit(TextLabel3D&) override { return; }
49 void visit(LineStripGeometry& geometry) override;
50
51 void setCamera(const Camera& c) { m_camera = c; }
52 Camera camera() const { return m_camera; }
53
54 void setBackgroundColor(const Vector3ub& c) { m_backgroundColor = c; }
55 void setAmbientColor(const Vector3ub& c) { m_ambientColor = c; }
56 void setAspectRatio(float ratio) { m_aspectRatio = ratio; }
57
58 private:
59 Camera m_camera;
60 Vector3ub m_backgroundColor;
61 Vector3ub m_ambientColor;
62 float m_aspectRatio;
63 std::string m_sceneData;
64 };
65
66 } // End namespace Rendering
67 } // End namespace Avogadro
68
69 #endif // AVOGADRO_RENDERING_VRMLVISITOR_H