00001 /********************************************************************** 00002 * glsl_toon_halo.H: 00003 **********************************************************************/ 00004 #ifndef GLSL_TOON_HALO_H_IS_INCLUDED 00005 #define GLSL_TOON_HALO_H_IS_INCLUDED 00006 00007 #include "glsl_shader.H" 00008 00009 /********************************************************************** 00010 * GLSLToonShaderHalo: 00011 * 00012 * GLSL version of a 1D toon 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 * This version of the toon shader is meant for drawing halos 00018 * It does not use display lists 00019 * 00020 **********************************************************************/ 00021 class GLSLToonShaderHalo : public GLSLShader { 00022 public: 00023 //******** MANAGERS ******** 00024 GLSLToonShaderHalo(Patch* patch = 0); 00025 00026 //******** RUN-TIME TYPE ID ******** 00027 DEFINE_RTTI_METHODS3("GLSL Toon Halo", 00028 GLSLToonShaderHalo*, BasicTexture, CDATA_ITEM*); 00029 00030 // Set the name of the texture to use (full path): 00031 void set_tex(Cstr_ptr& full_path_name); 00032 00033 //******** GLSLShader VIRTUAL METHODS ******** 00034 00035 // Called in init(), subclasses can query and store 00036 // the "locations" of uniform and attribute variables here: 00037 virtual bool get_variable_locs(); 00038 00039 // Send values of uniform variables to the shader: 00040 virtual bool set_uniform_variables() const; 00041 00042 // Init the 1D toon texture by loading from file: 00043 virtual void init_textures(); 00044 00045 // Activate the 1D toon texture for drawing: 00046 virtual void activate_textures(); 00047 00048 //******** DATA_ITEM VIRTUAL METHODS ******** 00049 virtual DATA_ITEM *dup() const { return new GLSLToonShaderHalo; } 00050 00051 protected: 00052 //******** Member Variables ******** 00053 TEXTUREglptr _tex; // the texture 00054 GLint _tex_loc; // "location" of sampler2D in the program 00055 00056 //******** VIRTUAL METHODS ******** 00057 00058 // Return the names of the toon GLSL shader programs: 00059 virtual str_ptr vp_filename() { return vp_name("halo"); } 00060 00061 // XXX - temporary, until we can figure out how to not use the 00062 // fragment shader: 00063 virtual str_ptr fp_filename() { return fp_name("halo"); } 00064 00065 // we're not using any fragment shader: 00066 // XXX - we have to figure out how to not use the fragment shader 00067 // virtual str_list fp_filenames() { return str_list(); } 00068 }; 00069 00070 #endif // GLSL_TOON_HALO_H_IS_INCLUDED 00071 00072 // end of file glsl_toon_halo.H