Time for action—collecting triangle faces

The osg::TriangleFunctor<> functor class is ideal for collecting information on triangle faces. It will convert primitive sets of an osg::Drawable object to triangles whenever possible. The template argument must implement an operator() with three const osg::Vec3& parameters and a bool parameter, which will be called for every triangle when the functor is applied.

  1. We will implement the template argument as a structure including an operator(). The first three 3D vector parameters represent the triangle vertices, and the last one indicates whether these vertices come from a temporary vertex array or not:
    struct FaceCollector { void operator()( const osg::Vec3& v1, const osg::Vec3& v2, const osg::Vec3& v3, ...

Get OpenSceneGraph 3.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.