BALL  1.5.0
XML3DRenderer.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 
5 #ifndef BALL_VIEW_RENDERING_RENDERERS_XML3DRENDERER_H
6 #define BALL_VIEW_RENDERING_RENDERERS_XML3DRENDERER_H
7 
8 #ifndef 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 #ifndef BALL_MATHS_SURFACE_H
25 # include <BALL/MATHS/surface.h>
26 #endif
27 
28 namespace BALL
29 {
30  namespace VIEW
31  {
32  class ColorRGBA;
33  class ClippingPlane;
34 
44  {
45  public:
46 
48 
50  {
51  public:
53  float translation;
54 // Vector3 translation;
55  };
56 
60 
63 
68  XML3DRenderer(const String& name);
69 
70  XML3DRenderer(std::ostream& name);
71 
72  // Only for Python
73  XML3DRenderer(const XML3DRenderer& renderer);
74 
75 
77  virtual ~XML3DRenderer();
78 
80  virtual void clear();
81 
83 
86 
87  virtual void setSize(float width, float height);
88 
93  void setFileName(const String& name);
94 
96  void setOstream(std::ostream& out_stream);
97 
99  void setHumanReadable(bool state)
100  { human_readable_ = state;}
101 
103  bool isHumanReadable() const
104  { return human_readable_;}
105 
108  String XML3DColorRGBA(const ColorRGBA& input, const String& name);
109 
112  String XML3DFinish(const String& object, const ColorRGBA& input);
113 
117 
121 
124  String XML3DString(const String& input);
125 
126  virtual bool renderOneRepresentation(const Representation& representation);
127 
129 
133 
136  virtual bool init(Scene& scene);
137 
141  virtual bool init(const Stage& stage, float width, float height);
142 
146  virtual bool finish();
147 
149 
151 
152  void renderSphere_(const Sphere& sphere);
153 
154  void renderDisc_(const Disc& /* disc */);
155 
156  void renderTube_(const Tube& /* tube */);
157 
159 
160  void renderMesh_(const Mesh& mesh);
161 
162  void renderTwoColoredLine_(const TwoColoredLine& /* line */);
163 
164  void renderLine_(const Line& /* line */);
165 
166  void renderPoint_(const Point& /* point */);
167 
168  // do nothing
169  void renderLabel_(const Label&);
170 
172  virtual void renderMultiLine_(const MultiLine& line);
173 
175 
176  protected:
177 
178  const ColorRGBA& getColor_(const GeometricObject& object);
179 
180  std::ostream* outfile_;
181  String trimFloatValue_(float value);
182  void storeColor_(const GeometricObject& object);
186 
187 
190  vector<ClippingPlane*> clipping_planes_;
192 
195  vector<const Representation*> representations_;
198  double m_[12];
201 
204 
206 
209 
210  float fov_x_;
211  float fov_y_;
212  };
213 
214  } // namespace BALL
215 } // namespace VIEW
216 
217 #endif // BALL_VIEW_RENDERING_XML3DRENDERER_H
#define BALL_CREATE(name)
Definition: create.h:62
Definition: constants.h:13
BALL_INDEX_TYPE Index
XML3DRenderer()
Default constructor.
void renderLine_(const Line &)
Render a line.
String getColorIndex_(const ColorRGBA &color)
void renderLabel_(const Label &)
XML3DRenderer(const String &name)
void renderTwoColoredTube_(const TwoColoredTube &tube)
Render a tube with two colors.
void renderSphere_(const Sphere &sphere)
Render a sphere.
String XML3DRaytracingMaterial(const Stage::Material &)
String XML3DFinish(const String &object, const ColorRGBA &input)
String XML3DVector3(Vector3 input)
vector< ClippingPlane * > clipping_planes_
void storeColor_(const GeometricObject &object)
void createTubeTransform_(const TwoColoredTube &tube)
virtual void clear()
Clear method.
void setOstream(std::ostream &out_stream)
Set a stream as output device.
XML3DRenderer(const XML3DRenderer &renderer)
HashSet< String > color_strings_
void renderPoint_(const Point &)
Render a single point.
virtual bool renderOneRepresentation(const Representation &representation)
String XML3DColorRGBA(const ColorRGBA &input, const String &name)
void setFileName(const String &name)
void renderDisc_(const Disc &)
Render a disc.
virtual bool init(Scene &scene)
XML3DRenderer(std::ostream &name)
void renderTube_(const Tube &)
Render a tube.
virtual void renderMultiLine_(const MultiLine &line)
Render an illuminated line.
HashMap< String, Size > ColorMap
HashSet< const Mesh * > wireframes_
Stage::Material rt_material_
String trimFloatValue_(float value)
vector< const Representation * > representations_
void renderTwoColoredLine_(const TwoColoredLine &)
Render a line with two colors.
virtual void setSize(float width, float height)
Set the size of the display.
virtual ~XML3DRenderer()
Destructor.
String XML3DString(const String &input)
virtual bool init(const Stage &stage, float width, float height)
const ColorRGBA & getColor_(const GeometricObject &object)
void renderMesh_(const Mesh &mesh)
Render a surface mesh.
void setHumanReadable(bool state)
Definition: XML3DRenderer.h:99
#define BALL_DEPRECATED
Definition: COMMON/global.h:64
#define BALL_VIEW_EXPORT
Definition: COMMON/global.h:52