Hi Julie,

On 26 August 2015 at 08:06, Julie Green <[email protected]> wrote:

> Stupid me finally got it.
>
> Code:
>
> osg::Geometry surface = new osg::Geometry();
> surface->setVertexArray(vertexArray);
> surface->setDataVariance(osg::Object::DYNAMIC);
> surface->setUpdateCallback(new UpdateSurfaceCallback());
>
>
> What i don't understand is how to get elements of vertex array in operator
> method using node pointer.
>
>

Either do a asGeometry() or a dynamic_cast of the Node* to osg::Geometry*
and then get the arrays from there. i.e



void UpdateSurfaceCallback::operator()(Node* node, NodeVisitor*)
{
    osg::Geometry* geometry = node->asGeometry();  // asGeometry() is
faster than dynamic_cast<>, but requires Node* to be a valid object.
    if (geometry)
    {
         osg::Array* vertices = geometry->getVertexArray();
         .....
    }
}
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to