15 #include "egg_parametrics.h"
16 #include "config_egg2pg.h"
29 if (egg_surface->get_u_order() < 1 || egg_surface->get_u_order() > 4) {
31 <<
"Invalid NURBSSurface U order for " << egg_surface->get_name() <<
": "
32 << egg_surface->get_u_order() <<
"\n";
36 if (egg_surface->get_v_order() < 1 || egg_surface->get_v_order() > 4) {
38 <<
"Invalid NURBSSurface V order for " << egg_surface->get_name() <<
": "
39 << egg_surface->get_v_order() <<
"\n";
45 nurbs->set_u_order(egg_surface->get_u_order());
46 nurbs->set_v_order(egg_surface->get_v_order());
48 int num_u_vertices = egg_surface->get_num_u_cvs();
49 int num_v_vertices = egg_surface->get_num_v_cvs();
50 nurbs->reset(num_u_vertices, num_v_vertices);
51 for (
int ui = 0; ui < num_u_vertices; ui++) {
52 for (
int vi = 0; vi < num_v_vertices; vi++) {
53 int i = egg_surface->get_vertex_index(ui, vi);
54 EggVertex *egg_vertex = egg_surface->get_vertex(i);
55 nurbs->set_vertex(ui, vi, LCAST(PN_stdfloat, egg_vertex->
get_pos4() * mat));
58 nurbs->set_extended_vertices(ui, vi, 0, color.
get_data(), 4);
62 int num_u_knots = egg_surface->get_num_u_knots();
63 if (num_u_knots != nurbs->get_num_u_knots()) {
65 <<
"Invalid NURBSSurface number of U knots for "
66 << egg_surface->get_name() <<
": got " << num_u_knots
67 <<
" knots, expected " << nurbs->get_num_u_knots() <<
"\n";
71 int num_v_knots = egg_surface->get_num_v_knots();
72 if (num_v_knots != nurbs->get_num_v_knots()) {
74 <<
"Invalid NURBSSurface number of U knots for "
75 << egg_surface->get_name() <<
": got " << num_v_knots
76 <<
" knots, expected " << nurbs->get_num_v_knots() <<
"\n";
81 for (i = 0; i < num_u_knots; i++) {
82 nurbs->set_u_knot(i, egg_surface->get_u_knot(i));
84 for (i = 0; i < num_v_knots; i++) {
85 nurbs->set_v_knot(i, egg_surface->get_v_knot(i));
102 if (egg_curve->get_order() < 1 || egg_curve->get_order() > 4) {
104 <<
"Invalid NURBSCurve order for " << egg_curve->get_name() <<
": "
105 << egg_curve->get_order() <<
"\n";
110 nurbs->set_order(egg_curve->get_order());
112 nurbs->reset(egg_curve->size());
115 for (pi = egg_curve->begin(); pi != egg_curve->end(); ++pi) {
117 nurbs->set_vertex(vi, LCAST(PN_stdfloat, egg_vertex->
get_pos4() * mat));
119 nurbs->set_extended_vertices(vi, 0, color.
get_data(), 4);
123 int num_knots = egg_curve->get_num_knots();
124 if (num_knots != nurbs->get_num_knots()) {
126 <<
"Invalid NURBSCurve number of knots for "
127 << egg_curve->get_name() <<
": got " << num_knots
128 <<
" knots, expected " << nurbs->get_num_knots() <<
"\n";
132 for (
int i = 0; i < num_knots; i++) {
133 nurbs->set_knot(i, egg_curve->get_knot(i));
A base class for any of a number of kinds of geometry primitives: polygons, point lights...
const float * get_data() const
Returns the address of the first of the four data elements in the vector.
This is a 4-by-4 transform matrix.
LColor get_color() const
Returns the color set on this particular attribute.
This class is an abstraction for evaluating NURBS curves.
This class is an abstraction for evaluating NURBS surfaces.
LPoint4d get_pos4() const
This is always valid, regardless of the value of get_num_dimensions.
Any one-, two-, three-, or four-component vertex, possibly with attributes such as a normal...
A parametric NURBS curve.
This is the base class for all three-component vectors and points.
A parametric NURBS surface.