00001 #ifndef ICON2D_H_IS_INCLUDED
00002 #define ICON2D_H_IS_INCLUDED
00003
00004 #include "std/support.H"
00005 #include "disp/cam.H"
00006 #include "disp/ray.H"
00007 #include "geom/geom.H"
00008 #include "disp/view.H"
00009 #include "dlhandler/dlhandler.H"
00010 #include "geom/texturegl.H"
00011
00012
00013
00014
00015 MAKE_PTR_SUBC(ICON2D,GEOM);
00016 typedef const ICON2Dptr CICON2Dptr;
00017
00018 class ICON2D : public GEOM {
00019 public:
00020
00021 ICON2D() {}
00022
00023
00024 ICON2D(Cstr_ptr &n, Cstr_ptr &filename, int num, bool tog, const mlib::PIXEL &p);
00025
00026 DEFINE_RTTI_METHODS3("ICON2D", ICON2D*, GEOM, CDATA_ITEM *);
00027
00028 bool toggle_suppress_draw() {
00029 return (_suppress_draw = !_suppress_draw);
00030 }
00031
00032 void add_skin(Cstr_ptr &n);
00033 void update_skin();
00034 void toggle_active() { _active = !_active; }
00035 void toggle_hidden() { _hide = !_hide; }
00036 bool activate() { return (_active = true); }
00037 bool deactivate() {return (_active = false); }
00038
00039 Cstr_ptr name() {return _name; }
00040
00041 virtual BBOX2D bbox2d (int b=5, char*s=0, int r=0) const;
00042 virtual void update () { }
00043
00044 virtual int draw (CVIEWptr &v);
00045 virtual RAYhit &intersect(RAYhit &r, mlib::CWtransf &m, int uv = 0) const;
00046
00047
00048 int cam_num() { return _cam; }
00049 bool can_intersect() const{ return _can_intersect; }
00050 void can_intersect(bool c) { _can_intersect = c;}
00051 void show_boxes (bool sb =1 ) { _show_boxes = sb;}
00052 bool ¢ered () { return _center; }
00053 void set_loc (mlib::CXYpt &p) { set_xform(mlib::Wpt(p[0],p[1],0));}
00054 bool is2d () const { return _is2d;}
00055 void set_is2d (bool is2d) { _is2d = is2d;}
00056
00057
00058
00059
00060
00061
00062 virtual bool needs_blend() const { return true; }
00063
00064 protected:
00065 mlib::NDCZpt _npt2d;
00066 mlib::XYpt _pt2d;
00067 mlib::PIXEL _pix;
00068 bool _is2d;
00069 bool _center;
00070 bool _can_intersect;
00071 bool _show_boxes;
00072 str_ptr _name;
00073 str_ptr _filename;
00074 ARRAY<str_ptr> _skins;
00075 int _currentTex;
00076 ARRAY<TEXTUREglptr> _texture;
00077 TEXTUREglptr _act_tex;
00078 int _cam;
00079 bool _suppress_draw;
00080 bool _active;
00081 bool _toggle;
00082 bool _hide;
00083
00084
00085
00086 static DLhandler _dl;
00087
00088
00089
00090 static void initialize(CVIEWptr &v);
00091
00092 void recompute_xform();
00093 };
00094
00095 #endif // ICON2D_H_IS_INCLUDED
00096
00097