Ejemplo n.º 1
0
void HeightFieldDrawable::accept(osg::PrimitiveFunctor& pf) const
{
    // use the cached vertex positions for PrimitiveFunctor operations
    if (!_geometry) return;

    if (_vertices.valid())
    {
        pf.setVertexArray(_vertices->size(), &((*_vertices)[0]));

        const osg::DrawElementsUShort* deus = dynamic_cast<const osg::DrawElementsUShort*>(_geometry->getDrawElements());
        if (deus)
        {
            pf.drawElements(GL_QUADS, deus->size(), &((*deus)[0]));
        }
        else
        {
            const osg::DrawElementsUInt* deui = dynamic_cast<const osg::DrawElementsUInt*>(_geometry->getDrawElements());
            if (deui)
            {
                pf.drawElements(GL_QUADS, deui->size(), &((*deui)[0]));
            }
        }
    }
    else
    {
        _geometry->accept(pf);
    }
}
Ejemplo n.º 2
0
void Text3D::accept(osg::PrimitiveFunctor& pf) const
{
    // ** for each line, do ...
    TextRenderInfo::const_iterator itLine, endLine = _textRenderInfo.end();
    for (itLine = _textRenderInfo.begin(); itLine!=endLine; ++itLine)
    {
        // ** for each glyph in the line, do ...
        LineRenderInfo::const_iterator it, end = itLine->end();
        for (it = itLine->begin(); it!=end; ++it)
        {
            pf.setVertexArray(it->_glyph->getVertexArray()->size(),&(it->_glyph->getVertexArray()->front()));

            // ** render the front face of the glyph
            osg::Geometry::PrimitiveSetList & pslFront = it->_glyph->getFrontPrimitiveSetList();
            for(osg::Geometry::PrimitiveSetList::const_iterator itr=pslFront.begin(), end = pslFront.end(); itr!=end; ++itr)
            {
                (*itr)->accept(pf);
            }

            // ** render the wall face of the glyph
            osg::Geometry::PrimitiveSetList & pslWall = it->_glyph->getWallPrimitiveSetList();
            for(osg::Geometry::PrimitiveSetList::const_iterator itr=pslWall.begin(), end=pslWall.end(); itr!=end; ++itr)
            {
                (*itr)->accept(pf);
            }

            // ** render the back face of the glyph
            osg::Geometry::PrimitiveSetList & pslBack = it->_glyph->getBackPrimitiveSetList();
            for(osg::Geometry::PrimitiveSetList::const_iterator itr=pslBack.begin(), end=pslBack.end(); itr!=end; ++itr)
            {
                (*itr)->accept(pf);
            }
        }
    }
}
Ejemplo n.º 3
0
void SharedGeometry::accept(osg::PrimitiveFunctor& pf) const
{
    pf.setVertexArray(_vertexArray->getNumElements(),static_cast<const osg::Vec3*>(_vertexArray->getDataPointer()));

    _drawElements->accept(pf);
}
Ejemplo n.º 4
0
void ImpostorSprite::accept(osg::PrimitiveFunctor& functor) const
{
    functor.setVertexArray(4,_coords);
    functor.drawArrays( GL_QUADS, 0, 4);

}