Panda3D

fltCurve.h

00001 // Filename: fltCurve.h
00002 // Created by:  drose (28Feb01)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef FLTCURVE_H
00016 #define FLTCURVE_H
00017 
00018 #include "pandatoolbase.h"
00019 
00020 #include "fltBeadID.h"
00021 #include "fltHeader.h"
00022 
00023 #include "luse.h"
00024 
00025 ////////////////////////////////////////////////////////////////////
00026 //       Class : FltCurve
00027 // Description : A single curve, like a Bezier or B-Spline.
00028 ////////////////////////////////////////////////////////////////////
00029 class FltCurve : public FltBeadID {
00030 public:
00031   FltCurve(FltHeader *header);
00032 
00033   enum CurveType {
00034     CT_b_spline            = 4,
00035     CT_cardinal            = 5,
00036     CT_bezier              = 6
00037   };
00038 
00039   typedef pvector<LPoint3d> ControlPoints;
00040 
00041   CurveType _curve_type;
00042   ControlPoints _control_points;
00043 
00044 public:
00045   INLINE int get_num_control_points() const;
00046   INLINE const LPoint3d &get_control_point(int n) const;
00047 
00048 
00049 protected:
00050   virtual bool extract_record(FltRecordReader &reader);
00051   virtual bool build_record(FltRecordWriter &writer) const;
00052 
00053 public:
00054   virtual TypeHandle get_type() const {
00055     return get_class_type();
00056   }
00057   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00058   static TypeHandle get_class_type() {
00059     return _type_handle;
00060   }
00061   static void init_type() {
00062     FltBeadID::init_type();
00063     register_type(_type_handle, "FltCurve",
00064                   FltBeadID::get_class_type());
00065   }
00066 
00067 private:
00068   static TypeHandle _type_handle;
00069 };
00070 
00071 #include "fltCurve.I"
00072 
00073 #endif
00074 
00075 
 All Classes Functions Variables Enumerations