Commit b6f6bd4e authored by Mike Kremer's avatar Mike Kremer
Browse files

Fixed picking for B-spline curves.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@11335 383ad7c9-94d9-4d36-a494-682f7c89f535
parent f5ae07b8
......@@ -546,13 +546,6 @@ pick(GLState& _state, PickTarget _target)
break;
}
case PICK_EDGE:
{
_state.pick_set_maximum (curve_samples_.size());
pick_curve(_state, 0);
break;
}
case PICK_SPLINE:
{
_state.pick_set_maximum (pick_texture_res_ );
......@@ -563,10 +556,9 @@ pick(GLState& _state, PickTarget _target)
case PICK_ANYTHING:
{
_state.pick_set_maximum (bsplineCurve_.n_control_points() + curve_samples_.size());
_state.pick_set_maximum (bsplineCurve_.n_control_points() + pick_texture_res_);
pick_vertices(_state);
// pick_spline(_state, bsplineCurve_.n_control_points());
pick_curve(_state, bsplineCurve_.n_control_points());
pick_spline(_state, bsplineCurve_.n_control_points());
break;
}
......@@ -608,32 +600,10 @@ pick_vertices( GLState& _state )
//----------------------------------------------------------------------------
template <class BSplineCurve>
void
BSplineCurveNodeT< BSplineCurve >::
pick_curve( GLState& _state, unsigned int _offset)
{
// radius in pixels
int psize = 7;
glBegin(GL_LINE_STRIP);
for (unsigned int i = 0; i < curve_samples_.size(); ++i)
{
if(i > 0)
_state.pick_set_name (i - 1 + _offset);
Vec3d pos = curve_samples_[i].first;
glVertex3f(pos[0], pos[1], pos[2]);
}
glEnd();
}
//----------------------------------------------------------------------------
template <class BSplineCurve >
void
BSplineCurveNodeT<BSplineCurve>::
pick_spline( GLState& _state, unsigned int /*_offset*/ )
pick_spline( GLState& _state, unsigned int _offset )
{
glPushAttrib(GL_ALL_ATTRIB_BITS);
......@@ -642,9 +612,9 @@ pick_spline( GLState& _state, unsigned int /*_offset*/ )
// glEnable(GL_MAP1_TEXTURE_COORD_1);
if( _state.pick_current_index () != pick_texture_baseidx_)
if( _state.pick_current_index () + _offset != pick_texture_baseidx_)
{
pick_texture_baseidx_ = _state.pick_current_index();
pick_texture_baseidx_ = _state.pick_current_index() + _offset;
pick_create_texture( _state);
}
else
......
......@@ -173,7 +173,6 @@ public:
private:
void pick_vertices(GLState& _state);
void pick_curve( GLState& _state, unsigned int _offset);
void pick_spline( GLState& _state, unsigned int _offset );
void draw_cylinder( const Point& _p0, const Point& _axis, double _r, GLState& _state, unsigned int _slices = 16, unsigned int _stacks = 1);
......
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