Debian Codegraph @

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

raw symbols SCIP
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4
5 #ifndef BALL_VIEW_RENDERING_RENDERERS_VRMLRENDERER_H
6 #define BALL_VIEW_RENDERING_RENDERERS_VRMLRENDERER_H
7
8 #ifndef BALL_VIEW_RENDERING_RENDERERS_RENDERER_H
9 # include <BALL/VIEW/RENDERING/RENDERERS/renderer.h>
10 #endif
11
12 #ifndef BALL_SYSTEM_FILE_H
13 # include <BALL/SYSTEM/file.h>
14 #endif
15
16 #ifndef BALL_MATHS_VECTOR3_H
17 # include <BALL/MATHS/vector3.h>
18 #endif
19
20 #ifndef BALL_MATHS_MATRIX44_H
21 # include <BALL/MATHS/matrix44.h>
22 #endif
23
24 namespace BALL
25 {
26 namespace VIEW
27 {
28 class ColorRGBA;
29
30 /** VRMLRenderer class.
31 This class walks over all the geometric primitives in a Scene
32 and exports them into a data file in the VRML format, which can
33 be used to render the same scene externally.
34 <br>
35 <br>
36 This is unmaintained code!
37 \ingroup ViewRendering
38 @deprecated Use STL renderer instead
39 */
40 class BALL_DEPRECATED BALL_VIEW_EXPORT VRMLRenderer : public Renderer
41 {
42 public:
43
44 /** @name Constructors and Destructors.
45 */
46 //@{
47
48 /// Default constructor.
49 VRMLRenderer();
50
51 /** Detailed constructor.
52 \param name The name of the file we will create
53 \exception BALL::Exception::FileNotFound
54 */
55 VRMLRenderer(const String& name);
56
57 /// Destructor.
58 virtual ~VRMLRenderer();
59
60 /// Clear method.
61 virtual void clear();
62
63 //@}
64 /** @name Accessors
65 */
66 //@{
67
68 /** Sets the name of the file we will create.
69 \param name The file name
70 \exception BALL::Exception::FileNotFound
71 */
72 void setFileName(const String& name);
73
74 /** Converts a ColorRGBA into a String in VRMLRay format.
75 */
76 String VRMLColorRGBA(const ColorRGBA& input);
77
78 /** Converts a Vector3 into a String in VRMLRay format.
79 */
80 String VRMLVector3(Vector3 input);
81
82 ///
83 void VRMLColor(const ColorRGBA& color);
84
85 //@}
86 /** @name Processor specific methods
87 */
88 //@{
89
90 /** Start method.
91 This method creates the file and writes the header.
92 */
93 virtual bool init(const Stage& stage);
94
95 /** Finish method.
96 This method writes the ending of the file and closes it.
97 */
98 virtual bool finish();
99
100 //@}
101
102 void renderSphere_(const Sphere& sphere);
103
104 void renderMesh_(const Mesh& mesh);
105
106 void renderLine_(const Line& miniTube);
107
108 void renderTwoColoredLine_(const TwoColoredLine& miniTube);
109
110 void renderTube_(const Tube& tube);
111
112 void renderTwoColoredTube_(const TwoColoredTube& tube);
113
114 void out_(const String& data);
115
116 void outheader_(const String& data)
117 {out_(data); current_indent_ += 1;}
118
119 void outfinish_(const String& data)
120 {out_(data); current_indent_ -= 1;}
121
122 Size width, height;
123
124 protected:
125
126 void header_(const Vector3& translation, const ColorRGBA& color,
127 const String& rotation = "");
128
129 void footer_();
130
131 File outfile_;
132
133 Vector3 origin_;
134 Matrix4x4 rotation_;
135 Index current_indent_;
136
137 //size estimate for afterwards scaling for printing
138 float smallX, smallY, smallZ, bigX, bigY, bigZ;
139
140 //boolean showing if scaling is relevant afterall
141 bool scalingUsed;
142 };
143
144 } } // namespaces
145
146 #endif // BALL_VIEW_RENDERING_VRMLRENDERER_H