# shz_xmtrx_blend_4x4

Source: https://sh4zam.com/api/xmtrx/shz_xmtrx_blend_4x4/

```c
SHZ_INLINE void shz_xmtrx_blend_4x4(const shz_mat4x4_t* matrix, float weight) SHZ_NOEXCEPT;
```

Adds and accumulates a scaled 4x4 matrix onto XMTRX.

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `matrix` | `const shz_mat4x4_t *` | 4x4 matrix to multiply and accumulate onto XMTRX. |
| `weight` | `float` | Factor each element in `matrix` gets scaled by. |

## Returns

Nothing (`void`).

## Details

Each component of `joint_matrix` will be multiplied by `weight`, with the result being added to the existing value of that component of XMTRX.

This is useful for accumulating weighted joint matrices onto an initially zeroed-out XMTRX. This allows for in-place construction of a skin matrix, which can then be directly used to transform the vertices of a mesh against for animation.

## 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:** none (call the C function from C++)
- **Type-generic form:** none
- **Back-ends:** SH4: dedicated SH4 implementation · SW: portable C · SPU: shared C implementation
- **Defined in:** [`sh4zam/shz_xmtrx.h:881`](https://github.com/gyrovorbis/sh4zam/blob/ba1e30c88d49df0311870b229e1dd860ef26c477/include/sh4zam/shz_xmtrx.h#L881)
- **Module:** [XMTRX](https://sh4zam.com/api/xmtrx/), section "Miscellaneous"

## See also

[`shz_xmtrx_init_zero`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_zero/), [`shz_xmtrx_blend_3x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_blend_3x4/)
