osgEarth 2.1.1
Classes | Functions

anonymous_namespace{MeshConsolidator.cpp} Namespace Reference

Classes

struct  Collector

Functions

template<typename FROM , typename TO >
osg::PrimitiveSet * copy (FROM *src, unsigned offset)
template<typename FROM >
osg::PrimitiveSet * remake (FROM *src, unsigned numVerts, unsigned offset)
bool canOptimize (osg::Geometry &geom)

Function Documentation

bool anonymous_namespace{MeshConsolidator.cpp}::canOptimize ( osg::Geometry &  geom)

Definition at line 80 of file MeshConsolidator.cpp.

    {
        osg::Array* vertexArray = geom.getVertexArray();
        if ( !vertexArray )
            return false;

        // check that everything is bound per-vertex

        if ( geom.getColorArray() != 0L && geom.getColorBinding() != osg::Geometry::BIND_PER_VERTEX )
            return false;

        if ( geom.getNormalArray() != 0L && geom.getNormalBinding() != osg::Geometry::BIND_PER_VERTEX )
            return false;

        if ( geom.getSecondaryColorArray() != 0L && geom.getSecondaryColorBinding() != osg::Geometry::BIND_PER_VERTEX )
            return false;

        if ( geom.getVertexAttribArrayList().size() > 0 )
        {
            unsigned n = geom.getVertexAttribArrayList().size();
            for( unsigned i=0; i<n; ++i ) 
            {
                if ( geom.getVertexAttribBinding( i ) != osg::Geometry::BIND_PER_VERTEX )
                    return false;
            }
        }

        return true;
    }

Here is the caller graph for this function:

template<typename FROM , typename TO >
osg::PrimitiveSet* anonymous_namespace{MeshConsolidator.cpp}::copy ( FROM *  src,
unsigned  offset 
)

Definition at line 60 of file MeshConsolidator.cpp.

    {
        TO* newDE = new TO( src->getMode() );
        newDE->reserve( src->size() );
        for( typename FROM::const_iterator i = src->begin(); i != src->end(); ++i )
            newDE->push_back( (*i) + offset );
        return newDE;
    }

Here is the caller graph for this function:

template<typename FROM >
osg::PrimitiveSet* anonymous_namespace{MeshConsolidator.cpp}::remake ( FROM *  src,
unsigned  numVerts,
unsigned  offset 
)

Definition at line 70 of file MeshConsolidator.cpp.

    {
        if ( numVerts < 0x100 )
            return copy<FROM,osg::DrawElementsUByte>( src, offset );
        else if ( numVerts < 0x10000 )
            return copy<FROM,osg::DrawElementsUShort>( src, offset );
        else
            return copy<FROM,osg::DrawElementsUInt>( src, offset );
    }

Here is the caller graph for this function:

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines