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

smooth_shade.H

Go to the documentation of this file.
00001 #ifndef SMOOTH_SHADE_H_IS_INCLUDED
00002 #define SMOOTH_SHADE_H_IS_INCLUDED
00003 
00004 /*!
00005  *  \file smooth_shade.H
00006  *  \brief Contains the definition of the SmoothShadeTexture class and related
00007  *  classes.
00008  *
00009  *  \sa smooth_shade.C
00010  *
00011  */
00012 
00013 #include "basic_texture.H"
00014 
00015 /*!
00016  *  \brief A callback class for rendering each faces of a Patch with a smooth
00017  *  (gouraud) shading style.
00018  *
00019  *  Handles callbacks for drawing triangle strips for the SmoothShadeTexture
00020  *  GTexture.
00021  *
00022  *  \sa SmoothShadeTexture
00023  *
00024  */
00025 class SmoothShadeStripCB : public GLStripCB {
00026    
00027    public:
00028    
00029       SmoothShadeStripCB() : do_texcoords(false) { }
00030       
00031       //! \name Accessor Functions
00032       //@{
00033       
00034       void enable_texcoords() { do_texcoords = true; }
00035       void disable_texcoords() { do_texcoords = false; }
00036       bool texcoords_enabled() { return do_texcoords; }
00037       
00038       //@}
00039       
00040       //! \name Callback Hooks
00041       //@{
00042 
00043       //! \brief "face" callback.
00044       //!
00045       //! Issue vertex normals suitable for gouraud shading
00046       //! (plus colors, and texture and spatial coordinates)
00047       //! to OpenGL when drawing triangle strips.
00048       virtual void faceCB(CBvert* v, CBface* f);
00049       
00050       //@}
00051       
00052    private:
00053    
00054       //! Should texture coordinates be sent to OpenGL with each vertex?
00055       bool do_texcoords;
00056 
00057 };
00058 
00059 /*!
00060  *  \brief A GTexture that renders Patches with a smooth (gouraud) shaded style.
00061  *
00062  */
00063 class SmoothShadeTexture : public BasicTexture {
00064    
00065    public:
00066 
00067       SmoothShadeTexture(Patch* patch = 0, StripCB* cb=0) :
00068          BasicTexture(patch, cb ? cb : new SmoothShadeStripCB) {}
00069       
00070       //! \name Run-Time Type Id
00071       //@{
00072       
00073       DEFINE_RTTI_METHODS3("Smooth Shading", SmoothShadeTexture*,
00074                            BasicTexture, CDATA_ITEM *);
00075       
00076       //@}
00077       
00078       //! \name GTexture Virtual Methods
00079       //@{
00080       
00081       virtual int draw(CVIEWptr& v); 
00082       
00083       //@}
00084       
00085       //! \name DATA_ITEM Virtual Methods
00086       //@{
00087       
00088       virtual DATA_ITEM  *dup() const { return new SmoothShadeTexture; }
00089       
00090       //@}
00091    
00092 };
00093 
00094 #endif // SMOOTH_SHADE_H_IS_INCLUDED
00095 
00096 // end of file smooth_shade.H

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