diff --git a/math.d b/math.d index 94aaf9b..d6ba348 100644 --- a/math.d +++ b/math.d @@ -41,7 +41,7 @@ struct Vector(T, int N) union { - T[N] v; + T[N] v = 0; struct { T x; @@ -389,7 +389,7 @@ align(16) struct Matrix(T, int D) union { - T[N] v; + T[N] v = 0; Row[D] rows; MatrixVec[D] vec; static if (D == 4) mat4 glm_mat; @@ -532,7 +532,7 @@ struct Quat { union { - f32[4] v; + f32[4] v = 0; Vec4 vec; struct { @@ -1120,9 +1120,16 @@ unittest } */ - { // Vectors + { // Initializers u32[4] arr = [1, 2, 3, 4]; Vec4 vec = Vec4(arr); assert(vec == Vec4(1.0, 2.0, 3.0, 4.0)); + + Mat2 mat = Mat2(1.0, 0.0, 0.0, 1.0); + Mat4 mat4; + + Quat quat = Quat(1.0, 1.0, 1.0, 1.0); + + Quat quat2; } }