rs_matrix.rsh File Reference

- Overview
- Globals
- Structs

Functions
rs_matrix.rsh File Reference

## Functions
_RS_RUNTIME void | rsMatrixSet (rs_matrix4x4 *m, uint32_t row, uint32_t col, float v)
_RS_RUNTIME void | rsMatrixSet (rs_matrix3x3 *m, uint32_t row, uint32_t col, float v)
_RS_RUNTIME void | rsMatrixSet (rs_matrix2x2 *m, uint32_t row, uint32_t col, float v)
_RS_RUNTIME float | rsMatrixGet (const rs_matrix4x4 *m, uint32_t row, uint32_t col)
_RS_RUNTIME float | rsMatrixGet (const rs_matrix3x3 *m, uint32_t row, uint32_t col)
_RS_RUNTIME float | rsMatrixGet (const rs_matrix2x2 *m, uint32_t row, uint32_t col)
void | rsMatrixLoadIdentity (rs_matrix4x4 *m)
void | rsMatrixLoadIdentity (rs_matrix3x3 *m)
void | rsMatrixLoadIdentity (rs_matrix2x2 *m)
void | rsMatrixLoad (rs_matrix4x4 *m, const float *v)
void | rsMatrixLoad (rs_matrix3x3 *m, const float *v)
void | rsMatrixLoad (rs_matrix2x2 *m, const float *v)
void | rsMatrixLoad (rs_matrix4x4 *m, const rs_matrix4x4 *v)
void | rsMatrixLoad (rs_matrix4x4 *m, const rs_matrix3x3 *v)
void | rsMatrixLoad (rs_matrix4x4 *m, const rs_matrix2x2 *v)
void | rsMatrixLoad (rs_matrix3x3 *m, const rs_matrix3x3 *v)
void | rsMatrixLoad (rs_matrix2x2 *m, const rs_matrix2x2 *v)
void | rsMatrixLoadRotate (rs_matrix4x4 *m, float rot, float x, float y, float z)
void | rsMatrixLoadScale (rs_matrix4x4 *m, float x, float y, float z)
void | rsMatrixLoadTranslate (rs_matrix4x4 *m, float x, float y, float z)
void | rsMatrixLoadMultiply (rs_matrix4x4 *m, const rs_matrix4x4 *lhs, const rs_matrix4x4 *rhs)
void | rsMatrixLoadMultiply (rs_matrix3x3 *m, const rs_matrix3x3 *lhs, const rs_matrix3x3 *rhs)
void | rsMatrixLoadMultiply (rs_matrix2x2 *m, const rs_matrix2x2 *lhs, const rs_matrix2x2 *rhs)
void | rsMatrixMultiply (rs_matrix4x4 *m, const rs_matrix4x4 *rhs)
void | rsMatrixMultiply (rs_matrix3x3 *m, const rs_matrix3x3 *rhs)
void | rsMatrixMultiply (rs_matrix2x2 *m, const rs_matrix2x2 *rhs)
void | rsMatrixRotate (rs_matrix4x4 *m, float rot, float x, float y, float z)
void | rsMatrixScale (rs_matrix4x4 *m, float x, float y, float z)
void | rsMatrixTranslate (rs_matrix4x4 *m, float x, float y, float z)
void | rsMatrixLoadOrtho (rs_matrix4x4 *m, float left, float right, float bottom, float top, float near, float far)
void | rsMatrixLoadFrustum (rs_matrix4x4 *m, float left, float right, float bottom, float top, float near, float far)
void | rsMatrixLoadPerspective (rs_matrix4x4 *m, float fovy, float aspect, float near, float far)
_RS_RUNTIME float4 | rsMatrixMultiply (rs_matrix4x4 *m, float4 in)
_RS_RUNTIME float3 | rsMatrixMultiply (rs_matrix3x3 *m, float3 in)
_RS_RUNTIME float2 | rsMatrixMultiply (rs_matrix2x2 *m, float2 in)
bool | rsMatrixInverse (rs_matrix4x4 *m)
bool | rsMatrixInverseTranspose (rs_matrix4x4 *m)
void | rsMatrixTranspose (rs_matrix4x4 *m)
void | rsMatrixTranspose (rs_matrix3x3 *m)
void | rsMatrixTranspose (rs_matrix2x2 *m)

## Detailed Description

Matrix routines.

Definition in file rs_matrix.rsh.

## Function Documentation

_RS_RUNTIME float rsMatrixGet | ( | const rs_matrix4x4 * | m,
|  | uint32_t | row,
|  | uint32_t | col
| ) |  |

Get one element of a matrix.

Parameters:

  m | The matrix to read from
  row |
  col |

Returns:
  float

_RS_RUNTIME float rsMatrixGet | ( | const rs_matrix3x3 * | m,
|  | uint32_t | row,
|  | uint32_t | col
| ) |  |

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

_RS_RUNTIME float rsMatrixGet | ( | const rs_matrix2x2 * | m,
|  | uint32_t | row,
|  | uint32_t | col
| ) |  |

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

bool rsMatrixInverse | ( | rs_matrix4x4 * | m | ) |

Returns true if the matrix was successfully inversed

Parameters:

  m |

bool rsMatrixInverseTranspose | ( | rs_matrix4x4 * | m | ) |

Returns true if the matrix was successfully inversed and transposed.

Parameters:

  m |

void rsMatrixLoad | ( | rs_matrix4x4 * | m,
|  | const float * | v
| ) |  |

Set the elements of a matrix from an array of floats.

Parameters:

  m |

void rsMatrixLoad | ( | rs_matrix3x3 * | m,
|  | const float * | v
| ) |  |

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void rsMatrixLoad | ( | rs_matrix2x2 * | m,
|  | const float * | v
| ) |  |

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void rsMatrixLoad | ( | rs_matrix4x4 * | m,
|  | const rs_matrix4x4 * | v
| ) |  |

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void rsMatrixLoad | ( | rs_matrix4x4 * | m,
|  | const rs_matrix3x3 * | v
| ) |  |

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void rsMatrixLoad | ( | rs_matrix4x4 * | m,
|  | const rs_matrix2x2 * | v
| ) |  |

Set the elements of a matrix from another matrix.

Parameters:

  m |

void rsMatrixLoad | ( | rs_matrix3x3 * | m,
|  | const rs_matrix3x3 * | v
| ) |  |

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void rsMatrixLoad | ( | rs_matrix2x2 * | m,
|  | const rs_matrix2x2 * | v
| ) |  |

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void rsMatrixLoadFrustum | ( | rs_matrix4x4 * | m,
|  | float | left,
|  | float | right,
|  | float | bottom,
|  | float | top,
|  | float | near,
|  | float | far
| ) |  |

Load an Frustum projection matrix constructed from the 6 planes

Parameters:

  m |
  left |
  right |
  bottom |
  top |
  near |
  far |

void rsMatrixLoadIdentity | ( | rs_matrix4x4 * | m | ) |

Set the elements of a matrix to the identity matrix.

Parameters:

  m |

void rsMatrixLoadIdentity | ( | rs_matrix3x3 * | m | ) |

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void rsMatrixLoadIdentity | ( | rs_matrix2x2 * | m | ) |

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void rsMatrixLoadMultiply | ( | rs_matrix4x4 * | m,
|  | const rs_matrix4x4 * | lhs,
|  | const rs_matrix4x4 * | rhs
| ) |  |

Multiply two matrix (lhs, rhs) and place the result in m.

Parameters:

  m |
  lhs |
  rhs |

void rsMatrixLoadMultiply | ( | rs_matrix3x3 * | m,
|  | const rs_matrix3x3 * | lhs,
|  | const rs_matrix3x3 * | rhs
| ) |  |

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void rsMatrixLoadMultiply | ( | rs_matrix2x2 * | m,
|  | const rs_matrix2x2 * | lhs,
|  | const rs_matrix2x2 * | rhs
| ) |  |

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void rsMatrixLoadOrtho | ( | rs_matrix4x4 * | m,
|  | float | left,
|  | float | right,
|  | float | bottom,
|  | float | top,
|  | float | near,
|  | float | far
| ) |  |

Load an Ortho projection matrix constructed from the 6 planes

Parameters:

  m |
  left |
  right |
  bottom |
  top |
  near |
  far |

void rsMatrixLoadPerspective | ( | rs_matrix4x4 * | m,
|  | float | fovy,
|  | float | aspect,
|  | float | near,
|  | float | far
| ) |  |

Load an perspective projection matrix constructed from the 6 planes

Parameters:

  m |
  fovy | Field of view, in degrees along the Y axis.
  aspect | Ratio of x / y.
  near |
  far |

void rsMatrixLoadRotate | ( | rs_matrix4x4 * | m,
|  | float | rot,
|  | float | x,
|  | float | y,
|  | float | z
| ) |  |

Load a rotation matrix.

Parameters:

  m |
  rot |
  x |
  y |
  z |

void rsMatrixLoadScale | ( | rs_matrix4x4 * | m,
|  | float | x,
|  | float | y,
|  | float | z
| ) |  |

Load a scale matrix.

Parameters:

  m |
  x |
  y |
  z |

void rsMatrixLoadTranslate | ( | rs_matrix4x4 * | m,
|  | float | x,
|  | float | y,
|  | float | z
| ) |  |

Load a translation matrix.

Parameters:

  m |
  x |
  y |
  z |

void rsMatrixMultiply | ( | rs_matrix4x4 * | m,
|  | const rs_matrix4x4 * | rhs
| ) |  |

Multiply the matrix m by rhs and place the result back into m.

Parameters:

  m | (lhs)
  rhs |

void rsMatrixMultiply | ( | rs_matrix3x3 * | m,
|  | const rs_matrix3x3 * | rhs
| ) |  |

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void rsMatrixMultiply | ( | rs_matrix2x2 * | m,
|  | const rs_matrix2x2 * | rhs
| ) |  |

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

_RS_RUNTIME float4 rsMatrixMultiply | ( | rs_matrix4x4 * | m,
|  | float4 | in
| ) |  |

Multiply a vector by a matrix and return the result vector. API version 10-13

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

_RS_RUNTIME float3 rsMatrixMultiply | ( | rs_matrix3x3 * | m,
|  | float3 | in
| ) |  |

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

_RS_RUNTIME float2 rsMatrixMultiply | ( | rs_matrix2x2 * | m,
|  | float2 | in
| ) |  |

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void rsMatrixRotate | ( | rs_matrix4x4 * | m,
|  | float | rot,
|  | float | x,
|  | float | y,
|  | float | z
| ) |  |

Multiple matrix m with a rotation matrix

Parameters:

  m |
  rot |
  x |
  y |
  z |

void rsMatrixScale | ( | rs_matrix4x4 * | m,
|  | float | x,
|  | float | y,
|  | float | z
| ) |  |

Multiple matrix m with a scale matrix

Parameters:

  m |
  x |
  y |
  z |

_RS_RUNTIME void rsMatrixSet | ( | rs_matrix4x4 * | m,
|  | uint32_t | row,
|  | uint32_t | col,
|  | float | v
| ) |  |

Set one element of a matrix.

Parameters:

  m | The matrix to be set
  row |
  col |
  v |

Returns:
  void

_RS_RUNTIME void rsMatrixSet | ( | rs_matrix3x3 * | m,
|  | uint32_t | row,
|  | uint32_t | col,
|  | float | v
| ) |  |

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

_RS_RUNTIME void rsMatrixSet | ( | rs_matrix2x2 * | m,
|  | uint32_t | row,
|  | uint32_t | col,
|  | float | v
| ) |  |

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void rsMatrixTranslate | ( | rs_matrix4x4 * | m,
|  | float | x,
|  | float | y,
|  | float | z
| ) |  |

Multiple matrix m with a translation matrix

Parameters:

  m |
  x |
  y |
  z |

void rsMatrixTranspose | ( | rs_matrix4x4 * | m | ) |

Transpose the matrix m.

Parameters:

  m |

void rsMatrixTranspose | ( | rs_matrix3x3 * | m | ) |

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void rsMatrixTranspose | ( | rs_matrix2x2 * | m | ) |

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.