JNGL
Public Member Functions | Public Attributes | List of all members
Mat3 Class Reference

3x3 matrix More...

#include <jngl/Mat3.hpp>

Public Member Functions

 Mat3 ()=default
 creates identity matrix
 
 Mat3 (std::initializer_list< float >)
 construct matrix from row-major array with 9 elements
 
Mat3translate (const Vec2 &v)
 Multiplies the matrix with a translation matrix generated from v. More...
 
Mat3scale (float factor)
 Multiplies the matrix by a scaling matrix. More...
 
Mat3scale (float xfactor, float yfactor)
 Multiplies the matrix by a scaling matrix. More...
 
Mat3rotate (float radian)
 Multiplies the matrix with a rotation matrix. More...
 

Public Attributes

float data [9] = { 1, 0, 0, 0, 1, 0, 0, 0, 1 }
 column-major
 

Detailed Description

3x3 matrix

identical to boost::qvm::mat<float, 3, 3>, but stores the elements column-major in memory

Definition at line 19 of file Mat3.hpp.

Member Function Documentation

◆ translate()

Mat3& translate ( const Vec2 v)

Multiplies the matrix with a translation matrix generated from v.

Returns
*this

◆ scale() [1/2]

Mat3& scale ( float  factor)

Multiplies the matrix by a scaling matrix.

Equivalent to calling Mat3::scale(factor, factor).

Returns
*this

◆ scale() [2/2]

Mat3& scale ( float  xfactor,
float  yfactor 
)

Multiplies the matrix by a scaling matrix.

Returns
*this

If you want to draw a sprite with double the width, but the correct height:

yourSprite.draw(jngl::modelview().scale(2, 1));
Mat3 & scale(float factor)
Multiplies the matrix by a scaling matrix.
jngl::Mat3 modelview()
Returns a copy of the global ModelView matrix.

◆ rotate()

Mat3& rotate ( float  radian)

Multiplies the matrix with a rotation matrix.

Returns
*this

The documentation for this class was generated from the following file: