Skip to content

Commit

Permalink
Fix uninitialized values bug in matrix initializer
Browse files Browse the repository at this point in the history
  • Loading branch information
DBauer15 committed Apr 22, 2024
1 parent 124fbd3 commit 3125c2f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/backstage/math.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,14 @@ struct stage_mat4 {

stage_mat4() = default;
template<typename S>
stage_mat4(S val) : m00(val), m11(val), m22(val), m33(val) {}
stage_mat4(S val) {
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
this[i][j] = 0;
}
}
m00 = m11 = m22 = m33 = val;
}
template<typename S>
stage_mat4(const stage_vec4<S>& c0, const stage_vec4<S>& c1, const stage_vec4<S>& c2, const stage_vec4<S>& c3) { c[0] = c0; c[1] = c1, c[2] = c2; c[3] = c3; }
template<typename S>
Expand Down

0 comments on commit 3125c2f

Please sign in to comment.