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

toon_texture_1D.H

Go to the documentation of this file.
00001 /**********************************************************************
00002  * toon_texture_1D.H
00003  * Legacy toon shader, uses 1D textures, no pixel shaders
00004  * formerly the oryginal toon shader, reintroduced on Dec,28,2005
00005  **********************************************************************/
00006 #ifndef TOON_TEXTURE_1D_H_IS_INCLUDED
00007 #define TOON_TEXTURE_1D_H_IS_INCLUDED
00008 
00009 #include "geom/texturegl.H"    // for ConventionalTexture
00010 #include "gtex/basic_texture.H"
00011 
00012 //name changed 
00013 class ToonTexCB_1D : public GLStripCB {
00014  public:
00015    virtual void faceCB(CBvert* v, CBface* f);
00016 };
00017 
00018 class ToonTexture_1D : public BasicTexture {
00019  private:
00020    /******** STATIC MEMBER VARIABLES ********/
00021    static TAGlist                *_ntt_tags;
00022 
00023  protected:
00024    static LIST<str_ptr>*      _toon_texture_names;
00025    static LIST<TEXTUREptr>*   _toon_texture_ptrs;
00026    static LIST<str_ptr>*      _toon_texture_remap_orig_names;
00027    static LIST<str_ptr>*      _toon_texture_remap_new_names;
00028     
00029     //******** Member Variables ********
00030    TEXTUREptr                    _tex;     
00031    str_ptr                       _tex_name;
00032    str_ptr                       _layer_name;
00033    int                           _use_paper;
00034    int                           _travel_paper;
00035    int                           _transparent;
00036    int                           _annotate;
00037    COLOR                         _color;
00038    double                        _alpha;
00039    int                           _light_index;
00040    int                           _light_dir;
00041    int                           _light_cam;
00042    Wvec                          _light_coords;
00043 
00044  public:
00045     // ******** CONSTRUCTOR ********
00046    ToonTexture_1D(Patch* patch = 0) :
00047       BasicTexture(patch, new ToonTexCB_1D),
00048       _tex_name(NULL_STR),
00049       _layer_name("Shader"),
00050       _use_paper(0),
00051       _travel_paper(0),
00052       _transparent(1),
00053       _annotate(1),
00054       _color(COLOR::white),
00055       _alpha(1.0),
00056       _light_index(0),
00057       _light_dir(1),
00058       _light_cam(1),
00059       _light_coords(Wvec(0,0,1)) {}
00060 
00061    //******** Member Methods ********
00062  public:
00063    //******** Accessors ********
00064    virtual str_ptr      get_tex_name() const       { return _tex_name;     }
00065    virtual void         set_tex_name(Cstr_ptr tn)  { _tex_name = tn; _tex=NULL;  }
00066    virtual str_ptr      get_layer_name() const     { return _layer_name;   }
00067    virtual void         set_layer_name(Cstr_ptr ln){ _layer_name = ln;     }
00068    virtual int          get_use_paper() const      { return _use_paper;    }
00069    virtual void         set_use_paper(int p)       { _use_paper = p;       }
00070    virtual int          get_travel_paper() const   { return _travel_paper; }
00071    virtual void         set_travel_paper(int t)    { _travel_paper = t;    }
00072    virtual int          get_transparent() const    { return _transparent;  }
00073    virtual int          get_annotate() const       { return _annotate;     }
00074    virtual double       get_alpha() const          { return _alpha;        }
00075    virtual void         set_alpha(double a)        { _alpha = a;           }
00076    virtual COLOR        get_color() const          { return _color;        }
00077    virtual int          set_color(CCOLOR &c)       { _color = c; return 1; }
00078    virtual int          get_light_index() const    { return _light_index;  }
00079    virtual void         set_light_index(int i)     { _light_index = i;     }
00080    virtual int          get_light_dir() const      { return _light_dir;    }
00081    virtual void         set_light_dir(int d)       { _light_dir = d;       }
00082    virtual int          get_light_cam() const      { return _light_cam;    }
00083    virtual void         set_light_cam(int c)       { _light_cam = c;       }
00084    virtual Wvec         get_light_coords() const   { return _light_coords; }
00085    virtual void         set_light_coords(CWvec &c) { _light_coords = c;    }
00086 
00087  protected:
00088    //******** Internal Methods ********
00089    void                 update_tex();
00090    void                 update_lights(CVIEWptr &v);
00091 
00092  public:
00093    //******** GTexture VIRTUAL METHODS ********
00094    virtual int          draw(CVIEWptr& v); 
00095 
00096    //******** DATA_ITEM VIRTUAL METHODS ********
00097    virtual DATA_ITEM*   dup() const                { return new ToonTexture_1D; }
00098    virtual CTAGlist&    tags() const;
00099 
00100    //******** IO Methods **********
00101    void                 put_layer_name(TAGformat &d) const;
00102    void                 get_layer_name(TAGformat &d);
00103    void                 put_tex_name(TAGformat &d) const;
00104    void                 get_tex_name(TAGformat &d);
00105 
00106    int&                 use_paper_()   { return _use_paper;    }  
00107    int&                 travel_paper_(){ return _travel_paper; }
00108    double&              alpha_()       { return _alpha;        }
00109    COLOR&               color_()       { return _color;        }
00110    int&                 light_index_() { return _light_index;  }
00111    int&                 light_dir_()   { return _light_dir;    }
00112    int&                 light_cam_()   { return _light_cam;    }
00113    Wvec&                light_coords_(){ return _light_coords; }
00114 
00115    // XXX - Deprecated
00116    void                 put_transparent(TAGformat &d) const;
00117    void                 get_transparent(TAGformat &d);
00118    void                 put_annotate(TAGformat &d) const;
00119    void                 get_annotate(TAGformat &d);
00120 
00121    //******** RUN-TIME TYPE ID ********
00122    DEFINE_RTTI_METHODS3("NPRToonTexture_1D", ToonTexture_1D*,
00123                         OGLTexture, CDATA_ITEM *);
00124 };
00125 
00126 #endif // TOON_TEXTURE_1D_H_IS_INCLUDED
00127 
00128 // end of file toon_texture.H

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