Hello Oren,

It seems that the node isn't loaded at all.
As I do something similar in my database compiler, I think you will have to actually load the proxy node at least once to calculate the correct bounds for it: You code is correct, but as you defer loading of the real model, the ComputeBoundsVisitor will end up having a no children to traverse. What I do is to hook up in the load callbacks and to load every model once to be able to set the correct bounds (and other stuff) to the ProxyNodes that reference it. (They get written by the compiler if references are encountered)

Hope that help
Sebastian
Howdy friends,

I'm loading a model using an osg::ProxyNode like this:


Code:

std::map<std::string, osg::ref_ptr<osg::Node>  >  model_db_map;
...
if (model_db_map[name] == NULL)
{
osg::ref_ptr<osg::ProxyNode>  pn = new osg::ProxyNode;
pn->setLoadingExternalReferenceMode 
(osg::ProxyNode::DEFER_LOADING_TO_DATABASE_PAGER);
pn->setFileName (0, name + ".ive");
model_db_map[name] = pn;
}




shortly after this I compute the bounding box like this:

Code:

osg::ref_ptr<Node>  node = model_db_map[name];
osg::ComputeBoundsVisitor bb;
node->accept(bb);




problem is I then get this for bb.getBoundingBox()._min:

Code:
(gdb) p bboxMin
$1 = {_v = {3.40282347e+38, 3.40282347e+38, 3.40282347e+38}}



and this for bb.getBoundingBox()._max:

Code:
(gdb) p bboxMax
$2 = {_v = {-3.40282347e+38, -3.40282347e+38, -3.40282347e+38}}



and my stdout gets repeatedly bombed with this:


Code:
CullVisitor::apply(Geode&) detected NaN,
     depth=nan, center=(0 0 0),
     matrix={
         nan nan nan nan
         nan nan nan nan
         nan nan nan nan
         nan nan nan nan
}




Why is this so? The bounding box is computed correctly when using 
osgDB::readNodeFile instead of osg::ProxyNode. Thanks in advance.

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=41522#41522





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


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

Reply via email to