Main | API | Shaders (SBO) | vecByMatrixRow

Function

vecByMatrixRow(vector, matrix, offset);

Multiples a vector with a 4x4 matrix in row major order.

Parameters

vector - [Reference of Float Array]

The vector that is being modified. Can be of any length.

matrix - [Reference of Float Array]

The matrix being used, must have 16 elements in row order.

offset - [Integer]

The offset within the vector where the first element is. This allows your four elements to be multiplied be at any point in the vector.

Return

None.

Description

This function, and it's alternate vecByMatrixCol, are were opened to the shaders in order to save the user having to create them. They simply take your vector data and multiply it with a 16 element matrix stored in row major order. This is very useful for your vertex transformations within the vertex shader. The offset is used for cases where the XYZW values are not stored at the front of the vertex attributes, however I assume most cases they would be.

This function is supplied by WR_Core and not the main WebRender interface, and should be called on the render reference that is passed to the shader. See the tutorial 2 for more information.

Additional Notes

None.