Main | API | Shaders (SBO) | vecByMatrixCol

Function

vecByMatrixCol(vector, matrix, offset);

Multiples a vector with a 4x4 matrix in column 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 column 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 vecByMatrixRow, 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 column 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.