Hi Claudio,

is it possibile with osgUtil::IntersectionVisitor, know what is intersected polygon (example the number 2 or the named "ad32") and which texture is mapped to this polygon?(the name of file which contains the texture)

See the documentation of osgUtil::LineSegmentIntersector::Intersection. (which you get from the LineSegmentIntersector which you gave to the IntersectionVisitor)

http://www.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs/a01467.html

In the Public Attributes:
* nodePath is the path to the node that was hit for this intersection
* drawable is the drawable that was hit (osg::Geometry or whatever)
* primitiveIndex is the index of the primitive that was hit, so if drawable is an osg::Geometry which has one primitiveSet in mode GL_TRIANGLES, primitiveIndex would be the triangle index that was hit (formed of vertices 3*primitiveIndex, 3*primitiveIndex+1 and 3*primitiveIndex+2 in the geometry's vertex array). How to get the primitive/vertices independently of primitive set mode, I don't know, you'll have to work that out yourself. There must be some code in OSG that does this already, check the osgpick example or look around in the OSG sources. * To get the texture, just traverse the nodePath and get the last texture once you get to drawable (checking the nodes' statesets). You can't get the texture filename like that, but perhaps you can have a map of filename to texture* in your app and make the correspondence that way.


(the rest is speculation, someone please correct me if I'm wrong)

I think ratioList is the barycentric coordinates of where the hit occurred on the polygon (i.e. if it was a triangle that was hit, there will be 3 ratios in ratioList, which you can then use to find out where in the triangle the hit occurred by multiplying the 3 vertices of the triangle by the 3 ratios) but I'm not sure. If that's the case, you can do the same with the triangle's texture coordinates at the 3 same vertices and thus get where in the texture the hit occured.


In general, you should get acquainted with the doxygen-generated reference documentation, and be prepared to navigate through the pages in it to find out how to "connect" things together and where to get the information you need.

Hope this helps,

J-S
--
______________________________________________________
Jean-Sebastien Guay    [EMAIL PROTECTED]
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to