Hi Benoit,
There is a merge geometry operation embedded in src/osgUtil/Optimizer.cpp.
Robert.
On Mon, Dec 15, 2008 at 10:28 AM, Benoît Bayol benoit.ba...@gmail.com wrote:
Hi all :)
I am actually building an application which builds tree or any kind of
plants.
So for a tree we have the trunk and branches which are composed by little
elements that we called metamers. Each metamers are linked with others.
My first shot with OSG was to create a recursive algorithm that created a
geode with a geometry at each metamers with the good osg::MatrixTransform
for calculating position. But it was too slow at rendering because of
culling, indeed I had about 3000 geodes with a geometry into each of them.
So I have decided to build the whole plant as a geometry and add it to a
simple geode. So now only one geode and one geometry.
My question is how I can sum the geometry easily ?
osg::ref_ptrosg::Geometry Metamer::Build(Base myBase)
{
osg::ref_ptrosg::Geometry myInternode = this-in.Build(myBase);
this-geometry-setVertexArray(myInternode-getVertexArray());
this-geometry-addPrimitiveSet(myInternode-getPrimitiveSet(0));
myBase.applyDeviationAngle(60);
if (this-GetLateralMetamer(0) != NULL)
{
osg::ref_ptrosg::Geometry lateralMetamer =
this-GetLateralMetamer(0)-Build(myBase);
//HERE IS THERE ANYWAY TO ADD OSG::GEOMETRY TOGETHER ?
this-geometry-setVertexArray(lateralMetamer-getVertexArray());
this-geometry-addPrimitiveSet(lateralMetamer-getPrimitiveSet(0));
}
return this-geometry;
}
Thank you for helping :)
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org