00001 /********************************************************************** 00002 * msld.H: 00003 **********************************************************************/ 00004 #ifndef GLSL_NORMAL_H_IS_INCLUDED 00005 #define GLSL_NORMAL_H_IS_INCLUDED 00006 00007 #include "glsl_shader.H" 00008 00009 /********************************************************************** 00010 * GLSLNormalShader: 00011 * 00012 * ... 00013 00014 * Note: 00015 * 00016 * 00017 **********************************************************************/ 00018 class GLSLNormalShader : public GLSLShader { 00019 public: 00020 //******** MANAGERS ******** 00021 GLSLNormalShader(Patch* patch = 0); 00022 00023 //******** RUN-TIME TYPE ID ******** 00024 DEFINE_RTTI_METHODS3("GLSL_NORMAL", 00025 GLSLNormalShader*, GLSLShader, CDATA_ITEM*); 00026 00027 //******** STATICS ******** 00028 00029 static GLSLNormalShader* get_instance(); 00030 00031 //******** GLSLNormalShader 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: 00043 virtual bool set_uniform_variables() const; 00044 00045 //******** DATA_ITEM VIRTUAL METHODS ******** 00046 virtual DATA_ITEM *dup() const { return new GLSLNormalShader; } 00047 00048 protected: 00049 //******** Member Variables ******** 00050 // shader used to draw the tone reference image: 00051 00052 static GLuint _program; // MSLD program shared by all toon instances 00053 static bool _did_init; // tells whether initialization attempt was made 00054 00055 static GLSLNormalShader* _instance; 00056 00057 //******** VIRTUAL METHODS ******** 00058 00059 // Return the names of the toon MSLD shader programs: 00060 virtual str_ptr vp_filename() { return vp_name("normal"); } 00061 00062 virtual str_ptr fp_filename() { return fp_name("normal"); } 00063 00064 }; 00065 00066 #endif // GLSL_NORMAL_H_IS_INCLUDED 00067 00068 // end of file glsl_normal.H