Hi Per,

Great example, thanks for taking the time to post this.

Ok I created a class SmallFeatureCullExcluder (inherits NodeCallBack) and
added the code you put in the () operator. I also changed the mask to

cullingSet.setCullingMask(cullingSetMask &
~osg::CullSettings::SMALL_FEATURE_CULLING);

Then I added this as a cull-callback on the Geode I want to exclude. I'm
afraid to say it didn't work, it still gets small feature culled.

Also I tried adding it on the parent (PositionAttitudeTransform) and as an
UpdateCallBack instead of CullCallBack, still no luck.

The code is being reached (I set a breakpoint) but when you zoom out enough
the object gets small-feature culled and the code is not reached.

Any ideas what I may be doing wrong?

Thank you,
Andrew

On Tue, Sep 8, 2009 at 8:07 PM, Per Fahlberg <pe...@remograph.com> wrote:

> Hi Andrew,
>
> I was trying to accomplish exactly the same and finally found a solution,
> if you search the mailing list for "Disabling small feature culling for a
> subgraph" you will find the email thread when I discussed this with Robert.
> I've pasted the final solution below for your convinienc.
>
> Regards
> /Per
>
> Hi,
>
> For the record I've found a way to get things working the way I want it, by
> changing the culling mask of the culling set at the back of the projection
> culling stack, small feature culling can now be both enabled and disabled
> for subgraphs. The code for my callback looks like this now (the code is for
> enabling small feature culling, change the "|" to "& ~" to disable small
> feature culling):
>
> virtual void operator() (osg::Node *node, osg::NodeVisitor *nv)
> {
>  osgUtil::CullVisitor *cv = dynamic_cast<osgUtil::CullVisitor*>(nv);
>  if(cv){
>    osg::CullStack::CullingStack &projCullStack =
> cv->getProjectionCullingStack();
>    if(!projCullStack.empty()){
>      osg::CullingSet& cullingSet = projCullStack.back();
>      osg::CullingSet::Mask cullingSetMask = cullingSet.getCullingMask();
>      cullingSet.setCullingMask(cullingSetMask |
> osg::CullSettings::SMALL_FEATURE_CULLING);
>
>      traverse(node,nv);
>            cullingSet.setCullingMask(cullingSetMask);
>    }else
>      // Do not really now what to do if it is empty
>      traverse(node,nv);
>  }else
>    traverse(node,nv);
>
> }
>
> Andrew Thompson wrote:
>
>> Hi there, and thanks for your response,
>> well I am using small feature culling in my application to improve
>> performance. Its a CAD-style app and I have hundreds of thousands of Geodes
>> on the screen at any one time. Many are really small so I am throttling
>> small-feature culling to maintain a decent framerate when moving around.
>> When static the scene re-draws everything.
>> But - there are certain objects, markers around the scene, I'd like to
>> exclude from the small feature cull if possible.
>> If its not possible, no matter, just was hoping there was a simple
>> solution to this.
>> Thank you, Andrew
>>
>> ------------------
>> Read this topic online here:
>> http://forum.openscenegraph.org/viewtopic.php?p=17154#17154
>>
>>
>>
>>
>>
>> _______________________________________________
>> 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

Reply via email to