At rendering time every polygon attribute must correspond to the polygon, so (I guess that) if a vertex of your mesh have two normal (or two color) the loader have to split in the vertexes in two. Try to load a mesh with only smooth edges and the vertexes count should be correct, than try to load a Cube, and if I'm right it should have 24 vertexes.

At save time the vertexes can be grouped again.

Morné Pistorius ha scritto:
Hi guys,

I see a strange problem when I load OBJ files. I use osg::readfilenode() to load an .obj with a known number of vertices, and then inspect the resulting node to see how many vertices was loaded, like so:

    //debug
osg::Node* node = osgDB::readNodeFile( "C:/Data/Meshes/Hand3DIS/Hand3.obj" ); osg::Geode* g = dynamic_cast< osg::Geode*> ( node->asGroup()->getChild(0) );
    osg::Geometry * gm = g->getDrawable(0)->asGeometry();
    osg::Vec3Array * v = (osg::Vec3Array*) gm->getVertexArray();
    std::cout << "verts: " << v->size() << std::endl;

I know my model has 7570 vertices (I inspected the contents of the file, and this is also reported by other obj loaders I tried). but when osg loads this file, it reports 'verts: 8369' in the code above. I need a one to one mapping between osg's vertices and the ones specified in the obj file. Does osg somehow try to automatically optimise the geometry when it is loaded, i.e create triangle strips, etc.

Funny thing though, when I subsequently save the node to .obj using osg, it saves it with the correct no of vertices.

Any ideas?

Thanks, Morne






------------------------------------------------------------------------

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

begin:vcard
fn:Rosario Leonardi
n:Leonardi;Rosario
email;internet:[EMAIL PROTECTED]
x-mozilla-html:TRUE
version:2.1
end:vcard

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to