osgEarth 2.1.1
|
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 |
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.
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); }
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 ); }
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; }
osg::Matrixd osgEarth::Symbology::MeshSubdivider::_local2world [protected] |
Definition at line 70 of file MeshSubdivider.
unsigned int osgEarth::Symbology::MeshSubdivider::_maxElementsPerEBO [protected] |
Definition at line 71 of file MeshSubdivider.
osg::Matrixd osgEarth::Symbology::MeshSubdivider::_world2local [protected] |
Definition at line 70 of file MeshSubdivider.