DNESS / cocos2d-iphone

Automatically exported from code.google.com/p/cocos2d-iphone
1 stars 0 forks source link

Enhancement: Separate trans and draw structures #176

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I'd love to see the trans and draw tree's broken into two structures. It's 
often desirable to have 
somethings draw order not be affected by it's translation, in that the two are 
basically locked 
together right now. I'd still have addObject make the object a child of the 
parent in both tree's, but 
have a separate setParent and setDrawParent call to override the default 
behavior.

Original issue reported on code.google.com by slipster...@gmail.com on 31 Jan 2009 at 6:57

GoogleCodeExporter commented 9 years ago
Too much of complexity and no clear benefits. It is possible to show a simple 
real-life example?

Original comment by anton....@gmail.com on 2 Feb 2009 at 9:35

GoogleCodeExporter commented 9 years ago
I can definitely understand why you wouldn't want to do it, but here's an 
example case of why it's useful. For 
instance, the engine we use at Harmonix does this, and I've been surprised at 
how useful it can be. As a cocos 
example, lets consider the streak stuff I've been writing.

The way the current streak code works is that you parent the streak to the 
object that's causing the streak, 
and it generates ribbon segments based on the inherited motion. Works great. 
However, in one of my current 
games I really want the streaks all drawn behind all of the objects that are 
causing the streaks. Because the 
trans and draw tree's are tightly coupled, there's no automatic way to do this. 
Instead, I have to write code 
that manually updates the streak objects each frame to have the same positions 
as the objects they are 
implicitly tied to. Thats not the end of the world or anything, but with 
separate trans/draw tree's stuff like that 
just goes away. 

Original comment by slipster...@gmail.com on 2 Feb 2009 at 1:41