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