00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef OST_GFX_POVRAY_HH
00020 #define OST_GFX_POVRAY_HH
00021
00022
00023
00024
00025
00026 #include <string>
00027 #include <fstream>
00028
00029 #include <ost/geom/transform.hh>
00030
00031 #include "color.hh"
00032
00033 namespace ost { namespace gfx {
00034
00035 class PovState {
00036 public:
00037 PovState(const std::string& pov_file, const std::string& inc_file, const std::string& wdir);
00038
00039 void write_preamble();
00040 void write_postamble();
00041 void write_background(const Color& c);
00042 void write_camera(float fov, float zdist);
00043 void write_default_light();
00044 void write_fog(float zdist, float znear, float zfar, const Color& c, bool f);
00045
00046 void start_obj(const std::string& name, float tp, float lw, float ps);
00047 void write_obj_tex(const std::string& name);
00048 void end_obj();
00049
00050 void write_sphere(const geom::Vec3& p, float r, const Color& c, const std::string& name);
00051 void write_cyl(const geom::Vec3& p1, const geom::Vec3& p2, float r, const Color& c, const std::string& name, bool open);
00052
00053 void write_merge_or_union(const std::string& name);
00054
00055 std::string write_coord(const geom::Vec3& v);
00056 std::string write_coord(float* v);
00057
00058 std::string write_norm(const geom::Vec3& n);
00059 std::string write_norm(float* n);
00060
00061 std::ostream& pov() {return pov_;}
00062 std::ostream& inc() {return inc_;}
00063
00064 public:
00065 bool use_tf;
00066 geom::Transform tf;
00067
00068 private:
00069 std::string pov_file_;
00070 std::string inc_file_;
00071 std::string wdir_;
00072 std::ofstream pov_;
00073 std::ofstream inc_;
00074 std::vector<std::string> obj_list_;
00075 };
00076
00077
00078 }}
00079
00080 #endif