Transpose a matrix in GLSL.
#pragma glslify: transpose = require(glsl-transpose)
void main() {
mat3 m = mat3(1, 2, 3,
4, 5, 6,
7, 8, 9);
mat3 mt = transpose(m);
//now mt is the transpose of m
}
Install with npm:
npm install glsl-transpose
Then use with glslify.
#pragma glslify: transpose = require(glsl-transpose)
Computes the transpose of a matrix
m
is a matrix to transpose, eitherfloat, mat2, mat3
ormat4
Returns The transpose of m
(c) 2014 Mikola Lysenko. MIT License