Closed UserAB1236872 closed 10 years ago
I'll note that I somehow got off my gourd and totally misremembered how the matrix stack works. The previous implementation has been named the TransformStack
, and the new MatrixStack should work like GL's which is an explicit state COPYING stack.
Both OpenGL's old matrix model and GLM provide matrix stacks. I think this is worthing putting in a new package. A Matrix stack is, in essence, a fully-persistent data structure that keeps track of matrix mutations and allows you to roll back and arbitrary number of operations. This is extremely useful for, e.g., scenegraphs.. A sketch of push, for instance:
The biggest question is whether the stack should be Mat4 only (I believe OpenGL took this approach?) or whether there should be support for Mat3 and Mat2 as well. I suspect the basic (push/pop/peek/load) implementation will be fewer than 200 lines per matrix type, so it may be worth just doing all 3.