27 <<
"Invalid NURBSSurface U order for " << egg_surface->get_name() <<
": "
34 <<
"Invalid NURBSSurface V order for " << egg_surface->get_name() <<
": "
46 nurbs->reset(num_u_vertices, num_v_vertices);
47 for (
int ui = 0; ui < num_u_vertices; ui++) {
48 for (
int vi = 0; vi < num_v_vertices; vi++) {
51 nurbs->set_vertex(ui, vi, LCAST(PN_stdfloat, egg_vertex->
get_pos4() * mat));
54 nurbs->set_extended_vertices(ui, vi, 0, color.get_data(), 4);
59 if (num_u_knots != nurbs->get_num_u_knots()) {
61 <<
"Invalid NURBSSurface number of U knots for "
62 << egg_surface->get_name() <<
": got " << num_u_knots
63 <<
" knots, expected " << nurbs->get_num_u_knots() <<
"\n";
68 if (num_v_knots != nurbs->get_num_v_knots()) {
70 <<
"Invalid NURBSSurface number of U knots for "
71 << egg_surface->get_name() <<
": got " << num_v_knots
72 <<
" knots, expected " << nurbs->get_num_v_knots() <<
"\n";
77 for (i = 0; i < num_u_knots; i++) {
78 nurbs->set_u_knot(i, egg_surface->
get_u_knot(i));
80 for (i = 0; i < num_v_knots; i++) {
81 nurbs->set_v_knot(i, egg_surface->
get_v_knot(i));
94make_nurbs_curve(
EggNurbsCurve *egg_curve,
const LMatrix4d &mat) {
97 <<
"Invalid NURBSCurve order for " << egg_curve->get_name() <<
": "
103 nurbs->set_order(egg_curve->
get_order());
105 nurbs->reset(egg_curve->size());
106 EggPrimitive::const_iterator pi;
108 for (pi = egg_curve->begin(); pi != egg_curve->end(); ++pi) {
110 nurbs->set_vertex(vi, LCAST(PN_stdfloat, egg_vertex->
get_pos4() * mat));
112 nurbs->set_extended_vertices(vi, 0, color.get_data(), 4);
117 if (num_knots != nurbs->get_num_knots()) {
119 <<
"Invalid NURBSCurve number of knots for "
120 << egg_curve->get_name() <<
": got " << num_knots
121 <<
" knots, expected " << nurbs->get_num_knots() <<
"\n";
125 for (
int i = 0; i < num_knots; i++) {
126 nurbs->set_knot(i, egg_curve->
get_knot(i));
LColor get_color() const
Returns the color set on this particular attribute.
A parametric NURBS curve.
get_order
Returns the order of the curve.
get_num_knots
Returns the number of knots.
get_knot
Returns the nth knot value defined.
A parametric NURBS surface.
int get_u_order() const
Returns the order of the surface in the U direction.
get_num_u_knots
Returns the number of knots in the U direction.
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,...
int get_v_order() const
Returns the order of the surface in the V direction.
get_v_knot
Returns the nth knot value defined in the V direction.
int get_num_v_cvs() const
Returns the number of control vertices that should be present in the V direction.
get_u_knot
Returns the nth knot value defined in the U direction.
int get_num_u_cvs() const
Returns the number of control vertices that should be present in the U direction.
get_num_v_knots
Returns the number of knots in the V direction.
get_vertex
Returns a particular index based on its index number.
Any one-, two-, three-, or four-component vertex, possibly with attributes such as a normal.
LPoint4d get_pos4() const
This is always valid, regardless of the value of get_num_dimensions.
This class is an abstraction for evaluating NURBS curves.
This class is an abstraction for evaluating NURBS surfaces.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.