Skip to content

Commit 58a9dce

Browse files
committed
matrixops with_translation
1 parent d2f265c commit 58a9dce

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

include/kit/math/matrixops.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ namespace Matrix {
7575
float* f = glm::value_ptr(m);
7676
f[12]=f[13]=f[14]=0.0f;
7777
}
78+
inline glm::mat4 with_translation(glm::mat4 m, glm::vec3 t) {
79+
float* f = glm::value_ptr(m);
80+
f[12] = t[0];
81+
f[13] = t[1];
82+
f[14] = t[2];
83+
return m;
84+
}
85+
7886
inline void scale(glm::mat4& m, float v) {
7987
m *= v;
8088
}

0 commit comments

Comments
 (0)