Functions

void hal_gfx_mat4x4_load_identity (hal_gfx_matrix4x4_t m)
 Load a 4x4 Identity Matrix. More...
 
void hal_gfx_mat4x4_mul (hal_gfx_matrix4x4_t m, hal_gfx_matrix4x4_t m_l, hal_gfx_matrix4x4_t m_r)
 Multiply two 4x4 matrices. More...
 
void hal_gfx_mat4x4_mul_vec (hal_gfx_matrix4x4_t m, float *x, float *y, float *z, float *w)
 Multiply a 4x1 vector with a 4x4 matrix. More...
 
void hal_gfx_mat4x4_translate (hal_gfx_matrix4x4_t m, float tx, float ty, float tz)
 Apply translate transformation. More...
 
void hal_gfx_mat4x4_scale (hal_gfx_matrix4x4_t m, float sx, float sy, float sz)
 Apply scale transformation. More...
 
void hal_gfx_mat4x4_rotate_X (hal_gfx_matrix4x4_t m, float angle_degrees)
 Apply rotate transformation around X axis. More...
 
void hal_gfx_mat4x4_rotate_Y (hal_gfx_matrix4x4_t m, float angle_degrees)
 Apply rotate transformation around Y axis. More...
 
void hal_gfx_mat4x4_rotate_Z (hal_gfx_matrix4x4_t m, float angle_degrees)
 Apply rotate transformation around Z axis. More...
 
void hal_gfx_mat4x4_load_perspective (hal_gfx_matrix4x4_t m, float fovy_degrees, float aspect, float nearVal, float farVal)
 Set up a perspective projection matrix. More...
 
void hal_gfx_mat4x4_load_ortho (hal_gfx_matrix4x4_t m, float left, float right, float bottom, float top, float nearVal, float farVal)
 Set up an orthographic projection matrix. More...
 
void hal_gfx_mat4x4_load_ortho_2d (hal_gfx_matrix4x4_t m, float left, float right, float bottom, float top)
 Set up a 2D orthographic projection matrix. More...
 
int hal_gfx_mat4x4_obj_to_win_coords (hal_gfx_matrix4x4_t mvp, float x_orig, float y_orig, int width, int height, float nearVal, float farVal, float *x, float *y, float *z, float *w)
 Convenience Function to calculate window coordinates from object coordinates. More...
 

Detailed Description

Function Documentation

◆ hal_gfx_mat4x4_load_identity()

void hal_gfx_mat4x4_load_identity ( hal_gfx_matrix4x4_t  m)

Load a 4x4 Identity Matrix.

Parameters
[in]mMatrix to be loaded

◆ hal_gfx_mat4x4_load_ortho()

void hal_gfx_mat4x4_load_ortho ( hal_gfx_matrix4x4_t  m,
float  left,
float  right,
float  bottom,
float  top,
float  nearVal,
float  farVal 
)

Set up an orthographic projection matrix.

Parameters
[in]mA 4x4 Matrix
[in]leftLeft vertical clipping plane
[in]rightRight vertical clipping plane
[in]bottombottom horizontal clipping plane
[in]topTop horizontal clipping plane
[in]nearValDistance from the viewer to the near clipping plane (always positive)
[in]farValDistance from the viewer to the far clipping plane (always positive)

◆ hal_gfx_mat4x4_load_ortho_2d()

void hal_gfx_mat4x4_load_ortho_2d ( hal_gfx_matrix4x4_t  m,
float  left,
float  right,
float  bottom,
float  top 
)

Set up a 2D orthographic projection matrix.

Parameters
[in]mA 4x4 Matrix
[in]leftLeft vertical clipping plane
[in]rightRight vertical clipping plane
[in]bottombottom horizontal clipping plane
[in]topTop horizontal clipping plane

◆ hal_gfx_mat4x4_load_perspective()

void hal_gfx_mat4x4_load_perspective ( hal_gfx_matrix4x4_t  m,
float  fovy_degrees,
float  aspect,
float  nearVal,
float  farVal 
)

Set up a perspective projection matrix.

Parameters
[in]mA 4x4 Matrix
[in]fovy_degreesField of View in degrees
[in]aspectAspect ratio that determines the field of view in the x direction.
[in]nearValDistance from the viewer to the near clipping plane (always positive)
[in]farValDistance from the viewer to the far clipping plane (always positive)

◆ hal_gfx_mat4x4_mul()

void hal_gfx_mat4x4_mul ( hal_gfx_matrix4x4_t  m,
hal_gfx_matrix4x4_t  m_l,
hal_gfx_matrix4x4_t  m_r 
)

Multiply two 4x4 matrices.

Parameters
[in]mResult Matrix
[in]m_lLeft operand
[in]m_rRight operand

◆ hal_gfx_mat4x4_mul_vec()

void hal_gfx_mat4x4_mul_vec ( hal_gfx_matrix4x4_t  m,
float *  x,
float *  y,
float *  z,
float *  w 
)

Multiply a 4x1 vector with a 4x4 matrix.

Parameters
[in]mMatrix to be multiplied
[in]xVector first element
[in]yVector second element
[in]zVector third element
[in]wVector forth element

◆ hal_gfx_mat4x4_obj_to_win_coords()

int hal_gfx_mat4x4_obj_to_win_coords ( hal_gfx_matrix4x4_t  mvp,
float  x_orig,
float  y_orig,
int  width,
int  height,
float  nearVal,
float  farVal,
float *  x,
float *  y,
float *  z,
float *  w 
)

Convenience Function to calculate window coordinates from object coordinates.

Parameters
[in]mvpModel, View and Projection Matrix
[in]x_origWindow top left X coordinate
[in]y_origWindow top left Y coordinate
[in]widthWindow width
[in]heightWindow height
[in]nearValDistance from the viewer to the near clipping plane (always positive)
[in]farValDistance from the viewer to the far clipping plane (always positive)
[in]xX object coordinate
[in]yY object coordinate
[in]zZ object coordinate
[in]wW object coordinate
Returns
1 if vertex is outside frustum (should be clipped)

◆ hal_gfx_mat4x4_rotate_X()

void hal_gfx_mat4x4_rotate_X ( hal_gfx_matrix4x4_t  m,
float  angle_degrees 
)

Apply rotate transformation around X axis.

Parameters
[in]mMatrix to apply transformation
[in]angle_degreesAngle to rotate in degrees

◆ hal_gfx_mat4x4_rotate_Y()

void hal_gfx_mat4x4_rotate_Y ( hal_gfx_matrix4x4_t  m,
float  angle_degrees 
)

Apply rotate transformation around Y axis.

Parameters
[in]mMatrix to apply transformation
[in]angle_degreesAngle to rotate in degrees

◆ hal_gfx_mat4x4_rotate_Z()

void hal_gfx_mat4x4_rotate_Z ( hal_gfx_matrix4x4_t  m,
float  angle_degrees 
)

Apply rotate transformation around Z axis.

Parameters
[in]mMatrix to apply transformation
[in]angle_degreesAngle to rotate in degrees

◆ hal_gfx_mat4x4_scale()

void hal_gfx_mat4x4_scale ( hal_gfx_matrix4x4_t  m,
float  sx,
float  sy,
float  sz 
)

Apply scale transformation.

Parameters
[in]mMatrix to apply transformation
[in]sxX scaling factor
[in]syY scaling factor
[in]szZ scaling factor

◆ hal_gfx_mat4x4_translate()

void hal_gfx_mat4x4_translate ( hal_gfx_matrix4x4_t  m,
float  tx,
float  ty,
float  tz 
)

Apply translate transformation.

Parameters
[in]mMatrix to apply transformation
[in]txX translation factor
[in]tyY translation factor
[in]tzZ translation factor