HI Aurelien,

> Yes, but with a stack, to retrieve the current RenderStage you have to go 
> throught the stack and try to dynamic_cast the RenderBin until you find a 
> RenderStage.

For rendering directly to the main window the RenderStage will be the
first element in the stack, if it's render to texture then you can
have nested RenderStage in which case the second bin will be a
RenderStage too.

> I think this could be realy CPU consuming in some situations (a RenderStage 
> with 10 stacked RenderBins below will need 11 dynamic_cast to retrieve the 
> current RenderStage)

Possible, but you don't typically have 10 nested render bins, and you
want be doing this type of querry very many times per frame.  I very
much expect the cost of cast will be a non issue. if it does turn out
to be an bottleneck then implementing a RenderStage*
RenderBin::getRenderStage() method would be the thing to do.

> Maybe we could store :
> - RenderBin stack
> - the current RenderStage pointer for quick and easy access ?

I guess you could pair it, but it's really just extra data and
duplication that can be quierred relatively cheaply.  Simplicity wins
out in my book.  If you can prove that it's a serious bottleneck then
I'll look again, otherwise I'll just stick to the most straight
forward implementation.  I'm keen to keep things as simple as possible
so the overhead is low - this is feature that very few users will ever
use so I don't want to introduce anything that will introduce a new
bottleneck.

I'll have a bash at implementing it now.

Robert.
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to