Understanding how vertices data "propagates" along nodes tree

Understanding how vertices data "propagates" along nodes tree
0.0 0



I’m working on a game for 3ds platform, and since I have experience working on cocos2d, I though in porting to nintendo’s apis. By the moment I have working the basic scenes-sprites-actions engine, but still don’t understand how exactly is being updated the vertices data for the nodes. What I’m doing so far is overriding transform method on CCSprite, to manually update vertices data after updating the transform matrix (something similar to what’s done on updateTransform). However, this way the final transformation of my sprites are not affected by their parents rotation, scale, etc…

I’m pretty sure katmath is used for this purpose, so I’m trying to use it in the same way, but still don’t get where exactly is updated the sprite vertices data. Could anyone give me some guidance of where/how is vertices array being updated?

Thanks in advance!


May be you can start from CCNode::visit().


Hi Minggo,

thank you very much for your response. Actually, I started from CCDirector::drawScene and followed the complete trace to CCSprite::draw, passing through visit() methods. CCSprite:draw() directly uses quad vertices for debug drawing a square around sprite, but still can’t see where quad vertices are being updated :frowning:


It uses CCNode::transform() to do scale, translate and other actions.


Thanks Minggo,

I’m guessing kmGLMultMatrix( &transfrom4x4 ); call in CCNode::transform() method is one responsible to “propagate” node transformations, but how do the final transformation values are assigned to CCSprite quad vertices arrays?