Hello all,

i'm a little bit confused about the geometry handling in OpenSG 1.8.
I'm trying to merge a tree of geometry nodes into a single geometry node.
Therefore i'm using the Geometry::merge() function. 
This works perfectly, the results look resonable.
After merging all geometries i'm calling osg::createSharedIndex( .. ) on the 
newly created geometry to remove unnecessary vertices, normals and so on.

At the end i'm trying to save the newly created geometry into wavefront obj 
format. I'm using our own obj writer implementation which is of course very 
similar to obj writer provided by OpenSG.

Looking at the written geometry file i'm wondering why it contains lots of 
redundant vertex and normal data. I expected the osg::createSharedIndex( .. ) 
function to remove them.

Find below an excerpt of our writer that simply contains the vertex and faces 
writing sections. 

Any suggestions how to avoid these redundancies?

Thanks for your support,
Michael


...

GeoPositions3fPtr pos = GeoPositions3fPtr::dcast(geo->getPositions());
GeoPositions3f::StoredFieldType *posfield = pos->getFieldPtr();

for (GeoPositions3f::StoredFieldType::iterator it = posfield->begin(); it != 
posfield->end(); it++)
{       
        Pnt3f pnt = *it;
        (*file) << "v \t" << pnt.x() << " \t" << pnt.y() << " \t" << pnt.z() << 
"\n";
}


(*file) << "\n";


for (TriangleIterator it = geo->beginTriangles(); it != geo->endTriangles(); 
++it)
{

        (*file) << "f \t" << it.getPositionIndex(0) + posCount;
        (*file) << " \t" << it.getPositionIndex(1) + posCount;
        (*file) << " \t" << it.getPositionIndex(2) + posCount << "\n";
}

posCount += geo->getPositions()->size();

...
-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

------------------------------------------------------------------------------
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to