BALL  1.4.1
VRMLRenderer.h
Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 
00005 #ifndef BALL_VIEW_RENDERING_VRMLRENDERER_H
00006 #define BALL_VIEW_RENDERING_VRMLRENDERER_H
00007 
00008 #ifndef BALL_VIEW_RENDERING_RENDERER_H
00009 # include <BALL/VIEW/RENDERING/renderer.h>
00010 #endif
00011 
00012 #ifndef BALL_SYSTEM_FILE_H
00013 # include <BALL/SYSTEM/file.h>
00014 #endif
00015 
00016 #ifndef BALL_MATHS_VECTOR3_H
00017 # include <BALL/MATHS/vector3.h>
00018 #endif
00019 
00020 #ifndef BALL_MATHS_MATRIX44_H
00021 # include <BALL/MATHS/matrix44.h>
00022 #endif
00023 
00024 namespace BALL
00025 {
00026   namespace VIEW
00027   {
00028     class ColorRGBA;
00029 
00039 class BALL_VIEW_EXPORT VRMLRenderer : public Renderer
00040 {
00041   public:
00042 
00046 
00048   VRMLRenderer();
00049 
00053   VRMLRenderer(const String& name)
00054     throw(Exception::FileNotFound);
00055   
00057   virtual ~VRMLRenderer();
00058 
00060   virtual void clear();
00061 
00063 
00066 
00070   void setFileName(const String& name)
00071     throw(Exception::FileNotFound);
00072 
00075   String VRMLColorRGBA(const ColorRGBA& input);
00076 
00079   String VRMLVector3(Vector3 input);
00080 
00082   void VRMLColor(const ColorRGBA& color);
00083 
00085 
00088   
00092   virtual bool init(const Stage& stage);
00093 
00097   virtual bool finish();
00098 
00100 
00101   void renderSphere_(const Sphere& sphere);
00102   
00103   void renderMesh_(const Mesh& mesh);
00104 
00105   void renderLine_(const Line& miniTube);
00106 
00107   void renderTwoColoredLine_(const TwoColoredLine& miniTube);
00108 
00109   void renderTube_(const Tube& tube);
00110 
00111   void renderTwoColoredTube_(const TwoColoredTube& tube);
00112 
00113   void out_(const String& data);
00114 
00115   void outheader_(const String& data)
00116     {out_(data); current_indent_ += 1;}
00117 
00118   void outfinish_(const String& data)
00119     {out_(data); current_indent_ -= 1;}
00120 
00121   Size width, height;
00122 
00123   protected:
00124 
00125   void header_(const Vector3& translation, const ColorRGBA& color, 
00126                const String& rotation = "");
00127     
00128   void footer_();
00129 
00130   File outfile_;
00131 
00132   Vector3   origin_;
00133   Matrix4x4 rotation_;
00134   Index current_indent_;
00135 
00136   //size estimate for afterwards scaling for printing
00137   float smallX, smallY, smallZ, bigX, bigY, bigZ; 
00138 
00139   //boolean showing if scaling is relevant afterall
00140   bool scalingUsed;
00141 };
00142   
00143 } } // namespaces
00144 
00145 #endif // BALL_VIEW_RENDERING_VRMLRENDERER_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines