00001
00002
00003
00004 #ifndef BUFFER_REF_IMAGE_HEADER
00005 #define BUFFER_REF_IMAGE_HEADER
00006
00007 #include "std/support.H"
00008 #include "gtex/ref_image.H"
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #define COUNTUP 4
00024 #define CBufferRefImage const BufferRefImage
00025
00026 MAKE_PTR_SUBC(BufferRefImage, FRAMEobs);
00027
00028 class BufferRefImage : public RefImage,
00029 protected DISPobs,
00030 protected XFORMobs,
00031 protected CAMobs,
00032 protected BMESHobs,
00033 public FRAMEobs,
00034 protected VIEWobs
00035 {
00036 public:
00037 virtual ~BufferRefImage() { unobserve(); }
00038
00039
00040
00041 static BufferRefImage* lookup(CVIEWptr& v);
00042
00043
00044 virtual void update();
00045 int need_update();
00046
00047 void force_dirty() { _dirty = 1; }
00048
00049
00050 void observe ();
00051 void unobserve();
00052 bool is_observing() {return _observing;}
00053
00054 void add (CGELptr &g) { _list.add(g);}
00055 bool rem (CGELptr &g) { return _list.rem(g);}
00056 CGELlist & list () {return _list;}
00057
00058
00059
00060 virtual int tick();
00061
00062
00063
00064
00065 protected:
00066 BufferRefImage(CVIEWptr& v);
00067
00068 static HASH _hash;
00069
00070
00071 int _dirty;
00072 int _countup;
00073 bool _observing;
00074 GELlist _list;
00075
00076 GELptr _f;
00077
00078
00079 void reset() { _dirty = 1; _countup = 0; }
00080
00081 virtual bool resize(uint new_w, uint new_h) {
00082 if (!RefImage::resize(new_w, new_h))
00083 return false;
00084 reset();
00085 return true;
00086 }
00087
00088
00089
00090
00091 void changed() { reset(); _countup = COUNTUP; }
00092
00093
00094
00095
00096 virtual void notify_exist (CGELptr&, int) { changed(); }
00097
00098
00099 virtual void notify (CGELptr&, int) { changed(); }
00100
00101
00102 virtual void notify(CCAMdataptr&) { reset(); }
00103
00104
00105 virtual void notify_xform (CGEOMptr&, STATE) { changed(); }
00106
00107
00108 virtual void notify_xform (BMESH*, mlib::CWtransf&, CMOD&){ changed(); }
00109 virtual void notify_change(BMESH*, BMESH::change_t) { changed(); }
00110
00111 virtual void notify_view (CVIEWptr &v, int) { if (v == _view) changed(); }
00112 };
00113
00114 #endif // BUFFER_REF_IMAGE_HEADER
00115
00116