Hi Paul,
On my side I finally ended with the initial design I had in mind:
I use a specific nodecallback on the node where the stateset containing my
uniforms is. This callbacks, used as a CullCallback give me the opportunity
to call the uniform update callbacks with a cullvisitor during the cull
phase.
It's not the cleanest option (I'd really wish there were cull callbacks for
uniforms directly!) but it works very well for me:
void UniformCullCallbackBridge::operator()(osg::Node * node,
osg::NodeVisitor * nv) {
// Bouml preserved body begin 00035E8A
// retrieve the stateset on the node:
osg::StateSet* ss = node->getStateSet();
if(ss) {
osg::StateSet::UniformList& uniforms = ss->getUniformList();
for(osg::StateSet::UniformList::iterator uitr = uniforms.begin();
uitr != uniforms.end();
++uitr)
{
osg::Uniform::Callback* callback =
uitr->second.first->getUpdateCallback();
if (callback) (*callback)(uitr->second.first.get(),nv);
}
}
return traverse(node,nv);
// Bouml preserved body end 00035E8A
}
Thanks to everyone for your help/explanations on this.
Manu.
2010/1/30 Paul Martz <[email protected]>
> Emmanuel Roche wrote:
>
>> Those questions were indeed closely related. Yet since I'm not planing to
>> use slave cameras for the moment I guess I'm better of with my "node
>> cullcallback to update uniforms", at least I will try that.
>>
>
> The subject was poorly chosen. The thread was more related to how to set a
> different uniform per cull/draw pair - per display or per window. Setting
> the uniforms in the slave camera StateSet is one solution, and Robert's
> recent code change is designed to support that usage.
>
> I wanted my solution to work whether the application used slave cameras or
> not, so, like you, I needed this to work without slave cameras. The solution
> I choose was to push a StateSet containing a uniform onto the CullVisitor's
> state stack.
>
> Hope that helps.
> -Paul
>
>
> _______________________________________________
> 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