OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Disabling small feature culling for a subgraph


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
Per Fahlberg
Guest





PostPosted: Wed Nov 26, 2008 12:35 pm    Post subject:
Disabling small feature culling for a subgraph
Reply with quote

Hi,

I'm trying to disable small feature culling for a subgraph, but so far I
have not been able to disable it with other than calling
setCullingActive(false) on the leaf geodes. The leaf geodes are actually
shared between several subgraphs and I don't want to disable small
feature culling for all of them, so I need a way to disable small
feature culling higher up in the scenegraph.

I have tried to use a cull callback to disable small feature culling for
the subgraph but without success, the code for the cull callback is
pasted below.

class MyCullingCallback : public osg::NodeCallback
{
public:
MyCullingCallback() : osg::NodeCallback()
{}

virtual void operator() (osg::Node *node, osg::NodeVisitor *nv)
{
osgUtil::CullVisitor *cv = dynamic_cast<osgUtil::CullVisitor*>(nv);
if(cv){
osg::CullSettings::CullingMode cm = cv->getCullingMode();
cv->setCullingMode(cm & ~osg::CullSettings::SMALL_FEATURE_CULLING);
traverse(node,nv);
cv->setCullingMode(cm);
}else
traverse(node,nv);
}
};
...
node->setCullCallback(new MyCullingCallback);

Regards,
Per


------------------
Post generated by Mail2Forum
Back to top
Per Fahlberg
Guest





PostPosted: Tue Dec 02, 2008 11:34 am    Post subject:
Disabling small feature culling for a subgraph
Reply with quote

Hi,

Perhaps I wasn't clear in my question so I will try once more, is there
a way to disable small feature culling for just a subgraph not the
entire scene?

Regards,
Per

Per Fahlberg wrote:
Quote:
Hi,

I'm trying to disable small feature culling for a subgraph, but so far
I have not been able to disable it with other than calling
setCullingActive(false) on the leaf geodes. The leaf geodes are
actually shared between several subgraphs and I don't want to disable
small feature culling for all of them, so I need a way to disable
small feature culling higher up in the scenegraph.

I have tried to use a cull callback to disable small feature culling
for the subgraph but without success, the code for the cull callback
is pasted below.

class MyCullingCallback : public osg::NodeCallback
{
public:
MyCullingCallback() : osg::NodeCallback()
{}

virtual void operator() (osg::Node *node, osg::NodeVisitor *nv)
{
osgUtil::CullVisitor *cv = dynamic_cast<osgUtil::CullVisitor*>(nv);
if(cv){
osg::CullSettings::CullingMode cm = cv->getCullingMode();
cv->setCullingMode(cm & ~osg::CullSettings::SMALL_FEATURE_CULLING);
traverse(node,nv);
cv->setCullingMode(cm);
}else
traverse(node,nv);
}
};
...
node->setCullCallback(new MyCullingCallback);

Regards,
Per





------------------
Post generated by Mail2Forum
Back to top
Robert Osfield
Guest





PostPosted: Tue Dec 02, 2008 1:12 pm    Post subject:
Disabling small feature culling for a subgraph
Reply with quote

Hi Per,

On Tue, Dec 2, 2008 at 11:34 AM, Per Fahlberg <> wrote:
Quote:
Perhaps I wasn't clear in my question so I will try once more, is there a
way to disable small feature culling for just a subgraph not the entire
scene?

The only way is is use a cull callback to cache the previous setting,
set the new setting do the traverse and the restore the original
value. Your original callback does this, but I don't know why it
doesn't work. Note, I haven't tried it myself so I can't provide any
further direction, you'll just have to dig into the source code.

Robert.


------------------
Post generated by Mail2Forum
Back to top
Per Fahlberg
Guest





PostPosted: Tue Dec 02, 2008 1:24 pm    Post subject:
Disabling small feature culling for a subgraph
Reply with quote

Hi Robert,

Thanks for confirming that I'm not doing anything wrong, I'll try to dig
deeper to see what might be wrong.

Regards,
Per

Robert Osfield wrote:
Quote:
Hi Per,

On Tue, Dec 2, 2008 at 11:34 AM, Per Fahlberg <> wrote:

Quote:
Perhaps I wasn't clear in my question so I will try once more, is there a
way to disable small feature culling for just a subgraph not the entire
scene?


The only way is is use a cull callback to cache the previous setting,
set the new setting do the traverse and the restore the original
value. Your original callback does this, but I don't know why it
doesn't work. Note, I haven't tried it myself so I can't provide any
further direction, you'll just have to dig into the source code.

Robert.






------------------
Post generated by Mail2Forum
Back to top
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts culling / bounding calculation for sh... christoph General 3 Thu Mar 28, 2019 1:17 pm View latest post
No new posts Happy New Year to all OSG Users Chris Hanson General 0 Mon Jan 07, 2019 10:17 am View latest post
No new posts osg-users Digest, Vol 138, Issue 27 Zachary1234 General 0 Tue Jan 01, 2019 1:16 am View latest post
No new posts osg-users Digest, Vol 137, Issue 14 poweruserm@live.com.au General 0 Fri Nov 16, 2018 11:16 pm View latest post
No new posts Shadow frustum culling Gedalia Pasternak General 4 Mon Oct 29, 2018 6:44 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP