I'm trying to implement a simple scene graph on iOS using GLKit but handling origin/anchor points is giving me fits. The requirements are pretty straightforward:
- There is a graph of nodes each with translation, rotation, scale and origin point.
- Each node combines the properties above into a single matrix (which is multiplied by it's parent's matrix if it has a parent).
- Nodes need to honor their parent's coordinate system - including the origin point (i.e. a child's origin should line up with the parent's origin)
So the question is:
What operations (e.g. scaleMatrix * rotationMatrix * translationMatrix, etc.) need to be performs and in what order so as to achieve the proper handling of origin/anchor points?
P.S. - If you are kind enough to post an answer please mention whether your answer is based on column or row major matrices - that's a perennial source of confusion for me.