Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

sglBezierCurveSet.hpp

00001 /*****************************************************************************
00002  * SGL: A Scene Graph Library
00003  *
00004  * Copyright (C) 1997-2001  Scott McMillan   All Rights Reserved.
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Library General Public
00017  * License along with this library; if not, write to the Free
00018  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  *****************************************************************************
00020  *     File: sglBezierCurveSet.hpp
00021  *   Author: Tom Stimson
00022  *  Created: 13 Feb 2000
00023  *  Summary:
00024  *****************************************************************************/
00025 
00026 #ifndef __SGL_BEZIERCURVESET_HPP
00027 #define __SGL_BEZIERCURVESET_HPP
00028 
00029 #include <sgl.h>
00030 #include <sglGeoSet.hpp>
00031 
00032 //----------------------------------------------------------------------------
00033 
00077 class SGL_DLL_API sglBezierCurveSet : public sglGeoSet
00078 {
00079 public:
00081    sglBezierCurveSet();
00083    virtual ~sglBezierCurveSet();
00084 
00086    void setTexCoordBind(BindEnum bind);
00088    BindEnum getTexCoordBind() const;
00089 
00093    void setCoordOrder(GLint order = 4);
00095    void setTexCoordOrder(GLint order = 4);
00097    void setNormalOrder(GLint order = 4);
00099    void setColorOrder(GLint order = 4);
00100 
00102    GLint getCoordOrder() {return m_vorder;}
00104    GLint getTexCoordOrder() {return m_torder;}
00106    GLint getNormalOrder() {return m_norder;}
00108    GLint getColorOrder() {return m_corder;}
00109 
00111    void setRange(float min = 0, float max = 1.0f);
00113    void getRange(float &min, float &max);
00114 
00116    void setNumSegments(unsigned int num);
00118    unsigned int getNumSegments() { return m_segments; }
00119 
00121    virtual void drawGeometry(const vector<sglTexCoords> &tex_coords) const;
00122 
00124    sglStats::PrimEnum getPrimType() const {return sglStats::eBEZIER_CURVES;}
00126    GLenum getGLPrimType() const {return GL_LINE_STRIP;}
00128    unsigned int getPrimSize() const {return m_segments+1;}
00130    AAEnum getAAType() const {return eLINE_AA;}
00131 
00132 protected:
00133    virtual bool computeBounds();
00134    virtual void updateDrawFunc();
00135 
00136 private:  // not implemented
00137    sglBezierCurveSet(const sglBezierCurveSet &);
00138    sglBezierCurveSet &operator=(const sglBezierCurveSet &);
00139 
00140    typedef void (*Map1Func)(float, float, int, int, const void*);
00141    static void invalidFunc(float, float, int, int, const void*);
00142    static void applyVerts3f(float, float, int, int, const void*);
00143    static void applyVerts3d(float, float, int, int, const void*);
00144    static void applyVerts4f(float, float, int, int, const void*);
00145    static void applyVerts4d(float, float, int, int, const void*);
00146    static void applyNorms3f(float, float, int, int, const void*);
00147    static void applyNorms3d(float, float, int, int, const void*);
00148    static void applyColors4f(float, float, int, int, const void*);
00149    static void applyColors4d(float, float, int, int, const void*);
00150    static void applyTexCoords1f(float, float, int, int, const void*);
00151    static void applyTexCoords1d(float, float, int, int, const void*);
00152    static void applyTexCoords2f(float, float, int, int, const void*);
00153    static void applyTexCoords2d(float, float, int, int, const void*);
00154    static void applyTexCoords3f(float, float, int, int, const void*);
00155    static void applyTexCoords3d(float, float, int, int, const void*);
00156    static void applyTexCoords4f(float, float, int, int, const void*);
00157    static void applyTexCoords4d(float, float, int, int, const void*);
00158 
00159 protected:
00160    GLint        m_vorder;
00161    GLint        m_norder;
00162    GLint        m_corder;
00163    GLint        m_torder;
00164 
00165    float        m_min;
00166    float        m_max;
00167 
00168    unsigned int m_segments;
00169 
00170    static Map1Func s_vfunc_table[24];
00171    static Map1Func s_nfunc_table[8];
00172    static Map1Func s_cfunc_table[16];
00173    static Map1Func s_tfunc_table[32];
00174 };
00175 
00176 #endif

Generated at Mon Jul 1 18:00:04 2002 for SGL by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001