Class

CoglMatrixStack

Description [src]

final class Cogl.MatrixStack : GObject.Object
{
  /* No available fields */
}

Efficiently tracking many related transformations.

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 CoglMatrixStack 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_matrix_stack_get_entry().

When a CoglMatrixStack is first created with cogl_matrix_stack_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_matrix_stack_push() whenever you move down one level and call cogl_matrix_stack_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 CoglMatrixStack using functions such as cogl_matrix_stack_rotate(), cogl_matrix_stack_scale() and cogl_matrix_stack_translate(). These operations will derive a new current transformation and will never affect a transformation that you have referenced using cogl_matrix_stack_get_entry().

Internally applying operations to a CoglMatrixStack builds up a graph of CoglMatrixEntry structures which each represent a single immutable transform.

Hierarchy

hierarchy this CoglMatrixStack ancestor_0 GObject ancestor_0--this

Ancestors

Constructors

cogl_matrix_stack_new

Allocates a new CoglMatrixStack that can be used to build up transformations relating to objects in a scenegraph like hierarchy. (See the description of CoglMatrixStack and CoglMatrixEntry for more details of what a matrix stack is best suited for).

Instance methods

cogl_matrix_stack_frustum

Replaces the current matrix with a perspective matrix for a given viewing frustum defined by 4 side clip planes that all cross through the origin and 2 near and far clip planes.

cogl_matrix_stack_get

Resolves the current stack transform into a #graphene_matrix_t by combining the operations that have been applied to build up the current transform.

cogl_matrix_stack_get_entry

Gets a reference to the current transform represented by a CoglMatrixEntry pointer.

cogl_matrix_stack_load_identity

Resets the current matrix to the identity matrix.

cogl_matrix_stack_multiply

Multiplies the current matrix by the given matrix.

cogl_matrix_stack_pop

Restores the previous transform that was last saved by calling cogl_matrix_stack_push().

cogl_matrix_stack_push

Saves the current transform and starts a new transform that derives from the current transform.

cogl_matrix_stack_rotate

Multiplies the current matrix by one that rotates the around the axis-vector specified by x, y and z. The rotation follows the right-hand thumb rule so for example rotating by 10 degrees about the axis-vector (0, 0, 1) causes a small counter-clockwise rotation.

cogl_matrix_stack_rotate_euler

Multiplies the current matrix by one that rotates according to the rotation described by euler.

cogl_matrix_stack_scale

Multiplies the current matrix by one that scales the x, y and z axes by the given values.

cogl_matrix_stack_set

Replaces the current stack matrix value with the value of matrix. This effectively discards any other operations that were applied since the last time cogl_matrix_stack_push() was called or since the stack was initialized.

cogl_matrix_stack_translate

Multiplies the current matrix by one that translates along all three axes according to the given values.

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Signals

Signals inherited from GObject (1)
GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

Class structure

struct CoglMatrixStackClass {
  GObjectClass parent_class;
  
}

No description available.

Class members
parent_class: GObjectClass

No description available.