osgEarth 2.1.1
Public Member Functions | Protected Attributes

osgEarth::Symbology::MeshSubdivider Class Reference

List of all members.

Public Member Functions

 MeshSubdivider (const osg::Matrixd &world2local=osg::Matrixd::identity(), const osg::Matrixd &local2world=osg::Matrixd::identity())
void setMaxElementsPerEBO (unsigned int value)
void run (osg::Geometry &geom, double granurality_radians, GeoInterpolation interp=GEOINTERP_RHUMB_LINE)

Protected Attributes

osg::Matrixd _local2world
osg::Matrixd _world2local
unsigned int _maxElementsPerEBO

Detailed Description

Recursively subdivides (tesselates) a geocentric geometry mesh to the specified granularity. This class will densify a geocentric primitive to more accurately conform to the ellipsoidal surface of the earth, for example.

Definition at line 34 of file MeshSubdivider.


Constructor & Destructor Documentation

MeshSubdivider::MeshSubdivider ( const osg::Matrixd &  world2local = osg::Matrixd::identity(),
const osg::Matrixd &  local2world = osg::Matrixd::identity() 
)

Construct a new subdivider. Optionally, provide localizer/delocalizer transforms that will take vertex locations in and out of world geocentric coordinates.

Definition at line 593 of file MeshSubdivider.cpp.

                                                               :
_local2world(local2world),
_world2local(world2local),
_maxElementsPerEBO( INT_MAX )
{
    if ( !_world2local.isIdentity() && _local2world.isIdentity() )
        _local2world = osg::Matrixd::inverse(_world2local);
    else if ( _world2local.isIdentity() && !_local2world.isIdentity() )
        _world2local = osg::Matrixd::inverse(_local2world);
}

Member Function Documentation

void MeshSubdivider::run ( osg::Geometry &  geom,
double  granurality_radians,
GeoInterpolation  interp = GEOINTERP_RHUMB_LINE 
)

Subdivides an OSG geometry's primitives to the specified granularity. Granularity is an angle, specified in radians - it is the maximum allowable angle between two points in a triangle.

This method will also coalesce all the polygonal primitive sets in the geometry into a single GL_TRIANGLES primitive.

Note! This utility currently does nothing with repsect to the geometry's color or texture attributes, so it is best used prior to setting those.

Definition at line 606 of file MeshSubdivider.cpp.

{
    if ( geom.getNumPrimitiveSets() < 1 )
        return;

    subdivide( granularity, interp, geom, _world2local, _local2world, _maxElementsPerEBO );
}

Here is the call graph for this function:

Here is the caller graph for this function:

void osgEarth::Symbology::MeshSubdivider::setMaxElementsPerEBO ( unsigned int  value) [inline]

Sets the maximum number elements in each generated primitive set. This class will break up the resulting geometry if requested.

Definition at line 50 of file MeshSubdivider.

                                                        {
            _maxElementsPerEBO = value; }

Member Data Documentation

Definition at line 70 of file MeshSubdivider.

Definition at line 71 of file MeshSubdivider.

Definition at line 70 of file MeshSubdivider.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines