On Wed, Sep 8, 2010 at 2:26 PM, Vincent Bourdier <[email protected]
> 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<osg::MatrixTransform*>(node);
>>
>>                     if (mtx&&  nv->getFrameStamp())
>>                     {
>>                          std::cout<<"!!!"<<std::endl;
>>                     }
>>
>>
>>     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
>> [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
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to