Debian Codegraph @

include/BALL/VIEW/RENDERING/RENDERERS/STLRenderer.h

raw symbols SCIP
1 //STLRenderer: Version 1.0 (2008.09.12) Annette Treichel
2
3 #ifndef BALL_VIEW_RENDERING_RENDERERS_STLRENDERER_H
4 #define BALL_VIEW_RENDERING_RENDERERS_STLRENDERER_H
5
6 #ifndef BALL_VIEW_RENDERING_RENDERERS_RENDERER_H
7 # include <BALL/VIEW/RENDERING/RENDERERS/renderer.h>
8 #endif
9
10 #ifndef BALL_SYSTEM_FILE_H
11 # include <BALL/SYSTEM/file.h>
12 #endif
13
14 #ifndef BALL_MATHS_VECTOR3_H
15 # include <BALL/MATHS/vector3.h>
16 #endif
17
18 #ifndef BALL_MATHS_MATRIX44_H
19 # include <BALL/MATHS/matrix44.h>
20 #endif
21
22 namespace BALL
23 {
24 namespace VIEW
25 {
26
27 /** STLRenderer class.
28 Representation of all primitives as Meshes in stl
29 ==> extrernal rendering of the same scene
30 <br>
31 <br>
32 \ingroup ViewRendering
33 */
34
35 class BALL_VIEW_EXPORT STLRenderer
36 : public Renderer
37 {
38 public:
39
40 /** @name Constructors and Destructors.
41 */
42 //@{
43
44 /// Default constructor.
45 STLRenderer();
46
47 /** Detailed constructor.
48 \param name The name of the file we will create
49 \exception BALL::Exception::FileNotFound
50 */
51 STLRenderer(const String& name);
52
53 /// Destructor.
54 virtual ~STLRenderer();
55
56 /// Clear method.
57 virtual void clear();
58
59 //@}
60 /** @name Accessors
61 */
62 //@{
63
64 /** Sets the name of the file we will create.
65 \param name The file name
66 \exception BALL::Exception::FileNotFound
67 */
68 void setFileName(const String& name);
69
70
71 /** Converts a Vector3 into a String in VRML format as stl works in the same perspektive.
72 */
73 String VRMLVector3(Vector3 input);
74
75 //@}
76 /** @name Processor specific methods
77 */
78 //@{
79
80 /** Start method.
81 This method creates the file and writes the header.
82 */
83 virtual bool init(const Stage& stage);
84
85 /** Finish method.
86 This method writes the ending of the file and closes it.
87 */
88 virtual bool finish();
89
90 //@}
91
92 void renderSphere_(const Sphere& sphere);
93
94 void renderMesh_(const Mesh& mesh);
95
96 void renderTube_(const Tube& tube);
97
98 void renderTwoColoredTube_(const TwoColoredTube& tube);
99
100 void renderLine_(const Line& tube);
101
102 void renderTwoColoredLine_(const TwoColoredLine& tube);
103
104 void out_(const String& data);
105
106 void outheader_(const String& data)
107 {out_(data); current_indent_ += 1;}
108
109 void outfinish_(const String& data)
110 {out_(data); current_indent_ -= 1;}
111
112 Size width, height;
113
114 protected:
115
116 void header_(const Vector3& translation, const ColorRGBA& color,
117 const String& rotation = "");
118
119 void footer_();
120
121 File outfile_;
122
123 Vector3 origin_;
124 Matrix4x4 rotation_;
125 Index current_indent_;
126 String endingName_;
127 };
128
129 } } // namespaces
130
131 #endif // BALL_VIEW_RENDERING_STLRENDERER_H
132