Panda3D

Loading...
Searching...
No Matches
eggNurbsSurface.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 eggNurbsSurface.h
10 * @author drose
11 * @date 2000-02-15
12 */
13
14#ifndef EGGNURBSSURFACE_H
15#define EGGNURBSSURFACE_H
16
17#include "pandabase.h"
18
19#include "eggSurface.h"
20#include "eggNurbsCurve.h"
21#include "vector_double.h"
22#include "plist.h"
23
24/**
25 * A parametric NURBS surface.
26 */
27 class EXPCL_PANDA_EGG EggNurbsSurface : public EggSurface {
28PUBLISHED:
29 typedef plist< PT(EggNurbsCurve) > Curves;
30 typedef Curves Loop;
31 typedef plist<Loop> Loops;
32 typedef Loops Trim;
33 typedef plist<Trim> Trims;
34
35 INLINE explicit EggNurbsSurface(const std::string &name = "");
36 INLINE EggNurbsSurface(const EggNurbsSurface &copy);
37 INLINE EggNurbsSurface &operator = (const EggNurbsSurface &copy);
38
39 virtual EggNurbsSurface *make_copy() const override;
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(std::ostream &out, int indent_level) const override;
79
80 public:
81 Curves _curves_on_surface;
82 Trims _trims;
83
84 protected:
85 virtual void r_apply_texmats(EggTextureCollection &textures) override;
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 override {
105 return get_class_type();
106 }
107 virtual TypeHandle force_init_type() override {
108 init_type();
109 return get_class_type();
110 }
111
112 private:
113 static TypeHandle _type_handle;
114
115};
116
117#include "eggNurbsSurface.I"
118
119#endif
EggNurbsCurve
A parametric NURBS curve.
Definition eggNurbsCurve.h:26
EggNurbsSurface::setup
void setup(int u_order, int v_order, int num_u_knots, int num_v_knots)
Prepares a new surface definition with the indicated order and number of knots in each dimension.
Definition eggNurbsSurface.cxx:36
EggNurbsSurface::set_num_v_knots
void set_num_v_knots(int num)
Directly changes the number of knots in the V direction.
Definition eggNurbsSurface.cxx:83
EggNurbsSurface::get_u_order
int get_u_order() const
Returns the order of the surface in the U direction.
Definition eggNurbsSurface.I:112
EggNurbsSurface::get_num_cvs
int get_num_cvs() const
Returns the total number of control vertices that *should* be defined for the surface.
Definition eggNurbsSurface.I:192
EggNurbsSurface::set_u_order
void set_u_order(int u_order)
Directly changes the order in the U direction to the indicated value (which must be an integer in the...
Definition eggNurbsSurface.I:56
EggNurbsSurface::is_closed_u
bool is_closed_u() const
Returns true if the surface appears to be closed in the U direction.
Definition eggNurbsSurface.cxx:136
EggNurbsSurface::is_closed_v
bool is_closed_v() const
Returns true if the surface appears to be closed in the V direction.
Definition eggNurbsSurface.cxx:157
EggNurbsSurface::make_copy
virtual EggNurbsSurface * make_copy() const override
Makes a copy of this object.
Definition eggNurbsSurface.cxx:24
EggNurbsSurface::get_num_u_knots
get_num_u_knots
Returns the number of knots in the U direction.
Definition eggNurbsSurface.h:73
EggNurbsSurface::set_num_u_knots
void set_num_u_knots(int num)
Directly changes the number of knots in the U direction.
Definition eggNurbsSurface.cxx:62
EggNurbsSurface::get_vertex_index
int get_vertex_index(int ui, int vi) const
Returns the index number within the EggPrimitive's list of the control vertex at position ui,...
Definition eggNurbsSurface.I:225
EggNurbsSurface::get_v_order
int get_v_order() const
Returns the order of the surface in the V direction.
Definition eggNurbsSurface.I:122
EggNurbsSurface::get_v_degree
int get_v_degree() const
Returns the degree of the surface in the V direction.
Definition eggNurbsSurface.I:140
EggNurbsSurface::set_v_order
void set_v_order(int v_order)
Directly changes the order in the V direction to the indicated value (which must be an integer in the...
Definition eggNurbsSurface.I:68
EggNurbsSurface::get_v_knot
get_v_knot
Returns the nth knot value defined in the V direction.
Definition eggNurbsSurface.h:75
EggNurbsSurface::get_cv
EggVertex * get_cv(int ui, int vi) const
Returns the control vertex at the indicate U, V position.
Definition eggNurbsSurface.I:253
EggNurbsSurface::is_valid
bool is_valid() const
Returns true if the NURBS parameters are all internally consistent (e.g.
Definition eggNurbsSurface.cxx:102
EggNurbsSurface::get_u_index
int get_u_index(int vertex_index) const
Returns the U index number of the given vertex within the EggPrimitive's linear list of vertices.
Definition eggNurbsSurface.I:203
EggNurbsSurface::write
virtual void write(std::ostream &out, int indent_level) const override
Writes the nurbsSurface to the indicated output stream in Egg format.
Definition eggNurbsSurface.cxx:171
EggNurbsSurface::get_num_v_cvs
int get_num_v_cvs() const
Returns the number of control vertices that should be present in the V direction.
Definition eggNurbsSurface.I:180
EggNurbsSurface::get_u_degree
int get_u_degree() const
Returns the degree of the surface in the U direction.
Definition eggNurbsSurface.I:131
EggNurbsSurface::set_cv
void set_cv(int ui, int vi, EggVertex *vertex)
Redefines the control vertex associated with a particular u, v coordinate pair.
Definition eggNurbsSurface.I:101
EggNurbsSurface::get_u_knot
get_u_knot
Returns the nth knot value defined in the U direction.
Definition eggNurbsSurface.h:73
EggNurbsSurface::get_num_u_cvs
int get_num_u_cvs() const
Returns the number of control vertices that should be present in the U direction.
Definition eggNurbsSurface.I:168
EggNurbsSurface::set_u_knot
void set_u_knot(int k, double value)
Resets the value of the indicated knot as indicated.
Definition eggNurbsSurface.I:79
EggNurbsSurface::get_num_v_knots
get_num_v_knots
Returns the number of knots in the V direction.
Definition eggNurbsSurface.h:75
EggNurbsSurface::get_v_index
int get_v_index(int vertex_index) const
Returns the V index number of the given vertex within the EggPrimitive's linear list of vertices.
Definition eggNurbsSurface.I:215
EggNurbsSurface::set_v_knot
void set_v_knot(int k, double value)
Resets the value of the indicated knot as indicated.
Definition eggNurbsSurface.I:90
EggVertex
Any one-, two-, three-, or four-component vertex, possibly with attributes such as a normal.
Definition eggVertex.h:39
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
plist
This is our own Panda specialization on the default STL list.
Definition plist.h:35
eggNurbsCurve.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
eggNurbsSurface.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
eggSurface.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
plist.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
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
vector_double.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.