Skip to content

Commit

Permalink
fix: Implement the transpose function only in webgl1
Browse files Browse the repository at this point in the history
  • Loading branch information
06wj committed Jan 30, 2023
1 parent 1853d3e commit 012a4f7
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions src/shader/method/transpose.glsl
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
float transpose(float m) {
return m;
}
#ifndef HILO_IS_WEBGL2
float transpose(float m) {
return m;
}

mat2 transpose(mat2 m) {
return mat2(m[0][0], m[1][0],
m[0][1], m[1][1]);
}
mat2 transpose(mat2 m) {
return mat2(m[0][0], m[1][0],
m[0][1], m[1][1]);
}

mat3 transpose(mat3 m) {
return mat3(m[0][0], m[1][0], m[2][0],
m[0][1], m[1][1], m[2][1],
m[0][2], m[1][2], m[2][2]);
}
mat3 transpose(mat3 m) {
return mat3(m[0][0], m[1][0], m[2][0],
m[0][1], m[1][1], m[2][1],
m[0][2], m[1][2], m[2][2]);
}

mat4 transpose(mat4 m) {
return mat4(m[0][0], m[1][0], m[2][0], m[3][0],
m[0][1], m[1][1], m[2][1], m[3][1],
m[0][2], m[1][2], m[2][2], m[3][2],
m[0][3], m[1][3], m[2][3], m[3][3]);
}
mat4 transpose(mat4 m) {
return mat4(m[0][0], m[1][0], m[2][0], m[3][0],
m[0][1], m[1][1], m[2][1], m[3][1],
m[0][2], m[1][2], m[2][2], m[3][2],
m[0][3], m[1][3], m[2][3], m[3][3]);
}
#endif

0 comments on commit 012a4f7

Please sign in to comment.