Hi Robert,
robertosfield wrote:
> Secondly the intersections you get returned return the leaf node and
> drawable that is intersected along with the node path from the root of
> the intersection traversal down to the leaf node that was intersected.
you found my problem: I forgot that the demo access only the leaf node, so I
can solve may problem by searching right node on nodePath.
But I can't use nodePath like expected. To play a little bit with the nodePath
I wanted to print all names of nodes
So my first try was:
Code:
bool nodeFound = false;
for(osgUtil::LineSegmentIntersector::Intersections::iterator hitr =
intersections.begin(); hitr != intersections.end(); ++hitr)
{
osg::NodePath path = hitr->nodePath;
for(osg::NodePath::iterator hitNodeIt = path = hitr->nodePath.begin();
hitNodeIt != path = hitr->nodePath.end(); ++hitNodeIt)
{
if (hitNodeIt->getName())
{
nodeFound = true;
std::cout << hitNodeIt->getName();
}
}
if (nodeFound) break;
}
Then I got:
> IntelliSense: Es ist keine passende benutzerdefinierte Konvertierung von "
> "std::_Vector_const_iterator<std::_Vector_val<osg::Node *,
> std::allocator<osg::Node *>>>"" in
> ""std::_Vector_iterator<std::_Vector_val<osg::Node *,
> std::allocator<osg::Node *>>>"" vorhanden.
So I tried this:
Code:
bool nodeFound = false;
for(osgUtil::LineSegmentIntersector::Intersections::iterator hitr =
intersections.begin(); hitr != intersections.end(); ++hitr)
{
for(osg::NodePath::const_iterator hitNodeIt = hitr->nodePath.begin();
hitNodeIt != hitr->nodePath.end(); ++hitNodeIt)
{
if (hitNodeIt->getName())
{
nodeFound = true;
std::cout << hitNodeIt->getName();
}
}
if (nodeFound) break;
}
But this won't compile too:
> error C2039: 'getName': Ist kein Element von
> 'std::_Vector_const_iterator<_Myvec>'
> error C2839: Ungültiger Rückgabetyp 'osg::Node *const *' für überladenen
> Operator '->'
> IntelliSense: Der Ausdruck muss den Typ "pointer-to-class" aufweisen.
>
Any idea?
Heiko
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=36554#36554
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org