00001
00002
00003 #ifndef BALL_VIEW_RENDERING_STLRENDERER_H
00004 #define BALL_VIEW_RENDERING_STLRENDERER_H
00005
00006 #ifndef BALL_VIEW_RENDERING_RENDERER_H
00007 # include <BALL/VIEW/RENDERING/renderer.h>
00008 #endif
00009
00010 #ifndef BALL_SYSTEM_FILE_H
00011 # include <BALL/SYSTEM/file.h>
00012 #endif
00013
00014 #ifndef BALL_MATHS_VECTOR3_H
00015 # include <BALL/MATHS/vector3.h>
00016 #endif
00017
00018 #ifndef BALL_MATHS_MATRIX44_H
00019 # include <BALL/MATHS/matrix44.h>
00020 #endif
00021
00022 namespace BALL
00023 {
00024 namespace VIEW
00025 {
00026
00035 class BALL_VIEW_EXPORT STLRenderer
00036 : public Renderer
00037 {
00038 public:
00039
00043
00045 STLRenderer();
00046
00050 STLRenderer(const String& name)
00051 throw(Exception::FileNotFound);
00052
00054 virtual ~STLRenderer();
00055
00057 virtual void clear();
00058
00060
00063
00067 void setFileName(const String& name)
00068 throw(Exception::FileNotFound);
00069
00070
00073 String VRMLVector3(Vector3 input);
00074
00076
00079
00083 virtual bool init(const Stage& stage);
00084
00088 virtual bool finish();
00089
00091
00092 void renderSphere_(const Sphere& sphere);
00093
00094 void renderMesh_(const Mesh& mesh);
00095
00096 void renderTube_(const Tube& tube);
00097
00098 void renderTwoColoredTube_(const TwoColoredTube& tube);
00099
00100 void renderLine_(const Line& tube);
00101
00102 void renderTwoColoredLine_(const TwoColoredLine& tube);
00103
00104 void out_(const String& data);
00105
00106 void outheader_(const String& data)
00107 {out_(data); current_indent_ += 1;}
00108
00109 void outfinish_(const String& data)
00110 {out_(data); current_indent_ -= 1;}
00111
00112 Size width, height;
00113
00114 protected:
00115
00116 void header_(const Vector3& translation, const ColorRGBA& color,
00117 const String& rotation = "");
00118
00119 void footer_();
00120
00121 File outfile_;
00122
00123 Vector3 origin_;
00124 Matrix4x4 rotation_;
00125 Index current_indent_;
00126 String endingName_;
00127 };
00128
00129 } }
00130
00131 #endif // BALL_VIEW_RENDERING_STLRENDERER_H
00132