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

panda/src/parametrics/nurbsCurveDrawer.h

Go to the documentation of this file.
00001 // Filename: nurbsCurveDrawer.h
00002 // Created by:  drose (27Feb98)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
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 //       Class : NurbsCurveDrawer
00030 // Description : Draws a Nurbs curve, also drawing in the control
00031 //               vertices and tangent vectors.
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 

Generated on Fri May 2 00:40:45 2003 for Panda by doxygen1.3