Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

wireframe.H

Go to the documentation of this file.
00001 /**********************************************************************
00002  * wireframe.H:
00003  **********************************************************************/
00004 #ifndef WIREFRAME_H_IS_INCLUDED
00005 #define WIREFRAME_H_IS_INCLUDED
00006 
00007 #include "color_id_texture.H"
00008 
00009 /**********************************************************************
00010  * WireframeTexture:
00011  *
00012  *      Draws unlit triangles in wireframe --
00013  *      i.e. glPolygonMode(GL_LINE)
00014  **********************************************************************/
00015 class WireframeTexture : public BasicTexture {
00016  public:
00017    //******** MANAGERS ********
00018    WireframeTexture(Patch* patch = 0, CCOLOR& col = default_line_color()) :
00019       BasicTexture(patch, new GLStripCB),
00020       _width(0.5),
00021       _color(col),
00022       _color_id(new ColorIDTexture(patch, GL_LINE)),
00023       _quad_diagonals_in_dl(0) {
00024       _color_id->set_width(5);
00025    }
00026    virtual ~WireframeTexture() { gtextures().delete_all(); }
00027 
00028    //******** RUN-TIME TYPE ID ********
00029    DEFINE_RTTI_METHODS3("Wireframe", WireframeTexture*, BasicTexture, CDATA_ITEM*);
00030 
00031    //******** STATICS ********
00032 
00033    static bool show_quad_diagonals() { return _show_quad_diagonals; }
00034    static void toggle_show_quad_diagonals() {
00035       _show_quad_diagonals = !_show_quad_diagonals;
00036    }
00037 
00038    static CCOLOR& default_line_color() { return _default_line_color; }
00039    static void    set_default_line_color(CCOLOR& color);
00040 
00041    //******** ACCESSORS ********
00042 
00043    CCOLOR& color()              const   { return _color; }
00044    float width()                const   { return _width; }
00045    void  set_width(float w)             { _width = w;    }
00046 
00047    //******** GTexture METHODS ********
00048 
00049    virtual GTexture_list gtextures() const { return GTexture_list(_color_id); }
00050 
00051    virtual int  set_color(CCOLOR& c)    { _color = c; return 1; }
00052    virtual bool draws_filled()  const   { return false; }
00053    virtual int  draw(CVIEWptr& v); 
00054 
00055    //******** RefImageClient METHODS ********
00056    virtual int draw_vis_ref() { return _color_id->draw(VIEW::peek()); }
00057 
00058    //******** DATA_ITEM METHODS ********
00059    virtual DATA_ITEM  *dup() const { return new WireframeTexture; }
00060 
00061  protected:
00062    float                _width;
00063    COLOR                _color;         // color to use
00064    ColorIDTexture*      _color_id;      // for drawing visibility
00065    bool                 _quad_diagonals_in_dl;
00066    static bool          _show_quad_diagonals;
00067    static COLOR         _default_line_color;
00068 };
00069 
00070 #endif // WIREFRAME_H_IS_INCLUDED
00071 
00072 // end of file wireframe.H

Generated on Mon Sep 18 11:39:34 2006 for jot by  doxygen 1.4.4