00001 #ifndef PAPER_EFFECT_HEADER
00002 #define PAPER_EFFECT_HEADER
00003 
00004 #include "disp/paper_effect_base.H"
00005 #include "geom/texturegl.H"
00006 
00007 
00008 
00009 
00010 class PaperEffect : public PaperEffectBase {
00011  protected:
00012       
00013    enum pe_implementation_t {
00014       IMPLEMENTATION__NONE    = 0,
00015       IMPLEMENTATION__GL_ARB  = 1,
00016       IMPLEMENTATION__GL_NV   = 2,
00017       IMPLEMENTATION__GL_ATI  = 4
00018    };
00019 
00020       
00021 
00022    
00023    static int                       _implementation;
00024 
00025    
00026    static GLuint                    _disabled_no_frag_prog_arb;
00027    static GLuint                    _disabled_1d_frag_prog_arb;
00028    static GLuint                    _disabled_2d_frag_prog_arb;
00029    static GLuint                    _paper_with_no_frag_prog_arb;
00030    static GLuint                    _paper_with_1d_frag_prog_arb;
00031    static GLuint                    _paper_with_2d_frag_prog_arb;
00032    
00033    static GLuint                    _paper_frag_shader_ati;
00034 
00035    static const char *              _DisabledNoFragProgARB;
00036    static const char *              _Disabled1DFragProgARB;
00037    static const char *              _Disabled2DFragProgARB;
00038    static const char *              _PaperWithNoFragProgARB;
00039    static const char *              _PaperWith1DFragProgARB;
00040    static const char *              _PaperWith2DFragProgARB;
00041 
00042    
00043    static TEXTUREptr                _paper_texture;
00044 
00045    
00046    
00047    
00048    
00049    
00050    
00051    
00052 
00053 
00054    static LIST<str_ptr>*      _paper_texture_names;
00055    static LIST<TEXTUREptr>*   _paper_texture_ptrs;
00056    static LIST<str_ptr>*      _paper_texture_remap_orig_names;
00057    static LIST<str_ptr>*      _paper_texture_remap_new_names;
00058  
00059  public:
00060    
00061    PaperEffect();
00062    virtual ~PaperEffect();
00063    
00064    
00065 
00066    
00067 
00068    
00069    
00070    static TEXTUREptr    get_texture(Cstr_ptr &tf, str_ptr &ret);
00071 
00072    
00073    
00074    static void    begin_paper_effect(TEXTUREptr t, float cont, float bri, double x=0.0, double y=0.0);
00075    static void    end_paper_effect(TEXTUREptr t);
00076 
00077    
00078    static void    begin_paper_effect(bool apply, double x=0.0, double y=0.0); 
00079    static void    end_paper_effect(bool apply); 
00080 
00081    static bool    is_alpha_premult(); 
00082 
00083    
00084    static void    paper_coord(const double *v);
00085 
00086    
00087    static void    toggle_active();  
00088 
00089    static void    delayed_activate()  { if (_delayed_activate && (_delayed_activate_state != _is_active)) toggle_active(); _delayed_activate = false;}
00090 
00091  protected:
00092    
00093 
00094    static void    begin_paper_effect_arb(TEXTUREptr t, float cont, float bri, double x, double y);
00095    static void    begin_paper_effect_nv(TEXTUREptr t, float cont, float bri, double x, double y);
00096    static void    begin_paper_effect_ati(TEXTUREptr t, float cont, float bri, double x, double y);
00097 
00098    static void    end_paper_effect_arb(TEXTUREptr t);
00099    static void    end_paper_effect_nv(TEXTUREptr t);
00100    static void    end_paper_effect_ati(TEXTUREptr t);
00101 
00102    static bool    check_new_paper();
00103 
00104    static void    init();
00105 
00106    static bool    init_tex();
00107    static bool    init_arb();
00108    static bool    init_nv();
00109    static bool    init_ati();
00110 
00111 };
00112 
00113 #endif 
00114 
00115