2009/5/28 Xin Chen <osgfo...@tevs.eu>:
> Hello Ismail,
>       Thanks for your reply. I did look at the source code to load .stl 
> models. I found that there are _vertices and _normal variables in the source 
> code. That's why I'm asking if there is a way to access those parameters. Any 
> idea or sample code? Thank you.
> Xin
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=13131#13131
Hello Xin,

no, I have no source code about that. I know it isn't the way to deal
with such situations; but all I can recommend is to walk through the
source code and Google for it! The fact that source code available is
available to us means that we are supposed to use it as much as we can
(again; it'd be much better if we had documentation covering
_everything_ - but it's too difficult to write one).

Normals could be accessed via osg::Geode::getNormalXXXX methods (you
have normal idices, data and binding method - see include/Geometry).
To do that, you need to traverse the returned graph (that is, the
Node* returned). In your NodeVisitor, you can do:
osg::Geode* pGeode = dynamic_cast<osg::Geode*>(pNode); // where, pNode
is pointer to node
if (pGeode) // this is a geode node - query normals
   pGeode->getNormalXXXX // depends on what you want; normal indices,
binding method, etc. see member methods
(to traverse, you need to call "traverse" method on the Node* returned
with a reference to a custom NodeVisitor. See Jason's post, which I
believe covers "how to do it" part)

However, because I've never used any osg plugin (but freetype,
implicitly via osgText), I am not exactly sure whether this is

osg-users mailing list

Reply via email to