00001 /********************************************************************** 00002 * glsl_toon.H: 00003 **********************************************************************/ 00004 #ifndef GLSL_SOLID_H_IS_INCLUDED 00005 #define GLSL_SOLID_H_IS_INCLUDED 00006 00007 #include "glsl_paper.H" 00008 00009 /********************************************************************** 00010 * GLSLSolidShader: 00011 * 00012 * GLSL version of a solid shader. 00013 * 00014 **********************************************************************/ 00015 class GLSLSolidShader : public GLSLPaperShader { 00016 public: 00017 //******** MANAGERS ******** 00018 GLSLSolidShader(Patch* patch = 0); 00019 00020 //******** RUN-TIME TYPE ID ******** 00021 DEFINE_RTTI_METHODS3("GLSL Solid", 00022 GLSLSolidShader*, BasicTexture, CDATA_ITEM*); 00023 00024 //******** GLSLShader VIRTUAL METHODS ******** 00025 00026 // using a static variable for program, so all toon shader 00027 // instances share the same program: 00028 virtual GLuint& program() { return _program; } 00029 virtual bool& did_init() { return _did_init; } 00030 00031 //******** DATA_ITEM VIRTUAL METHODS ******** 00032 virtual DATA_ITEM *dup() const { return new GLSLSolidShader; } 00033 00034 protected: 00035 00036 static GLuint _program; // GLSL program shared by all instances 00037 static bool _did_init; // tells whether initialization attempt was made 00038 00039 //******** VIRTUAL METHODS ******** 00040 // Return the names of the toon GLSL shader programs: 00041 virtual str_ptr vp_filename() { return vp_name("paper"); } 00042 00043 // XXX - temporary, until we can figure out how to not use the 00044 // fragment shader: 00045 virtual str_ptr fp_filename() { return fp_name("solid"); } 00046 00047 }; 00048 00049 #endif // GLSL_SOLID_H_IS_INCLUDED 00050 00051 // end of file glsl_solid.H