Commit 59ec9b3d authored by Ellen Dekkers's avatar Ellen Dekkers
Browse files

ObjectTypes BSpline curve and surface: unused code removed

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@9716 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 01bd5120
...@@ -661,9 +661,7 @@ create_selection_texture() ...@@ -661,9 +661,7 @@ create_selection_texture()
double maxu = bsplineCurve_.get_knot( numKnots - degree -1 ); double maxu = bsplineCurve_.get_knot( numKnots - degree -1 );
double diffu = maxu - minu; double diffu = maxu - minu;
int texelIdx = 0;
int pixelIdx = 0;
for ( int m = 0; m < selection_texture_res_; ++m) for ( int m = 0; m < selection_texture_res_; ++m)
{ {
double step_m = (double)m / (double)selection_texture_res_; double step_m = (double)m / (double)selection_texture_res_;
...@@ -671,8 +669,9 @@ create_selection_texture() ...@@ -671,8 +669,9 @@ create_selection_texture()
// get the span and check which knots are selected // get the span and check which knots are selected
ACG::Vec2i span = bsplineCurve_.span(u); ACG::Vec2i span = bsplineCurve_.span(u);
if (span[0] < 0 || span[1] < 0) return; // check for incomple spline // check for incomple spline
// std::cout << "span(" << u << "): " << span[0] << ", " << span[1] << std::endl; if (span[0] < 0 || span[1] < 0)
return;
float alpha = 0.0; // blends between curve and highlight colors float alpha = 0.0; // blends between curve and highlight colors
for (int i = 0; i < degree+1; ++i) // degree+1 basis functions (those in the span) contribute for (int i = 0; i < degree+1; ++i) // degree+1 basis functions (those in the span) contribute
...@@ -682,21 +681,16 @@ create_selection_texture() ...@@ -682,21 +681,16 @@ create_selection_texture()
// basis functions sum up to 1. hence, we only have to sum up those with selected control point to get the blending weight // basis functions sum up to 1. hence, we only have to sum up those with selected control point to get the blending weight
if (bsplineCurve_.controlpoint_selection(idx)) if (bsplineCurve_.controlpoint_selection(idx))
alpha += bsplineCurve_.basisFunction(idx, degree, u); alpha += bsplineCurve_.basisFunction(idx, degree, u);
// std::cout << "control point " << idx << ": sel? " << bsplineCurve_.controlpoint_selection(idx)
// << ", value bf = " << bsplineCurve_.basisFunction(idx, degree, u) << std::endl;
} }
// compute color // compute color
Vec4f color = curve_color_ * (1.0 - alpha) + curve_highlight_color_ * alpha; Vec4f color = curve_color_ * (1.0 - alpha) + curve_highlight_color_ * alpha;
// fill texture // fill texture
b.setPixel (pixelIdx, 0, qRgba((int)(color[0]*255.0), (int)(color[1]*255.0), (int)(color[2]*255.0), 255)); b.setPixel (texelIdx, 0, qRgba((int)(color[0]*255.0), (int)(color[1]*255.0), (int)(color[2]*255.0), 255));
b.setPixel (pixelIdx, 1, qRgba((int)(color[0]*255.0), (int)(color[1]*255.0), (int)(color[2]*255.0), 255)); b.setPixel (texelIdx, 1, qRgba((int)(color[0]*255.0), (int)(color[1]*255.0), (int)(color[2]*255.0), 255));
// std::cout << "pixel " << pixelIdx << " set" << std::endl;
++pixelIdx;
++texelIdx;
} }
// debug, output image // debug, output image
...@@ -806,14 +800,9 @@ draw_textured_nurbs( GLState& _state) ...@@ -806,14 +800,9 @@ draw_textured_nurbs( GLState& _state)
int order = bsplineCurve_.degree() + 1; int order = bsplineCurve_.degree() + 1;
// get kntvector // get kntvector
// std::cout << "knots: " << std::flush;
GLfloat *knots = new GLfloat[numKnots]; GLfloat *knots = new GLfloat[numKnots];
for (int i = 0; i < numKnots; ++i) for (int i = 0; i < numKnots; ++i)
{
knots[i] = bsplineCurve_.get_knot(i); knots[i] = bsplineCurve_.get_knot(i);
// std::cout << bsplineCurve_.get_knot(i) << ", " << std::flush;
}
// std::cout << std::endl;
int numCPs_dummy = 2; int numCPs_dummy = 2;
GLfloat *ctlpoints = new GLfloat[numCPs * numCPs_dummy * 3]; // dummy cps = 2 GLfloat *ctlpoints = new GLfloat[numCPs * numCPs_dummy * 3]; // dummy cps = 2
...@@ -829,9 +818,6 @@ draw_textured_nurbs( GLState& _state) ...@@ -829,9 +818,6 @@ draw_textured_nurbs( GLState& _state)
ctlpoints[idx0] = (GLfloat)p[0]; ctlpoints[idx0] = (GLfloat)p[0];
ctlpoints[idx1] = (GLfloat)p[1]; ctlpoints[idx1] = (GLfloat)p[1];
ctlpoints[idx2] = (GLfloat)p[2]; ctlpoints[idx2] = (GLfloat)p[2];
// if (j == 1)
// ctlpoints[idx1] = (GLfloat)p[1] + 1.0;
} }
} }
...@@ -866,9 +852,6 @@ draw_textured_nurbs( GLState& _state) ...@@ -866,9 +852,6 @@ draw_textured_nurbs( GLState& _state)
float minv = 0.0; float minv = 0.0;
float maxv = 1.0; float maxv = 1.0;
// std::cout << "minu = " << minu << ", maxu = " << maxu << std::endl;
// std::cout << "minv = " << minv << ", maxv = " << maxv << std::endl;
// control points of 2d texture ((0,0), (0,1), (1,0), (1,1) ) // control points of 2d texture ((0,0), (0,1), (1,0), (1,1) )
GLfloat tcoords[8] = {0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0}; GLfloat tcoords[8] = {0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0};
......
...@@ -764,8 +764,9 @@ create_selection_texture() ...@@ -764,8 +764,9 @@ create_selection_texture()
// get the span and check which knots are selected // get the span and check which knots are selected
ACG::Vec2i span_u = bsplineSurface_.spanm(u); ACG::Vec2i span_u = bsplineSurface_.spanm(u);
if (span_u[0] < 0 || span_u[1] < 0) return; // check for incomplete spline // check for incomplete spline
// std::cout << "\nspan_u(" << u << "): " << span_u[0] << ", " << span_u[1] << std::endl; if (span_u[0] < 0 || span_u[1] < 0)
return;
// reset texture v coord for every new u coord // reset texture v coord for every new u coord
texelIdx_v = 0; texelIdx_v = 0;
...@@ -778,8 +779,9 @@ create_selection_texture() ...@@ -778,8 +779,9 @@ create_selection_texture()
// get the span and check which knots are selected // get the span and check which knots are selected
ACG::Vec2i span_v = bsplineSurface_.spann(v); ACG::Vec2i span_v = bsplineSurface_.spann(v);
if (span_v[0] < 0 || span_v[1] < 0) return; // check for incomplete spline // check for incomplete spline
// std::cout << "span_v(" << v << "): " << span_v[0] << ", " << span_v[1] << std::endl; if (span_v[0] < 0 || span_v[1] < 0)
return;
float alpha = 0.0; // blends between curve and highlight colors float alpha = 0.0; // blends between curve and highlight colors
for (int i = 0; i < degree_m+1; ++i) // degree+1 basis functions (those in the span) contribute for (int i = 0; i < degree_m+1; ++i) // degree+1 basis functions (those in the span) contribute
...@@ -794,12 +796,6 @@ create_selection_texture() ...@@ -794,12 +796,6 @@ create_selection_texture()
if (bsplineSurface_.controlpoint_selection(idx_m, idx_n)) if (bsplineSurface_.controlpoint_selection(idx_m, idx_n))
alpha += bsplineSurface_.basisFunction( knotvec_m, idx_m, degree_m, u) alpha += bsplineSurface_.basisFunction( knotvec_m, idx_m, degree_m, u)
* bsplineSurface_.basisFunction( knotvec_n, idx_n, degree_n, v); * bsplineSurface_.basisFunction( knotvec_n, idx_n, degree_n, v);
// std::cout << "control point (" << idx_m << ", " << idx_n << "): sel? "
// << bsplineSurface_.controlpoint_selection(idx_m, idx_n)
// << ", bf_u = " << bsplineSurface_.basisFunction(knotvec_m, idx_m, degree_m, u)
// << ", bf_v = " << bsplineSurface_.basisFunction(knotvec_n, idx_n, degree_n, v)
// << std::endl;
} }
} }
...@@ -808,15 +804,11 @@ create_selection_texture() ...@@ -808,15 +804,11 @@ create_selection_texture()
// fill texture (switch v coord due to axis of texture image) // fill texture (switch v coord due to axis of texture image)
b.setPixel (texelIdx_u, 255-texelIdx_v, qRgba((int)(color[0]*255.0), (int)(color[1]*255.0), (int)(color[2]*255.0), 255)); b.setPixel (texelIdx_u, 255-texelIdx_v, qRgba((int)(color[0]*255.0), (int)(color[1]*255.0), (int)(color[2]*255.0), 255));
// std::cout << "Set pixel " << texelIdx_u << ", " << texelIdx_v << std::endl;
++texelIdx_v; ++texelIdx_v;
} // end of n direction iter } // end of n direction iter
++texelIdx_u; ++texelIdx_u;
} // end of u direction iter } // end of u direction iter
...@@ -906,7 +898,7 @@ pick_create_texture( GLState& _state) ...@@ -906,7 +898,7 @@ pick_create_texture( GLState& _state)
} }
*/ */
// debug, output image (usually does not look as expected :\ ) // debug, output image
// b.save("surfacePickingTexture.png", "PNG"); // b.save("surfacePickingTexture.png", "PNG");
pick_texture_image_ = QGLWidget::convertToGLFormat( b ); pick_texture_image_ = QGLWidget::convertToGLFormat( b );
...@@ -942,8 +934,6 @@ draw_textured_nurbs( GLState& _state) ...@@ -942,8 +934,6 @@ draw_textured_nurbs( GLState& _state)
for (int i = 0; i < numKnots_n; ++i) for (int i = 0; i < numKnots_n; ++i)
knots_n[i] = bsplineSurface_.get_knot_n(i); knots_n[i] = bsplineSurface_.get_knot_n(i);
// std::cout << "knots_m: " << bsplineSurface_.get_knotvector_m() << std::endl;
// std::cout << "knots_n: " << bsplineSurface_.get_knotvector_n() << std::endl;
GLfloat *ctlpoints = new GLfloat[numCPs_m * numCPs_n * 3]; GLfloat *ctlpoints = new GLfloat[numCPs_m * numCPs_n * 3];
for (int i = 0; i < numCPs_m; ++i) for (int i = 0; i < numCPs_m; ++i)
...@@ -986,8 +976,6 @@ draw_textured_nurbs( GLState& _state) ...@@ -986,8 +976,6 @@ draw_textured_nurbs( GLState& _state)
float minv( knots_n[bsplineSurface_.degree_n()]); float minv( knots_n[bsplineSurface_.degree_n()]);
float maxu( knots_m[numKnots_m - order_m]); float maxu( knots_m[numKnots_m - order_m]);
float maxv( knots_n[numKnots_n - order_n]); float maxv( knots_n[numKnots_n - order_n]);
// std::cout << "minu = " << minu << ", maxu = " << maxu << std::endl;
// std::cout << "minv = " << minv << ", maxv = " << maxv << std::endl;
// control points of 2d texture ((0,0), (0,1), (1,0), (1,1) ) // control points of 2d texture ((0,0), (0,1), (1,0), (1,1) )
GLfloat tcoords[8] = {0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0}; GLfloat tcoords[8] = {0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment