add zero default to vec/quat/mat
This commit is contained in:
parent
e10033bb74
commit
a7d571bd5a
15
math.d
15
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;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user