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

glsl_halo.H

Go to the documentation of this file.
00001 /**********************************************************************
00002  * glsl_halo.H:
00003  **********************************************************************/
00004 #ifndef GLSL_HALO_H_IS_INCLUDED
00005 #define GLSL_HALO_H_IS_INCLUDED
00006 
00007 #include "glsl_toon.H"
00008 
00009 /**********************************************************************
00010  * GLSLHaloShader:
00011  *
00012  *  GLSL version of a 1D halo shader.
00013 
00014  *  Note: Current version uses GL_TEXTURE2D, but works fine
00015  *        if you load an image of size 1 x n.
00016  *
00017  **********************************************************************/
00018 class GLSLHaloShader : public GLSLToonShader {
00019  public:
00020    //******** MANAGERS ********
00021    GLSLHaloShader(Patch* patch = 0);
00022 
00023    //******** RUN-TIME TYPE ID ********
00024    DEFINE_RTTI_METHODS3("GLSL Halo2",
00025                         GLSLHaloShader*, GLSLToonShader, CDATA_ITEM*);
00026 
00027    //******** STATICS ********
00028 
00029    static GLSLHaloShader* get_instance();
00030 
00031    //******** GLSLShader VIRTUAL METHODS ********
00032 
00033    // using a static variable for program, so all toon shader
00034    // instances share the same program:
00035    virtual GLuint& program() { return _program; }
00036    virtual bool&  did_init() { return _did_init; }
00037 
00038    // Called in init(); query and store the "locations" of
00039    // uniform and attribute variables here:
00040    virtual bool get_variable_locs();
00041 
00042    // Send values of uniform variables to the shader; needed for VIEWFORM
00043    // uniform variable
00044    virtual bool set_uniform_variables() const;
00045 
00046    virtual void set_gl_state(GLbitfield mask=0) const;
00047 
00048 
00049    //******** DATA_ITEM VIRTUAL METHODS ********
00050    virtual DATA_ITEM  *dup() const { return new GLSLHaloShader; }
00051 
00052  protected:
00053    //******** Member Variables ********
00054 
00055    
00056    static GLint  _pixel_width_loc;
00057    //static GLint  _distance_loc;
00058    static GLuint _program;  // GLSL program shared by all toon instances
00059    static bool   _did_init; // tells whether initialization attempt was made
00060 
00061    static GLSLHaloShader* _instance;
00062 
00063    //******** VIRTUAL METHODS ********
00064 
00065    // Return the names of the toon GLSL shader programs:
00066    virtual str_ptr vp_filename() { return vp_name("halo2"); }
00067 
00068    // XXX - temporary, until we can figure out how to not use the
00069    //       fragment shader:
00070    virtual str_ptr fp_filename() { return fp_name("halo2"); }
00071 
00072 };
00073 
00074 #endif // GLSL_HALO_H_IS_INCLUDED
00075 
00076 // end of file glsl_halo.H

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