STLRenderer.h

Go to the documentation of this file.
00001 //STLRenderer: Version 1.0 (2008.09.12) Annette Treichel
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 : public Renderer
00036 {
00037   public:
00038 
00039   BALL_CREATE(STLRenderer)
00040 
00041   
00044 
00046   STLRenderer();
00047 
00051   STLRenderer(const String& name)
00052     throw(Exception::FileNotFound);
00053   
00055   virtual ~STLRenderer();
00056 
00058   virtual void clear();
00059 
00061 
00064 
00068   void setFileName(const String& name)
00069     throw(Exception::FileNotFound);
00070 
00071 
00074   String VRMLVector3(Vector3 input);
00075 
00077 
00080   
00084   virtual bool init(const Stage& stage);
00085 
00089   virtual bool finish();
00090 
00092 
00093   void renderSphere_(const Sphere& sphere);
00094   
00095   void renderMesh_(const Mesh& mesh);
00096 
00097   void renderTube_(const Tube& tube);
00098 
00099   void renderTwoColoredTube_(const TwoColoredTube& tube);
00100 
00101   void renderLine_(const Line& tube);
00102 
00103   void renderTwoColoredLine_(const TwoColoredLine& tube);
00104 
00105   void out_(const String& data);
00106 
00107   void outheader_(const String& data)
00108     {out_(data); current_indent_ += 1;}
00109 
00110   void outfinish_(const String& data)
00111     {out_(data); current_indent_ -= 1;}
00112 
00113   Size width, height;
00114 
00115   protected:
00116 
00117   void header_(const Vector3& translation, const ColorRGBA& color, 
00118                const String& rotation = "");
00119     
00120   void footer_();
00121 
00122   File outfile_;
00123 
00124   Vector3   origin_;
00125   Matrix4x4 rotation_;
00126   Index current_indent_;
00127   String endingName_;
00128 };
00129   
00130 } } // namespaces
00131 
00132 #endif // BALL_VIEW_RENDERING_STLRENDERER_H
00133