Re: [osg-users] Update callbacks and LOD
On Wed, Sep 8, 2010 at 2:26 PM, Vincent Bourdier wrote: > Hi, > > To my mind there are two solutions : > > 1. You put your callback on the LOD child you want, so when the child will > be hidden by a upper-detailed level child, the callback should not be > traversed > No, the update traversal visits all children. The eye point is not available in the update traversal so the LOD choice cannot be made. Also, an update callback might change the position of a node and thus change the LOD calculation. > > 2. in your callback you check if your node is still active, and if not, > just do nothing. > > Yes, you can do some approximation of the LOD test, though again, you'd have to specify a view point outside of OSG. Another strategy would be to turn your update callback into a "stateless" cull callback that alters the model-view matrix on the fly without actually changing the child nodes. You have to be careful about the bounding volumes of objects to which you do this; otherwise they might disappear from view unexpectedly. Tim ... > > Le 08/09/2010 14:20, Roman Grigoriev a écrit : > > Hi, >> I have LOD with 3 nodes and use updatecallback to Animate children, I >> setup updatecallback to my highest LOD, my when i switch to medium lod my >> update callback worked also. Is it possible to switch it off when my model >> switches to another LOD. >> my updatecallback >> class ModelNodeCallbackTower : public osg::NodeCallback >> { >> public: >>virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) >>{ >> osg::MatrixTransform* mtx = >> dynamic_cast(node); >> >> if (mtx&& nv->getFrameStamp()) >> { >> std::cout<<"!!!"<> } >> >> >> traverse(node, nv); >>} >> }; >> >> ... >> >> Thank you! >> >> Cheers, >> Roman >> >> -- >> Read this topic online here: >> http://forum.openscenegraph.org/viewtopic.php?p=31412#31412 >> >> >> >> >> >> ___ >> 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 > ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Update callbacks and LOD
Hi,Robert In osg terms Active children are childrens with nodemasks with 0x or not. Culled childs ( not in view frustum) are active or not in osg terms? Could you please advice me how to make this thing in osg: highest LOD have update callback and medium an lowest don't have it. Could you please give me some sample how can I apply cullcallback to my node. Thank you! Cheers, Roman -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31421#31421 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Update callbacks and LOD
Hi Roman, On Wed, Sep 8, 2010 at 2:34 PM, Roman Grigoriev wrote: > Hi, Vincent > > 1.I've already placed my update callback under LOD child and it traversed, > maybe I need to setup viewer or over thing in osg to not travers hidden > childs? The UpdateVisitor by default traverses all children, but you can change it to traverse just the active children via: viewer.getUpdateVisitor()->setTraversalMode(osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN); There is however a problem in that LOD's activity is selected during the cull traversal... the update visitor can only assume the highest level of detail children. > 2. How can I check in callback if node is active or not? A cull callback on the child will tell you whether that child is active or not. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Update callbacks and LOD
Hi, Vincent 1.I've already placed my update callback under LOD child and it traversed, maybe I need to setup viewer or over thing in osg to not travers hidden childs? 2. How can I check in callback if node is active or not? ... Thank you! Cheers, Roman -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31419#31419 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Update callbacks and LOD
Hi, To my mind there are two solutions : 1. You put your callback on the LOD child you want, so when the child will be hidden by a upper-detailed level child, the callback should not be traversed 2. in your callback you check if your node is still active, and if not, just do nothing. Hope this will help you. Regards, Vincent. Le 08/09/2010 14:20, Roman Grigoriev a écrit : Hi, I have LOD with 3 nodes and use updatecallback to Animate children, I setup updatecallback to my highest LOD, my when i switch to medium lod my update callback worked also. Is it possible to switch it off when my model switches to another LOD. my updatecallback class ModelNodeCallbackTower : public osg::NodeCallback { public: virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) { osg::MatrixTransform* mtx = dynamic_cast(node); if (mtx&& nv->getFrameStamp()) { std::cout<<"!!!"
[osg-users] Update callbacks and LOD
Hi, I have LOD with 3 nodes and use updatecallback to Animate children, I setup updatecallback to my highest LOD, my when i switch to medium lod my update callback worked also. Is it possible to switch it off when my model switches to another LOD. my updatecallback class ModelNodeCallbackTower : public osg::NodeCallback { public: virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) { osg::MatrixTransform* mtx = dynamic_cast(node); if (mtx && nv->getFrameStamp()) { std::cout<<"!!!"