Panda3D
 All Classes Functions Variables Enumerations
eggNurbsSurface.h
1 // Filename: eggNurbsSurface.h
2 // Created by: drose (15Feb00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef EGGNURBSSURFACE_H
16 #define EGGNURBSSURFACE_H
17 
18 #include "pandabase.h"
19 
20 #include "eggSurface.h"
21 #include "eggNurbsCurve.h"
22 #include "vector_double.h"
23 #include "plist.h"
24 
25 ////////////////////////////////////////////////////////////////////
26 // Class : EggNurbsSurface
27 // Description : A parametric NURBS surface.
28 ////////////////////////////////////////////////////////////////////
29 class EXPCL_PANDAEGG EggNurbsSurface : public EggSurface {
30 PUBLISHED:
32  typedef Curves Loop;
33  typedef plist<Loop> Loops;
34  typedef Loops Trim;
35  typedef plist<Trim> Trims;
36 
37  INLINE EggNurbsSurface(const string &name = "");
38  INLINE EggNurbsSurface(const EggNurbsSurface &copy);
39  INLINE EggNurbsSurface &operator = (const EggNurbsSurface &copy);
40 
41  void setup(int u_order, int v_order,
42  int num_u_knots, int num_v_knots);
43 
44  INLINE void set_u_order(int u_order);
45  INLINE void set_v_order(int v_order);
46  void set_num_u_knots(int num);
47  void set_num_v_knots(int num);
48 
49  INLINE void set_u_knot(int k, double value);
50  INLINE void set_v_knot(int k, double value);
51  INLINE void set_cv(int ui, int vi, EggVertex *vertex);
52 
53  bool is_valid() const;
54 
55  INLINE int get_u_order() const;
56  INLINE int get_v_order() const;
57  INLINE int get_u_degree() const;
58  INLINE int get_v_degree() const;
59  INLINE int get_num_u_knots() const;
60  INLINE int get_num_v_knots() const;
61  INLINE int get_num_u_cvs() const;
62  INLINE int get_num_v_cvs() const;
63  INLINE int get_num_cvs() const;
64 
65  INLINE int get_u_index(int vertex_index) const;
66  INLINE int get_v_index(int vertex_index) const;
67  INLINE int get_vertex_index(int ui, int vi) const;
68 
69  bool is_closed_u() const;
70  bool is_closed_v() const;
71 
72  INLINE double get_u_knot(int k) const;
73  MAKE_SEQ(get_u_knots, get_num_u_knots, get_u_knot);
74  INLINE double get_v_knot(int k) const;
75  MAKE_SEQ(get_v_knots, get_num_v_knots, get_v_knot);
76  INLINE EggVertex *get_cv(int ui, int vi) const;
77 
78  virtual void write(ostream &out, int indent_level) const;
79 
80 public:
81  Curves _curves_on_surface;
82  Trims _trims;
83 
84 protected:
85  virtual void r_apply_texmats(EggTextureCollection &textures);
86 
87 private:
88  typedef vector_double Knots;
89  Knots _u_knots;
90  Knots _v_knots;
91  int _u_order;
92  int _v_order;
93 
94 public:
95 
96  static TypeHandle get_class_type() {
97  return _type_handle;
98  }
99  static void init_type() {
100  EggSurface::init_type();
101  register_type(_type_handle, "EggNurbsSurface",
102  EggSurface::get_class_type());
103  }
104  virtual TypeHandle get_type() const {
105  return get_class_type();
106  }
107  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
108 
109 private:
110  static TypeHandle _type_handle;
111 
112 };
113 
114 #include "eggNurbsSurface.I"
115 
116 #endif
This is a collection of textures by TRef name.
Any one-, two-, three-, or four-component vertex, possibly with attributes such as a normal...
Definition: eggVertex.h:41
A parametric NURBS surface.
A parametric surface of some kind.
Definition: eggSurface.h:27
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85