Panda3D
fltCurve.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file fltCurve.h
10  * @author drose
11  * @date 2001-02-28
12  */
13 
14 #ifndef FLTCURVE_H
15 #define FLTCURVE_H
16 
17 #include "pandatoolbase.h"
18 
19 #include "fltBeadID.h"
20 #include "fltHeader.h"
21 
22 #include "luse.h"
23 
24 /**
25  * A single curve, like a Bezier or B-Spline.
26  */
27 class FltCurve : public FltBeadID {
28 public:
29  FltCurve(FltHeader *header);
30 
31  enum CurveType {
32  CT_b_spline = 4,
33  CT_cardinal = 5,
34  CT_bezier = 6
35  };
36 
38 
39  CurveType _curve_type;
40  ControlPoints _control_points;
41 
42 public:
43  INLINE int get_num_control_points() const;
44  INLINE const LPoint3d &get_control_point(int n) const;
45 
46 
47 protected:
48  virtual bool extract_record(FltRecordReader &reader);
49  virtual bool build_record(FltRecordWriter &writer) const;
50 
51 public:
52  virtual TypeHandle get_type() const {
53  return get_class_type();
54  }
55  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
56  static TypeHandle get_class_type() {
57  return _type_handle;
58  }
59  static void init_type() {
60  FltBeadID::init_type();
61  register_type(_type_handle, "FltCurve",
62  FltBeadID::get_class_type());
63  }
64 
65 private:
66  static TypeHandle _type_handle;
67 };
68 
69 #include "fltCurve.I"
70 
71 #endif
This class writes a sequence of FltRecords to an ostream, handling opcode and size counts properly.
A base class for any of a broad family of flt beads that include an ID.
Definition: fltBeadID.h:24
This class turns an istream into a sequence of FltRecords by reading a sequence of Datagrams and extr...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
This is the first bead in the file, the top of the bead hierarchy, and the primary interface to readi...
Definition: fltHeader.h:44
int get_num_control_points() const
Returns the number of control points assigned to the curve.
Definition: fltCurve.I:18
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
const LPoint3d & get_control_point(int n) const
Returns the nth control point assigned to the curve.
Definition: fltCurve.I:26
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
A single curve, like a Bezier or B-Spline.
Definition: fltCurve.h:27
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.