Hi Vincent,
Vincent Bourdier wrote:
> If if do a nodevisitior, I've the problem that the operator() takes a
> nodevisitor in parameter and so I can't obtain the cull state with that.
> (method isCulled() not aviable from a node visitor)
The way I understood Robert, the fact that your operator() is called means the
node in
question is *not* culled so you could simple set your _isCulled=true. And
don't forget to
call traverse().
> Next, if I do a osg::drawable::Cullvisitor, I see how so implement the
> cull() method, but It is a const method, so I can't add my own code in it to
> memorize the cull state before looking at it.
The Drawable::CullCallback serves a different purpose.
It can be used to actively cull Drawables.
Cheers,
/ulrich
>> Vincent Bourdier wrote:
>>> _mainChild->getDrawable(0)->setCullCallback(new tileVisibleCallback());
>>>
>>> ***
>>> tileVisibleCallback::tileVisibleCallback(){
>>> _cull = false;
>>> };
>>>
>>> void tileVisibleCallback::operator()(osg::Node* node,
>> osgUtil::CullVisitor*
>>> nv){
>>> _cull = nv->isCulled(*node);
>>> osg::notify(osg::NOTICE)<<"Cull "<<_cull<<"\n";
>>>
>>> };
>>>
>>> bool tileVisibleCallback::isCulled(){
>>> return _cull;
>>> };
>> You're mixing up osg::Drawable::CullCallback and osg::NodeCallback and
>> consequently
>> osg::Node::setCullCallback and osg::Drawable::setCullCallback.
>>
>> osg::Drawable::CullCallback has a virtual cull() function that tells if the
>> Drawable
>> *should* be culled by returning true or false.
>>
>> osg::NodeCallback has a virtual operator() that does what you want.
>>
>> You need to derive your callback from osg::NodeCallback, implement
>> operator() (as you
>> already do), and call:
>> _mainChild->setCullCallback(...)
>> instead of
>> _mainChild->getDrawable(0)->setCullCallback(...)
>>
>> Hope this helps,
>> /ulrich
>>
>>> 2008/9/25 Vincent Bourdier <[EMAIL PROTECTED]>
>>>> class tileVisibleCallback : public osg::Drawable::CullCallback{
>>>> public:
>>>> tileVisibleCallback();
>>>> virtual void operator()(osg::Node* node, osgUtil::CullVisitor* nv);
>>>> bool isCulled();
>>>>
>>>> private:
>>>> bool _cull;
>>>>
>>>> };
>>>>
>>>> Does it sound good for you ?
>>>> (the mix between Cullcallback and osgUtil looks strange for me...
>> but...)
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org