Commit f0718898 authored by Dominik Sibbing's avatar Dominik Sibbing
Browse files

additional check for picking added

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@13064 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 3fa91d58
......@@ -174,25 +174,26 @@ void SplatCloudNode::enterPick( GLState &_state, PickTarget _target, const DrawM
void SplatCloudNode::pick( GLState &_state, PickTarget _target )
{
// if pick target is valid, ...
// if pick target is valid...
if( _target == PICK_ANYTHING || _target == PICK_VERTEX )
{
// set number of pick colors used (each points gets a unique pick color)
if( !_state.pick_set_maximum( points_.size() ) )
if( !_state.pick_set_maximum( numPoints() ) )
{
std::cerr << "SplatCloudNode::pick() : Color range too small, picking failed." << std::endl;
return;
}
// get first pick color
Vec4uc pc = _state.pick_get_name_color( 0 );
// if first pick color has changed, store this color and invalidate VBO (so VBO will be rebuilt and new pick colors will be used)
if( firstPickColor_ != pc )
// if in color picking mode...
if( _state.color_picking() )
{
firstPickColor_ = pc;
vboValid_ = false;
}
// if picking base index has changed, rebuild VBO so new pick colors will be used
if( pickingBaseIndex_ != _state.pick_current_index() )
vboValid_ = false;
// TODO: see above ( enterPick() )
draw( _state, g_pickDrawMode );
// TODO: see above ( enterPick() )
draw( _state, g_pickDrawMode );
}
}
}
......@@ -278,8 +279,12 @@ void SplatCloudNode::rebuildVBO( GLState &_state )
bool hasPS = hasPointsizes();
bool hasCol = hasColors();
// set number of pick colors used (each points gets a unique pick color)
_state.pick_set_maximum( numPoints() );
// if in color picking mode...
if( _state.color_picking() )
{
// store picking base index
pickingBaseIndex_ = _state.pick_current_index();
}
// for all points...
int i, num = numPoints();
......
......@@ -105,7 +105,7 @@ public:
/// Constructor
SplatCloudNode( BaseNode *_parent = 0, std::string _name = "<SplatCloudNode>" ) :
BaseNode ( _parent, _name ),
firstPickColor_ ( Vec4uc(0,0,0,0) ),
pickingBaseIndex_( 0 ),
cur_translation_ ( Point(0.0f,0.0f,0.0f) ),
cur_scale_factor_( 1.0f ),
defaultNormal_ ( Normal(0.0f,0.0f,1.0f) ),
......@@ -215,8 +215,8 @@ private:
PointsizeVector pointsizes_;
ColorVector colors_;
// ---- first picking color ----
Vec4uc firstPickColor_;
// ---- picking base index ----
unsigned int pickingBaseIndex_;
// ---- cur scale and translation ----
Point cur_translation_;
......
Markdown is supported
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