[osg-users] "LOS" materail query

Robert Osfield robert.osfield at gmail.com
Fri Aug 21 02:28:26 PDT 2015

Hi Mike,

In the osgUtil::LineSegmentItersector::Intersection object there is now (in
OSG-3.2 onwards) the convenience method:

            /** Convenience function for mapping the intersection point to
any textures assigned to the objects intersected.
             *  Returns the Texture pointer and texture coords of object
hit when a texture is available on the object, returns NULL otherwise.*/
            osg::Texture* getTextureLookUp(osg::Vec3& tc) const;

>From the Texture* you can then get the assigned osg::Image, and osg::Image
has a convenience method:

        /** Get the color value for specified texcoord.*/
        Vec4 getColor(const Vec3& texcoord) const;

Which should give you exactly what you want.  It's possible to everything
these new methods do on old versions of the OSG than 3.2 but you'll need to
replicate what these do internally.  Have a look at the source online for
these methods for inspiration.


On 20 August 2015 at 20:58, Mike Greene <mgreene at hiwaay.net> wrote:

> Hi,
> I am wanting to do a dust cloud when an entity (helicopter) lands on a
> terrain. Ideally, would like the color of the dust cloud to be similar to
> the material/texture that the entity is on. Is there a way to do a
> "material/texture color" query based on an entity position, kind of like an
> LOS intersector test?
> Thank you!
> Cheers,
> Mike
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=64857#64857
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20150821/8090d424/attachment-0003.htm>

More information about the osg-users mailing list