00001 /********************************************************************** 00002 * key_line.H: 00003 **********************************************************************/ 00004 #ifndef KEY_LINE_H_IS_INCLUDED 00005 #define KEY_LINE_H_IS_INCLUDED 00006 00007 #include "basic_texture.H" 00008 #include "toon_texture_1D.H" 00009 00010 class SolidColorTexture; 00011 class ToonTexture_1D; //modified to use v1.3 toon shader 00012 class SilFrameTexture; 00013 /********************************************************************** 00014 * KeyLineTexture: 00015 * 00016 * Render Patch silhouettes with a solid background color 00017 * 00018 **********************************************************************/ 00019 class KeyLineTexture : public OGLTexture { 00020 public: 00021 00022 //******** MANAGERS ******** 00023 00024 KeyLineTexture(Patch* patch = 0); 00025 virtual ~KeyLineTexture(); 00026 00027 //******** RUN-TIME TYPE ID ******** 00028 00029 DEFINE_RTTI_METHODS3("Key Line", KeyLineTexture*, OGLTexture, CDATA_ITEM *); 00030 00031 //******** STATICS ******** 00032 00033 // Whether to show hidden lines or not: 00034 static void set_show_hidden(bool show) { _show_hidden = show; } 00035 00036 static bool toggle_show_hidden_lines() { 00037 return (_show_hidden = !_show_hidden); 00038 } 00039 00040 //******** ACCESSORS ******** 00041 00042 SolidColorTexture* solidcolor() { return _solid; } 00043 ToonTexture_1D* toon() { return _toon; } 00044 SilFrameTexture* sil_frame() { return _sil_frame; } 00045 00046 virtual int set_color(CCOLOR& c); 00047 int set_sil_color(CCOLOR& c); 00048 00049 //******** GTexture VIRTUAL METHODS ******** 00050 00051 virtual GTexture_list gtextures() const { 00052 return GTexture_list((GTexture*)_solid, 00053 (GTexture*)_toon, 00054 (GTexture*)_sil_frame); 00055 } 00056 00057 virtual void draw_filled_tris(double alpha); 00058 virtual void draw_non_filled_tris(double alpha); 00059 00060 virtual int draw(CVIEWptr& v); 00061 00062 //******** DATA_ITEM METHODS ******** 00063 00064 virtual DATA_ITEM *dup() const { return new KeyLineTexture; } 00065 00066 protected: 00067 SolidColorTexture* _solid; // draws filled triangles, no shading 00068 ToonTexture_1D* _toon; // toon shader, goes on top of solid color 00069 SilFrameTexture* _sil_frame; // draws silhouettes and creases 00070 00071 static bool _show_hidden; // if true, show hidden lines (dotted) 00072 00073 // Internal method for drawing the hidden lines: 00074 int draw_hidden(CVIEWptr& v); 00075 }; 00076 00077 #endif // KEY_LINE_H_IS_INCLUDED 00078 00079 // end of file key_line.H 00080