Hi Oliver, There isn't much the osgUtil intersection code can do about temporary data as created by ShapeDrawable. ShapeDrawable is really just meant for very simply usage, such as quick a dirty debugging, I don't recommend it's general usage.
Robert. On Tue, Jan 4, 2011 at 1:52 PM, Oliver Neumann <[email protected]> wrote: > Hi, > > I am trying to get uv coordinates and color of a point I found using the > LineSegmentIntersector. My problem is that the found intersection has no > indexList so I cannot use the code used in osgmovie. > > This short code example should boil down to the point: > > > Code: > > osg::Box* b = new osg::Box( osg::Vec3d(0,0,0), 1.0f); > osg::Geode* g = new osg::Geode(); > g->addDrawable( new osg::ShapeDrawable( b ) ); > osg::ref_ptr< osgUtil::LineSegmentIntersector> lineSeg > = new osgUtil::LineSegmentIntersector(osg::Vec3d(0,-2,0), osg::Vec3d(0,0,0)); > osgUtil::IntersectionVisitor > findIntersections(lineSeg.get()); > g->accept(findIntersections); > osgUtil::LineSegmentIntersector::Intersection currHit > = lineSeg->getFirstIntersection(); > osg::Vec3d intersecPnt = > currHit.getWorldIntersectPoint(); > int vecArraySize = currHit.indexList.size(); > int vecRatioSize = currHit.ratioList.size(); > > > > > intersecPnt is correctly found, but vecArraySize and vecRatioSize is zero. > > I read through some layers of osg code and it seems my proble is the > treatVertexDataAsTemporary variable. It prevents at the end of > TriangleIntersector::operator () (part of LineSegmentIntersectorUtils in > linesegmentintersector.cpp) that the found three vertices used to compute the > intersection are inserted into the result as they are "temporary". > > How do I get the correct uv coordinates in such a situation or how do I force > the inclusion of the needed vertices? > > Cheers, > Oliver > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=35293#35293 > > > > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

