[osg-users] "LOS" materail query

Mike Greene mgreene at hiwaay.net
Tue Aug 25 12:20:22 PDT 2015


Hi,

using the example, osgparticleeffects.cpp, I added the following lines of code to the pick function (inside the //MGREENE section):


Code:

void pick(osgViewer::Viewer* viewer, const osgGA::GUIEventAdapter& ea)
    {
        osg::Group* root = dynamic_cast<osg::Group*>(viewer->getSceneData());       
        if (!root) return;
        
        osgUtil::LineSegmentIntersector::Intersections intersections;
        if (viewer->computeIntersections(ea,intersections))
        {
            const osgUtil::LineSegmentIntersector::Intersection& hit = *intersections.begin();

          //MGREENE
			std::cout << "hit = " << hit.getWorldIntersectPoint().x() << "," << hit.getWorldIntersectPoint().y() << "," << hit.getWorldIntersectPoint().z() << std::endl;
			
			osg::Vec3 tc(0,0,0);
			osg::ref_ptr<osg::Texture> myTexture = hit.getTextureLookUp(tc);
			std::cout << "tc = " << tc.x() << "," << tc.y() << "," << tc.z()<< std::endl;
			//END MGREENE

            bool handleMovingModels = false;
...




but the values of tc are always 0,0,0.

Thank you!

Cheers,
Mike[/code]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=64894#64894








More information about the osg-users mailing list