00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef OST_GFX_PRIM_LIST_HH
00020 #define OST_GFX_PRIM_LIST_HH
00021
00022
00023
00024
00025
00026 #include <boost/shared_ptr.hpp>
00027
00028 #include <ost/geom/geom.hh>
00029
00030 #include "gfx.hh"
00031
00032 namespace ost { namespace gfx {
00033
00034 class PrimList;
00035
00036 typedef boost::shared_ptr<PrimList> PrimListP;
00037
00047 class DLLEXPORT_OST_GFX PrimList: public GfxObj
00048 {
00049 struct PointEntry {
00050 PointEntry(const geom::Vec3& p, const Color& c):
00051 pos(p), color(c) {}
00052 geom::Vec3 pos;
00053 Color color;
00054 geom::Mat3 rotmat;
00055 };
00056
00057 typedef std::vector<PointEntry> PointEntryList;
00058
00059 struct LineEntry {
00060 LineEntry(const geom::Vec3& p1, const geom::Vec3& p2, const Color& c):
00061 pos1(p1), pos2(p2), color(c) {}
00062 geom::Vec3 pos1,pos2;
00063 Color color;
00064 geom::Mat3 rotmat;
00065 };
00066
00067 typedef std::vector<LineEntry> LineEntryList;
00068
00069 public:
00071 PrimList(const String& name);
00072
00073 virtual void ProcessLimits(geom::Vec3& minc, geom::Vec3& maxc,
00074 const mol::Transform& tf) const;
00076 virtual geom::Vec3 GetCenter() const;
00077 virtual void CustomRenderPov(PovState& pov);
00078
00079 virtual void CustomRenderGL(RenderPass pass);
00080
00081 virtual void OnRenderModeChange();
00082
00084 void Clear();
00085
00087 void AddPoint(geom::Vec3& p, const Color& col=Color());
00088
00090 void AddLine(geom::Vec3& p1, geom::Vec3& p2, const Color& col=Color());
00091
00093 void SetDiameter(float d);
00094
00096 void SetRadius(float r);
00097
00099 void SetColor(const Color& c);
00100
00101 protected:
00102 virtual void CustomPreRenderGL(bool flag);
00103
00104 private:
00105 PointEntryList points_;
00106 LineEntryList lines_;
00107 float radius_;
00108 float diameter_;
00109
00110 void render_simple();
00111 void render_custom();
00112 };
00113
00119
00124 }}
00125
00126 #endif