virtual void doUserOperations( osgUtil::LineSegmentIntersector::Intersection& result ) { if ( _lastDrawable.valid() ) { setDrawableColor( _lastDrawable.get(), normalColor ); _lastDrawable = NULL; } osg::Geometry* geom = dynamic_cast<osg::Geometry*>( result.drawable.get() ); if ( geom ) { setDrawableColor( geom, selectedColor ); _lastDrawable = geom; } }
void Data::OsgNode::setIsFocused( bool value ) { mIsFocused = value; if ( mIsFocused ) { removeChild( INDEX_SQUARE, 1 ); this->insertChild( INDEX_SQUARE, createNodeSquare( this->scale, OsgNode::createStateSet( this->type ) ) , false ); removeChild( INDEX_SPHERE, 1 ); this->insertChild( INDEX_SPHERE, createNodeSphere( this->scale , OsgNode::createStateSet( this->type ) ) , false ); setDrawableColor( osg::Vec4( 0.5f, 1.0f, 0.0f, 1.0 ) ); } else { removeChild( INDEX_SQUARE, 1 ); this->insertChild( INDEX_SQUARE, createNodeSquare( this->scale , OsgNode::createStateSet( this->type ) ), false ); removeChild( INDEX_SPHERE, 1 ); this->insertChild( INDEX_SPHERE, createNodeSphere( this->scale , OsgNode::createStateSet( this->type ) ) , false ); setDrawableColor( osg::Vec4( 1.0f, 1.0f, 1.0f, 1.0 ) ); } setValue( graph->getNodeVisual(), true ); }