A traversal context with coordinate transforms.
A transform context maintains transforms for converting coordinates
among five different coordinate systems:
local
the local coordinate system for a node in the scene graph. Vertex
coordinates for a node are specified in a local system, which may
or may not be the same as the world coordinate system. Two nodes
with the same local vertex coordinates (or even a single node) may
appear in different locations, corresponding to different world
coordinates.
world
the coordinate system for the world (root) node of the scene graph.
A local-to-world transform puts all nodes in the same one world
coordinate system. World coordinates are independent of any view
of the world.
view
a right-handed coordinate system in which the eye or camera is located
at the origin, looking down the negative z axis, with the positive y
axis up and the positive x axis right. A world-to-view transform
typically pushes the world away from the camera, down the negative z
axis. As the name implies, view coordinates depend on the view.
cube
a left-handed, normalized coordinate system with six clipping planes.
In this coordinate system,
x = -1 and x = 1 correspond to the left and right planes,
y = -1 and y = 1 correspond to the bottom and top planes, and
z = -1 and z = 1 correspond to the near and far planes.
A view-to-cube transform corresponds to a view's projection;
e.g., perspective or orthographic.
pixel
typically, a right-handed coordinate system in which x and y coordinates
are window coordinates. For a window with width w and height h,
x = 0 and x = w-1 correspond to the leftmost and rightmost pixels, and
y = 0 and y = h-1 correspond to the topmost and bottommost pixels.
The pixel z (depth) coordinate is a floating point number, where
z = 0.0 and z = 1.0 correspond to the near and far clipping planes.
A cube-to-pixel transform typically depends on the dimensions of the
window in which a scene is rendered.
When traversing the scenegraph, the world-to-view, view-to-cube, and
cube-to-pixel transforms do not change. However, nodes that transform
coordinates will push, modify, and pop the local-to-world transform,
using the methods
#pushLocalToWorld(Matrix44) and
#popLocalToWorld().