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

basic_texture.H

Go to the documentation of this file.
00001 #ifndef _JOT_GTEX_BASIC_TEXTURE_H
00002 #define _JOT_GTEX_BASIC_TEXTURE_H
00003 
00004 #include "dlhandler/dlhandler.H"
00005 #include "mesh/gtexture.H"
00006 #include "std/config.H"
00007 #include "gtex/util.H"
00008 
00009 /**********************************************************************
00010  * OGLTexture:
00011  *
00012  *   Add to GTexture the ability to draw an IDRefImage
00013  **********************************************************************/
00014 class OGLTexture : public GTexture {
00015  protected:
00016 
00017    void check_patch_texture_map();
00018 
00019  public:
00020    //******** MANAGERS ********
00021    OGLTexture(Patch *patch = 0, StripCB* cb=0) :
00022       GTexture(patch, cb ? cb : new GLStripCB) {}
00023    virtual ~OGLTexture() {}
00024 
00025    //******** RUN-TIME TYPE ID ********
00026    DEFINE_RTTI_METHODS2("OGLTexture", GTexture, CDATA_ITEM *);
00027 
00028    // convenience (affects GL_ENABLE_BIT)
00029    bool set_face_culling() const;
00030 
00031    // Draw silhouettes into the ID reference image,
00032    // optionally omitting the concave ones. This is useful
00033    // in conjunction with draw_id_triangles() (see below),
00034    // which draws filled triangles (black or ID colored)
00035    // with polygon offset:
00036    int draw_id_sils(bool omit_concave_sils, GLfloat width);
00037    int draw_id_triangles(
00038       bool use_polygon_offset, 
00039       bool draw_id_colors,
00040       double offset_factor = Config::get_var_dbl("BMESH_OFFSET_FACTOR", 12.0,true),
00041       double offset_units =  Config::get_var_dbl("BMESH_OFFSET_UNITS", 1.0,true)
00042       );
00043    int draw_id_creases(GLfloat width);
00044    
00045    // draws the patch into the stencil buffer only
00046    int draw_stencil(); 
00047 
00048    // most textures need to check for vertex and edge strips, and draw
00049    // them if needed, and most do so in the same way, so this is here
00050    // for convenience:
00051    void draw_vert_and_edge_strips(
00052       bool disable_lights = 0,
00053       GLfloat line_width  = 3,
00054       GLfloat point_size  = 5,
00055       bool set_color      = 1,
00056       CCOLOR& color       = COLOR::black
00057       ) const;
00058 
00059    //******** RefImageClient METHODS: ********
00060    virtual int draw_vis_ref();
00061    virtual int draw_id_ref();
00062 };
00063 
00064 /**********************************************************************
00065  * BasicTexture:
00066  *
00067  *   Base class for "procedural textures" that keep and manage a
00068  *   display list.
00069  **********************************************************************/
00070 class BasicTexture : public OGLTexture {
00071  public:
00072    //******** MANAGERS ********
00073    BasicTexture(Patch* patch = 0, StripCB* cb=0) : OGLTexture(patch,cb){}
00074    virtual ~BasicTexture() { delete_dl(); }
00075 
00076    //******** RUN-TIME TYPE ID ********
00077    DEFINE_RTTI_METHODS2("BasicTexture", OGLTexture, CDATA_ITEM *);
00078 
00079    //******** VIRTUAL METHODS ********
00080    virtual void changed() { _dl.invalidate(); }
00081 
00082    // Returns 1 if display list is used to draw, 0 otherwise
00083    virtual int draw(CVIEWptr& v);
00084    // Returns 1 if display list is used to draw, 0 otherwise
00085    virtual int dl_valid(CVIEWptr& v);
00086 
00087 
00088  protected:
00089    DLhandler    _dl;
00090 
00091    void delete_dl() {
00092       _dl.delete_all_dl();
00093    }
00094 };
00095 
00096 #endif // _JOT_GTEX_BASIC_TEXTURE_H
00097 
00098 /* end of file basic_texture.H */

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