[osg-users] cullcallback and visitor ?

Vincent Bourdier vincent.bourdier at gmail.com
Thu Sep 25 09:20:21 PDT 2008


So, ... it is not good :

I added my visitor on a drawable :

_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;
};


Nothing is return as cull state... the visitor seem do be visiting
nothing...

Any Idea ? experience ?

Thanks.

Regards,
Vincent.

2008/9/25 Vincent Bourdier <vincent.bourdier at gmail.com>

> Okay, it sound more complicated ...
>
> Just to be sure :
>
> 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...)
>
> Thanks,
> Regards.
>   Vincent
>
> 2008/9/25 Robert Osfield <robert.osfield at gmail.com>
>
>> On Thu, Sep 25, 2008 at 4:23 PM, Vincent Bourdier
>>
>> <vincent.bourdier at gmail.com> wrote:
>> > Hi Robert,
>> >
>> > How is it possible to test directly against the view frustum ? manually
>> ? or
>> > is there a method still implemented ?
>> > thanks.
>>
>> You create an osg::Polytope from the Camera's view and projection
>> matrix which will be your frustum,  then transform by any transforms
>> in the parent path to place the frustum in local coordinate, then test
>> the objects bounding sphere/bound box against this frustum.  The
>> osgUtil::PolytopeVisitor does most of this so could learn a lot form
>> this.
>>
>> Robert.
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080925/5644ae81/attachment-0003.htm>


More information about the osg-users mailing list