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

msld.H

Go to the documentation of this file.
00001 /**********************************************************************
00002  * msld.H:
00003  **********************************************************************/
00004 #ifndef MSLD_H_IS_INCLUDED
00005 #define MSLD_H_IS_INCLUDED
00006 
00007 #include "glsl_shader.H"
00008 
00009 /**********************************************************************
00010  * MSLDShader:
00011  *
00012  *  ...
00013 
00014  *  Note: 
00015  *       
00016  *
00017  **********************************************************************/
00018 class MSLDShader : public GLSLShader {
00019  public:
00020    //******** MANAGERS ********
00021    MSLDShader(Patch* patch = 0);
00022 
00023    virtual ~MSLDShader();
00024 
00025    //******** RUN-TIME TYPE ID ********
00026    DEFINE_RTTI_METHODS3("MSLD",
00027                         MSLDShader*, GLSLShader, CDATA_ITEM*);
00028 
00029    //******** ACCESSORS ********
00030    void set_tone_shader(GTexture* g);
00031 
00032    //******** STATICS ********
00033 
00034    static MSLDShader* get_instance();
00035 
00036    //******** MSLDShader VIRTUAL METHODS ********
00037 
00038    // using a static variable for program, so all toon shader
00039    // instances share the same program:
00040    virtual GLuint& program() { return _program; }
00041    virtual bool&  did_init() { return _did_init; }
00042 
00043    // Called in init(); query and store the "locations" of
00044    // uniform and attribute variables here:
00045    virtual bool get_variable_locs();
00046 
00047    // Send values of uniform variables to the shader:
00048    virtual bool set_uniform_variables() const;
00049 
00050    // Calls glPushAttrib() and sets some OpenGL state:
00051    virtual void set_gl_state(GLbitfield mask=0) const;
00052 
00053    // Returns a list of the slave gtextures of this class
00054    virtual GTexture_list gtextures() const;
00055 
00056   // ******** GTexture VIRTUAL METHODS ********
00057    virtual ref_img_t use_ref_image();
00058    virtual int       draw_tex_mem_ref();
00059 
00060    //******** DATA_ITEM VIRTUAL METHODS ********
00061    virtual DATA_ITEM  *dup() const { return new MSLDShader; }
00062 
00063  protected:
00064    //******** Member Variables ********
00065    // shader used to draw the tone reference image:
00066    GTexture*    _tone_shader;
00067 
00068    static GLuint _program;  // MSLD program shared by all toon instances
00069    static bool   _did_init; // tells whether initialization attempt was made
00070 
00071    static MSLDShader* _instance;
00072 
00073 //   GLint scthresh_uniform_loc;
00074  //  GLint feature_size_uniform_loc;
00075 
00076    // tone map variables:
00077    GLint _tone_tex_loc;
00078    GLint _width_loc;
00079    GLint _height_loc;
00080 
00081    //******** VIRTUAL METHODS ********
00082 
00083    // Return the names of the toon MSLD shader programs:
00084    virtual str_ptr vp_filename() { return vp_name("msld"); }
00085 
00086    virtual str_ptr fp_filename() { return fp_name("msld"); }
00087 
00088 };
00089 
00090 #endif // MSLD_H_IS_INCLUDED
00091 
00092 // end of file msld.H

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