00001 // Filename: fltCurve.h 00002 // Created by: drose (28Feb01) 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 FLTCURVE_H 00020 #define FLTCURVE_H 00021 00022 #include <pandatoolbase.h> 00023 00024 #include "fltBeadID.h" 00025 #include "fltHeader.h" 00026 00027 #include <luse.h> 00028 00029 //////////////////////////////////////////////////////////////////// 00030 // Class : FltCurve 00031 // Description : A single curve, like a Bezier or B-Spline. 00032 //////////////////////////////////////////////////////////////////// 00033 class FltCurve : public FltBeadID { 00034 public: 00035 FltCurve(FltHeader *header); 00036 00037 enum CurveType { 00038 CT_b_spline = 4, 00039 CT_cardinal = 5, 00040 CT_bezier = 6 00041 }; 00042 00043 typedef pvector<LPoint3d> ControlPoints; 00044 00045 CurveType _curve_type; 00046 ControlPoints _control_points; 00047 00048 public: 00049 INLINE int get_num_control_points() const; 00050 INLINE const LPoint3d &get_control_point(int n) const; 00051 00052 00053 protected: 00054 virtual bool extract_record(FltRecordReader &reader); 00055 virtual bool build_record(FltRecordWriter &writer) const; 00056 00057 public: 00058 virtual TypeHandle get_type() const { 00059 return get_class_type(); 00060 } 00061 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00062 static TypeHandle get_class_type() { 00063 return _type_handle; 00064 } 00065 static void init_type() { 00066 FltBeadID::init_type(); 00067 register_type(_type_handle, "FltCurve", 00068 FltBeadID::get_class_type()); 00069 } 00070 00071 private: 00072 static TypeHandle _type_handle; 00073 }; 00074 00075 #include "fltCurve.I" 00076 00077 #endif 00078 00079