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

dots_ex.H

Go to the documentation of this file.
00001 /**********************************************************************
00002  * dots_EX.H:
00003  **********************************************************************/
00004 #ifndef DOTS_EX_H_IS_INCLUDED
00005 #define DOTS_EX_H_IS_INCLUDED
00006 
00007 #include "glsl_shader.H"
00008 
00009 /**********************************************************************
00010  * DotsShader_EX:
00011  *
00012  *  Halftone shader based on dots
00013  *  Working in object space
00014  **********************************************************************/
00015 class DotsShader_EX : public GLSLShader {
00016  public:
00017    //******** MANAGERS ********
00018    DotsShader_EX(Patch* patch = 0);
00019 
00020    virtual ~DotsShader_EX();
00021 
00022    //******** RUN-TIME TYPE ID ********
00023    DEFINE_RTTI_METHODS3("Dots_EX", DotsShader_EX*, GLSLShader, CDATA_ITEM*);
00024 
00025    //******** ACCESSORS ********
00026    void set_style(int s) { _style = s; }
00027 
00028    void set_tone_shader(GTexture* g);
00029 
00030    //******** GLSLShader VIRTUAL METHODS ********
00031 
00032    // base classes can over-ride this to maintain their own program
00033    // variable, e.g. to share a single program among all instances of
00034    // the derived class:
00035    virtual GLuint& program() { return _program; }
00036    virtual bool&  did_init() { return _did_init; }
00037 
00038    //uv gradients stuff
00039    virtual void set_patch(Patch* p);
00040    virtual void changed();
00041 
00042    // lookup uniform and attribute variable "locations":
00043    virtual bool get_variable_locs();
00044 
00045    // send values to uniform variables:
00046    virtual bool set_uniform_variables() const;
00047 
00048    // Calls glPushAttrib() and sets some OpenGL state:
00049    virtual void set_gl_state(GLbitfield mask=0) const;
00050 
00051    // Returns a list of the slave gtextures of this class
00052    virtual GTexture_list gtextures() const;
00053 
00054   // ******** GTexture VIRTUAL METHODS ********
00055    virtual ref_img_t use_ref_image();
00056    virtual int       draw_tex_mem_ref();
00057 
00058    //******** DATA_ITEM VIRTUAL METHODS ********
00059    virtual DATA_ITEM  *dup() const { return new DotsShader_EX; }
00060 
00061  protected:
00062    //******** Member Variables ********
00063    // shader used to draw the tone reference image:
00064    GTexture*    _tone_shader;
00065 
00066    // integer encoding what style parameters to use:
00067    int          _style;
00068 
00069    static GLuint _program;  // shared by all DotsShader_EX instances
00070    static bool   _did_init; // tells whether initialization attempt was made
00071    
00072   
00073    GLint        _lod_loc;
00074    GLint        _proj_der_loc;
00075    
00076    // dynamic 2D pattern variables:
00077    static GLint _origin_loc;
00078    static GLint _u_vec_loc;
00079    static GLint _v_vec_loc;
00080    static GLint _st_loc;
00081 
00082    // tone map variables:
00083    static GLint _tone_tex_loc;
00084    static GLint _width_loc;
00085    static GLint _height_loc;
00086 
00087 
00088    static GLint _style_loc;  
00089 
00090    //******** VIRTUAL METHODS ********
00091 
00092    // use the same vertex program as hatching shader:
00093    virtual str_ptr vp_filename() { return vp_name("halftone_ex"); }
00094 
00095    // GLSL fragment shader name
00096    virtual str_ptr fp_filename() { return fp_name("dots_ex"); }
00097 };
00098 
00099 #endif // DOTS_EX_H_IS_INCLUDED
00100 
00101 // end of file dots.H

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