00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
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:
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