# shz_mat4x4_init_rotation_dir

Source: https://sh4zam.com/api/matrix/shz_mat4x4_init_rotation_dir/

> Initializes the given 4x4 matrix to contain a 3D rotation matrix of angle radians about the given direction

```c
SHZ_INLINE void shz_mat4x4_init_rotation_dir(shz_mat4x4_t* mat, float angle, float x, float y, float z) SHZ_NOEXCEPT;
```

Initializes the given 4x4 matrix to contain a 3D rotation matrix of `angle` radians about the given direction.

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `mat` | `shz_mat4x4_t *` |  |
| `angle` | `float` |  |
| `x` | `float` |  |
| `y` | `float` |  |
| `z` | `float` |  |

## Returns

Nothing (`void`).

## Details

This is a faster version of `shz_mat4x4_init_rotation()` or glRotatef() which requires being passed a unit vector for the rotation axis.

## Warnings

- The vector components representing the axis of rotation must be prenormalized!

## Naming and requirements

- `shz_mat4x4_t` and `shz_mat2x2_t` arguments must be 8-byte aligned. Unaligned data goes through the `float[16]` parameters of the `_unaligned` routines.

## Availability

- **C++ equivalent:** [`shz::mat4x4::init_rotation_dir`](https://sh4zam.com/api/cpp/mat4x4/#init_rotation_dir)
- **Type-generic form:** none
- **Back-ends:** SH4: shared C implementation · SW: portable C · SPU: shared C implementation
- **Defined in:** [`sh4zam/shz_matrix.h:198`](https://github.com/gyrovorbis/sh4zam/blob/ba1e30c88d49df0311870b229e1dd860ef26c477/include/sh4zam/shz_matrix.h#L198)
- **Module:** [Matrix](https://sh4zam.com/api/matrix/), section "Initialization"

## See also

[`shz_mat4x4_init_rotation`](https://sh4zam.com/api/matrix/shz_mat4x4_init_rotation/)
