Cogl.MatrixStack
const Cogl = imports.gi.Cogl; let matrixStack = new Cogl.MatrixStack();
Tracks your current position within a hierarchy and lets you build up a graph of transformations as you traverse through a hierarchy such as a scenegraph.
A Cogl.MatrixStack always maintains a reference to a single transformation at any point in time, representing the transformation at the current position in the hierarchy. You can get a reference to the current transformation by calling Cogl.MatrixStack.prototype.get_entry.
When a Cogl.MatrixStack is first created with Cogl.MatrixStack.new then it is conceptually positioned at the root of your hierarchy and the current transformation simply represents an identity transformation.
As you traverse your object hierarchy (your scenegraph) then you should call Cogl.MatrixStack.prototype.push whenever you move down one level and call Cogl.MatrixStack.prototype.pop whenever you move back up one level towards the root.
At any time you can apply a set of operations, such as "rotate", "scale", "translate" on top of the current transformation of a Cogl.MatrixStack using functions such as Cogl.MatrixStack.prototype.rotate, Cogl.MatrixStack.prototype.scale and Cogl.MatrixStack.prototype.translate. These operations will derive a new current transformation and will never affect a transformation that you have referenced using Cogl.MatrixStack.prototype.get_entry.
Internally applying operations to a Cogl.MatrixStack builds up a graph of Cogl.MatrixEntry structures which each represent a single immutable transform.
Hierarchy
-
Cogl.Object
- Cogl.MatrixStack
Constructors
Methods
- Cogl.MatrixStack.prototype.frustum
- Cogl.MatrixStack.prototype.get
- Cogl.MatrixStack.prototype.get_entry
- Cogl.MatrixStack.prototype.get_inverse
- Cogl.MatrixStack.prototype.load_identity
- Cogl.MatrixStack.prototype.multiply
- Cogl.MatrixStack.prototype.orthographic
- Cogl.MatrixStack.prototype.perspective
- Cogl.MatrixStack.prototype.pop
- Cogl.MatrixStack.prototype.push
- Cogl.MatrixStack.prototype.rotate
- Cogl.MatrixStack.prototype.rotate_euler
- Cogl.MatrixStack.prototype.rotate_quaternion
- Cogl.MatrixStack.prototype.scale
- Cogl.MatrixStack.prototype.set
- Cogl.MatrixStack.prototype.translate