[osg-users] Creating an array of same type a given one
Robert Osfield
robert.osfield at gmail.com
Fri Jan 26 08:07:40 PST 2018
Hi Werner,
All osg::Obejct subclasses implement a cloneType() or clone() method
that you can use to create a copy of the same type or do a
shallow/deep copy respectively. This clone being just a virtual
function in a base class return a pointer to osg::Object* so you'll
need to do a cast.
There is also a osg::clone() and osg::cloneType() templates that do
the clone and return the the same type pointer so it does the cast
making it a bit more convineint ot use.
So do something like
osg::ref_ptr<osg::Array> texCoordArrayClone =
osg::clone(texCoordSource, osg::CopyOp::DEEP_COPY);
Robert.
On 26 January 2018 at 15:44, Werner Modenbach
<Werner.Modenbach at texion.eu> wrote:
> Hi all,
>
> I have to copy data from given arrays (i.e.
> geometry->getTexCoordArrayList())
> into new arrays of the same type. So I have to do something like
>
> osg::Geometry::ArrayList textureCoords =
> geometry->getTexCoordArrayList();
>
> osg::Geometry::ArrayList textureCoordsNew(textureCoords.size());
>
> for (int i=0; i<textureCoordsNew.size(); i++)
> textureCoordsNeu[i] = new ???
>
> // Do some manipulation and resorting
>
> geometry->setTexCoordArrayList(textureCoordsNew);
>
> Has anybody a hint for me how to solve this?
>
> Many thanks in advance.
>
> - Werner -
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
More information about the osg-users
mailing list