LwMatrix

LwMatrix — A 4x4 matrix class

Functions

Types and Values

struct LwMatrix
struct LwMatrixClass

Object Hierarchy

    GObject
    ╰── LwMatrix

Description

LwMatrix provides some basic matrix functionality.

Functions

lw_matrix_frustum ()

void
lw_matrix_frustum (LwMatrix *self,
                   gfloat left,
                   gfloat right,
                   gfloat bottom,
                   gfloat top,
                   gfloat nearVal,
                   gfloat farVal);

Multiplies the current matrix by a perspective matrix. This transformation produces a perspective projection.

This function is a replacement for the OpenGL function

glFrustum.

Parameters

self

A LwMatrix

 

left

Coordinate of the left vertical clipping plane

 

right

Coordinate of the right vertical clipping plane

 

bottom

Coordinate of the bottom horizontal clipping plane

 

top

Coordinate of the top horizontal clipping plane

 

nearVal

Distance to the nearer depth clipping plane. nearVal must be positive

 

farVal

Distance to the farther depth clipping plane. farVal must be positive

 

Since: 0.5


lw_matrix_get_elements ()

gfloat *
lw_matrix_get_elements (LwMatrix *self);

Parameters

self

A LwMatrix

 

Returns

The elements of the matrix as array.

[array fixed-size=16][transfer none]

Since: 0.5


lw_matrix_multiply ()

void
lw_matrix_multiply (LwMatrix *self,
                    LwMatrix *other);

Multiplies self with other and stores the result in self .

Parameters

self

A LwMatrix

 

other

Another LwMatrix

 

Since: 0.5


lw_matrix_new ()

LwMatrix *
lw_matrix_new ();

Creates a new matrix.

Returns

A new 4x4 identity matrix

Since: 0.5


lw_matrix_ortho ()

void
lw_matrix_ortho (LwMatrix *self,
                 gfloat left,
                 gfloat right,
                 gfloat bottom,
                 gfloat top,
                 gfloat nearVal,
                 gfloat farVal);

Multiplies the current matrix by an orthographic matrix. This tranformation produces a parallel projection.

This function is a replacement for the OpenGL function

glOrtho.

Parameters

self

A LwMatrix

 

left

Coordinate of the left vertical clipping plane

 

right

Coordinate of the right vertical clipping plane

 

bottom

Coordinate of the bottom horizontal clipping plane

 

top

Coordinate of the top horizontal clipping plane

 

nearVal

Distance to the nearer depth clipping plane. A negative value means that the plane is to be behind the viewer.

 

farVal

Distance to the farther depth clipping plane. A negative value means that the plane is to be behind the viewer.

 

Since: 0.5


lw_matrix_pop ()

void
lw_matrix_pop (LwMatrix *self);

Replaces the data of the current matrix with the data on top of the stack.

This function is a replacement for the OpenGL function

glPopMatrix.

Parameters

self

A LwMatrix

 

Since: 0.5


lw_matrix_push ()

void
lw_matrix_push (LwMatrix *self);

Pushes the data of the current matrix on top of the stack.

This function is a replacement for the OpenGL function

glPushMatrix.

Parameters

self

A LwMatrix

 

Since: 0.5


lw_matrix_rotate ()

void
lw_matrix_rotate (LwMatrix *self,
                  gfloat angle,
                  gfloat x,
                  gfloat y,
                  gfloat z);

Multiplies the current matrix by a rotation matrix. The rotation matrix produces a rotation around the vector (x , y , z ) by angle degrees.

This function is a replacement for the OpenGL function

glRotate.

Parameters

self

A LwMatrix

 

angle

Angle of rotation in radians

 

x

x coordinate of a vector

 

y

y coordinate of a vector

 

z

z coordinate of a vector

 

Since: 0.5


lw_matrix_scale ()

void
lw_matrix_scale (LwMatrix *self,
                 gfloat x,
                 gfloat y,
                 gfloat z);

Multiplies the current matrix by a scaling matrix. The scaling matrix produces a nonuniform scaling along the x, y and z axes.

This function is a replacement for the OpenGL function

glScale.

Parameters

self

A LwMatrix

 

x

Scale factor along the x axis

 

y

Scale factor along the y axis

 

z

Scale factor along the z axis

 

Since: 0.5


lw_matrix_translate ()

void
lw_matrix_translate (LwMatrix *self,
                     gfloat x,
                     gfloat y,
                     gfloat z);

Multiplies the current matrix by a translation matrix. The tranlation matrix produces a translation by (x , y , z ).

This function is a replacement for the OpenGL function

glTranslate.

Parameters

self

A LwMatrix

 

x

Translation in x direction

 

y

Translation in y direction

 

z

Translation in z direction

 

Since: 0.5

Types and Values

struct LwMatrix

struct LwMatrix;

This structure represents a 4x4 matrix.

Since: 0.5


struct LwMatrixClass

struct LwMatrixClass {
};