Index

Transformations

While most of the time you'll want to manipulate positioning, rotation, and scaling of entities through their own properties in the scene graph, sometimes more precise control over the transformation stack is needed, such as when implementing a camera, or more detailed effects passes.

Trial separates the matrices into a set of three:

The rendering system will take care of resetting the state of the model matrix between every entity's rendering, to ensure that no transformation data leaks.

You can manipulate all of the matrices with the following functions:

Each of the matrices can also be locally constrained via with-pushed-matrix. This allows you to execute temporary transformations without fear of permanently altering the transformations.

There's also an indefinite extent equivalent in push-matrix and pop-matrix. Unlike with-pushed-matrix the depth to which the matrix stack can be pushed is limited, and it can only push the model matrix. Any other matrix is unaffected.

Finally there is vec->screen and screen->vec which attempt to use the current matrices to translate a vector from world coordinates to window coordinates and back. Especially the backwards step is a bit fraught due to the lack of depth information.