Re: [Plib-devel] ssg Leaf call backs
Brought to you by:
sjbaker
From: Steve B. <sjb...@ai...> - 2000-03-18 21:21:33
|
"Curtis L. Olson" wrote: > It would be convenient to be able to attach pre/post draw call backs > to branch nodes as well as leaf nodes. ssg allows me to do this now, > but it never calls the functions attached to branches, only leaf > nodes. The trouble is that leaf nodes are not rendered in order - even though I don't (yet) sort by material property, I do render translucent leaf nodes after all the opaque nodes. Hence, if a branch node were to contain both translucent and opaque leaves, there would be no good time to call the callbacks. In future (when I get around to some material sorting), this would be an even bigger problem. > The alternative is to depend on the (?non-defined?) behavior that the > first kid added to a branch is the first one processed during > ssgCullandDraw(). This doesn't seem very satisfying or robust... > especially if I later change the leaf nodes and forget to attach the > call back to the first leaf. It *definitely* doesn't work - even now - because of the transparency thing - and even if you are getting away with it right now, I can promise to break your code sometime in the future. > Or we could be wasteful and attach the callback to every leaf node in > a sub tree, but I'd rather not do that either, but it would be the > safest I suppose. Yep. I guess that's what you need to do. :-( > These things would also need to be considered if you ever impliment > state sorting ... yuk ... the callbacks could get out of sync with the > leaf nodes being drawn! Perhaps we could add some sort of marker node > such that everything below a marker would be state sorted then drawn. > Then you continue traversing/rendering the rest of the tree as before. ...or call the per-branch callbacks multiple times - once for each batch of its child nodes. That would be pretty ugly to implement. > Right now the things I'm interested in doing with callbacks is to set > blend modes and depth testing. In some cases here it's just fine to > set these on a per leaf basis, but in other cases it would be nice to > be able to set these on a per-subtree basis. Sounds like I need to dump those things into ssgState so that they can be done without callbacks. -- Steve Baker http://web2.airmail.net/sjbaker1 sjb...@ai... (home) http://www.woodsoup.org/~sbaker sj...@ht... (work) |