00001 #ifndef PAPER_EFFECT_BASE_IS_INCLUDED 00002 #define PAPER_EFFECT_BASE_IS_INCLUDED 00003 00004 #include "std/support.H" 00005 #include "mlib/global.H" // for bool 00006 00007 /***************************************************************** 00008 * PaperEffectObs 00009 * 00010 * PaperEffectObs's are notified when ever some client 00011 * toggles usage (i.e. NPRview calls usage_toggled() when 00012 * the effect is turned on/off) or when the paper is 00013 * changed... 00014 * 00015 *****************************************************************/ 00016 class PaperEffectObs { 00017 public: 00018 virtual ~PaperEffectObs() {} 00019 virtual void usage_changed() {} 00020 virtual void paper_changed() {} 00021 }; 00022 00023 /***************************************************************** 00024 * PaperEffectBase: 00025 * 00026 * Base class for PaperEffect (see npr/paper_effect.H), 00027 * which achieves the media simulation described in the 00028 * Siggraph 2002 paper: WYSIWYG NPR. 00029 * 00030 * This is here in the disp library so serialization code 00031 * in view.C can read and write parameters used by the 00032 * PaperEffect class without referencing the npr library. 00033 * 00034 *****************************************************************/ 00035 class PaperEffectBase { 00036 protected: 00037 /******** STATIC MEMBER VARIABLES ********/ 00038 static ARRAY<PaperEffectObs*> _obs; 00039 00040 static str_ptr _paper_tex; 00041 static str_ptr _paper_filename; 00042 00043 static bool _delayed_activate; 00044 static bool _delayed_activate_state; 00045 static bool _is_inited; 00046 static bool _is_supported; 00047 static bool _is_active; 00048 00049 static float _brig; 00050 static float _cont; 00051 00052 /******** INTERNAL METHODS ********/ 00053 static void notify_usage_toggled(); 00054 static void notify_paper_changed(); 00055 00056 public: 00057 //******** MANAGERS ******** 00058 PaperEffectBase() {} 00059 virtual ~PaperEffectBase() {} 00060 00061 /******** INTERFACE METHODS ********/ 00062 static void rem_obs(PaperEffectObs* p) { if (p) _obs -= p; } 00063 static void add_obs(PaperEffectObs* p) { if (p) _obs += p; } 00064 00065 static str_ptr get_paper_tex() { return _paper_tex; } 00066 static void set_paper_tex(Cstr_ptr &p) { _paper_tex = p; notify_paper_changed(); } 00067 00068 static bool is_active() { return _is_active; } 00069 00070 static float get_brig () { return _brig; } 00071 static void set_brig (float b) { _brig = b; } 00072 00073 static float get_cont () { return _cont; } 00074 static void set_cont (float c) { _cont = c; } 00075 00076 static void set_delayed_activate(bool a) { _delayed_activate = true; _delayed_activate_state = a; } 00077 }; 00078 00079 #endif // PAPER_EFFECT_BASE_IS_INCLUDED 00080 00081 /* end of file paper_effect_base.H */