00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef NURBSCURVEDRAWER_H
00020 #define NURBSCURVEDRAWER_H
00021
00022 #include "pandabase.h"
00023
00024 #include "parametricCurveDrawer.h"
00025 #include "lineSegs.h"
00026
00027
00028
00029
00030
00031
00032
00033 class EXPCL_PANDA NurbsCurveDrawer : public ParametricCurveDrawer {
00034 PUBLISHED:
00035 NurbsCurveDrawer();
00036 virtual ~NurbsCurveDrawer();
00037
00038 void set_cv_color(float r, float g, float b);
00039 void set_hull_color(float r, float g, float b);
00040 void set_knot_color(float r, float g, float b);
00041
00042 virtual bool draw();
00043 virtual bool recompute(float t1, float t2, ParametricCurve *curve=NULL);
00044
00045 void set_show_cvs(bool flag);
00046 bool get_show_cvs() const;
00047 void set_show_hull(bool flag);
00048 bool get_show_hull() const;
00049 void set_show_knots(bool flag);
00050 bool get_show_knots() const;
00051
00052 INLINE bool hilight(int n);
00053 bool hilight(int n, float hr, float hg, float hb);
00054 bool unhilight(int n);
00055
00056 protected:
00057 LVecBase3f _cv_color, _hull_color, _knot_color;
00058 int _num_cvs, _num_hull, _num_knots;
00059 LineSegs _hull, _knots, _cvs;
00060 pvector<int> _knotnums;
00061
00062 bool _show_cvs, _show_hull, _show_knots;
00063
00064
00065 public:
00066 static TypeHandle get_class_type() {
00067 return _type_handle;
00068 }
00069 static void init_type() {
00070 ParametricCurveDrawer::init_type();
00071 register_type(_type_handle, "NurbsCurveDrawer",
00072 ParametricCurveDrawer::get_class_type());
00073 }
00074 virtual TypeHandle get_type() const {
00075 return get_class_type();
00076 }
00077 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00078
00079 private:
00080 static TypeHandle _type_handle;
00081 };
00082
00083 #include "nurbsCurveDrawer.I"
00084
00085 #endif
00086
00087