Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

paper_effect.H

Go to the documentation of this file.
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  * PaperEffect
00009  *****************************************************************/
00010 class PaperEffect : public PaperEffectBase {
00011  protected:
00012    /******** PROTECTED MEMBERS TYPES ********/   
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    /******** STATIC MEMBER VARIABLES ********/   
00021 
00022    //Indicates which hardware implemenation...
00023    static int                       _implementation;
00024 
00025    //IMPLEMENTION__GL_ARB stuff...
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    //General stuff...
00043    static TEXTUREptr                _paper_texture;
00044 
00045    //Since many strokes will use the paper
00046    //textures, we don't want to waste tonnes
00047    //of memory with redundant copies, or waste
00048    //time switching between different texture
00049    //objects that are identical.  Instead, we
00050    //cache all of the textures, and their
00051    //filenames, and serve up textures from the cache.
00052 //   static LIST<str_ptr>             _paper_names;
00053 //   static LIST<TEXTUREptr>          _paper_textures;
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    /******** CONSTRUCTOR/DECONSTRUCTOR *******/
00061    PaperEffect();
00062    virtual ~PaperEffect();
00063    
00064    /******** STATIC MEMBER METHODS ********/
00065 
00066    /******** INTERFACE METHODS ********/
00067 
00068    // Use this to get a texture for use with the
00069    // next two functions
00070    static TEXTUREptr    get_texture(Cstr_ptr &tf, str_ptr &ret);
00071 
00072    // Encloses objects being drawn in non-postprocess mode
00073    // If t==NULL then the paper effect is not invoked
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    // This version uses the global paper texture
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    // For specifying paper coords (in ndc) for object verts in non-post mode
00084    static void    paper_coord(const double *v);
00085 
00086    // Toggles on/off (above 4 calls do nothing if not active)
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    /******** INTERNAL METHODS ********/
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 /* PAPER_EFFECT_HEADER */
00114 
00115 /* end of file paper_effect.H */

Generated on Mon Sep 18 11:39:32 2006 for jot by  doxygen 1.4.4