Skip to content

Commit d2cb905

Browse files
committed
Added kdocs for Mat4 constructors
1 parent eacef2f commit d2cb905

File tree

2 files changed

+47
-2
lines changed

2 files changed

+47
-2
lines changed

glm-test/src/main/kotlin/_glm/test/Matchers.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import glm_.vec3.*
1818
import glm_.vec2.*
1919
import glm_.mat4x4.*
2020

21-
21+
// TODO use glm.epsilonEqual
2222

2323
infix fun Mat2.plusOrMinus(epsilon: Float): Matcher<Mat2> = object : Matcher<Mat2> {
2424
override fun test(value: Mat2): Result {

glm/src/main/kotlin/glm_/mat4x4/Mat4.kt

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,24 @@ class Mat4 private constructor(@Suppress("UNUSED_PARAMETER") dummy: Int, var arr
4141

4242
// -- Constructors --
4343

44+
/**
45+
* Creates a identity matrix
46+
*/
4447
constructor() : this(1)
4548

49+
/**
50+
* Creates a matrix with the diagonal set to [s]
51+
*/
4652
constructor(s: Number) : this(s, s, s, s)
4753

54+
/**
55+
* Creates a matrix with the diagonal set to [x], [y], [z] and 1.0
56+
*/
4857
constructor(x: Number, y: Number, z: Number) : this(x, y, z, 1f) // TODO others
58+
59+
/**
60+
* Creates a matrix with the diagonal set to [x], [y], [z] and [w]:
61+
*/
4962
constructor(x: Number, y: Number, z: Number, w: Number) : this(
5063
x, 0, 0, 0,
5164
0, y, 0, 0,
@@ -54,16 +67,48 @@ class Mat4 private constructor(@Suppress("UNUSED_PARAMETER") dummy: Int, var arr
5467

5568
// TODO others
5669

70+
/**
71+
* Creates a matrix with the diagonal set to [v].x, [v].y, 0 and 1:
72+
*/
5773
constructor(v: Vec2t<*>) : this(v.x, v.y, 0, 1)
74+
75+
/**
76+
* Creates a matrix with the diagonal set to [v].x, [v].y, z and 1
77+
*/
5878
constructor(v: Vec2t<*>, z: Number) : this(v.x, v.y, z, 1)
79+
80+
/**
81+
* Creates a matrix with the diagonal set to [v].x, [v].y, z and w
82+
*/
5983
constructor(v: Vec2t<*>, z: Number, w: Number) : this(v.x, v.y, z, w)
84+
85+
/**
86+
* Creates a matrix with the diagonal set to [v].x, [v].y, [v].z and 1
87+
*/
6088
constructor(v: Vec3t<*>) : this(v.x, v.y, v.z, 1)
89+
90+
/**
91+
* Creates a matrix with the diagonal set to [v].x, [v].y, [v].z and w
92+
*/
6193
constructor(v: Vec3t<*>, w: Number) : this(v.x, v.y, v.z, w)
94+
95+
/**
96+
* Creates a matrix with the diagonal set to [v].x, [v].y, [v].z and [v].w
97+
*/
98+
constructor(v: Vec4t<*>) : this(v.x, v.y, v.z, v.w)
99+
100+
/**
101+
* Creates a matrix with the
102+
* first column of [a] and [aW],
103+
* the second [b] and [bW],
104+
* the third [c] and [cW] and
105+
* the last [d] and [dW]
106+
*/
62107
constructor(a: Vec3t<*>, aW: Number, b: Vec3t<*>, bW: Number, c: Vec3t<*>, cW: Number, d: Vec3t<*>, dW: Number) : this(
63108
a.x, a.y, a.z, aW, b.x, b.y, b.z, bW, c.x, c.y, c.z, cW, d.x, d.y, d.z, dW)
64109

65-
constructor(v: Vec4t<*>) : this(v.x, v.y, v.z, v.w)
66110

111+
// TODO(wasabi): check, either the variable names a chosen badly or the order passed to the array is wrong
67112
constructor(x0: Number, y0: Number, z0: Number, w0: Number,
68113
x1: Number, y1: Number, z1: Number, w1: Number,
69114
x2: Number, y2: Number, z2: Number, w2: Number,

0 commit comments

Comments
 (0)