File tree 7 files changed +78
-6
lines changed
7 files changed +78
-6
lines changed Original file line number Diff line number Diff line change @@ -10,5 +10,5 @@ pluginManagement {
10
10
11
11
gradle.rootProject {
12
12
group = " kotlin.graphics"
13
- version = " 0.9.9.1-10 "
13
+ version = " 0.9.9.1-11 "
14
14
}
Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ val GLM_VERSION_MAJOR = 0
164
164
val GLM_VERSION_MINOR = 9
165
165
val GLM_VERSION_PATCH = 9
166
166
val GLM_VERSION_REVISION = 1
167
- val GLM_VERSION_BUILD = 10
167
+ val GLM_VERSION_BUILD = 11
168
168
val GLM_VERSION = GLM_VERSION_MAJOR * 1_000 + GLM_VERSION_MINOR * 100 + GLM_VERSION_PATCH * 10 + GLM_VERSION_REVISION
169
169
170
170
/*
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ package glm_.vec1
3
3
interface Vec1Vars <T : Number > {
4
4
var x: T
5
5
6
- fun component1 () = x
6
+ operator fun component1 () = x
7
7
8
8
9
9
// -- Component accesses --
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import glm_.vec1.Vec1Vars
5
5
interface Vec2Vars <T : Number > : Vec1Vars <T > {
6
6
var y: T
7
7
8
- fun component2 () = y
8
+ operator fun component2 () = y
9
9
10
10
11
11
// -- Component accesses --
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import glm_.vec2.Vec2Vars
5
5
interface Vec3Vars <T : Number > : Vec2Vars <T > {
6
6
var z: T
7
7
8
- fun component3 () = z
8
+ operator fun component3 () = z
9
9
10
10
11
11
// -- Component accesses --
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import glm_.vec3.Vec3Vars
5
5
interface Vec4Vars <T : Number > : Vec3Vars <T > {
6
6
var w: T
7
7
8
- fun component4 () = w
8
+ operator fun component4 () = w
9
9
10
10
11
11
// -- Component accesses --
Original file line number Diff line number Diff line change
1
+ package glm_
2
+
3
+ import glm_.vec1.Vec1
4
+ import glm_.vec1.Vec1i
5
+ import glm_.vec2.Vec2
6
+ import glm_.vec2.Vec2i
7
+ import glm_.vec3.Vec3
8
+ import glm_.vec3.Vec3i
9
+ import glm_.vec4.Vec4
10
+ import glm_.vec4.Vec4i
11
+ import io.kotest.core.spec.style.StringSpec
12
+ import io.kotest.matchers.shouldBe
13
+
14
+
15
+ class testVectorComponent : StringSpec () {
16
+
17
+ init {
18
+
19
+ " v1 component" {
20
+ val v = Vec1 { it.f }
21
+ val (x) = v
22
+ x shouldBe 0f
23
+ }
24
+ " v1i component" {
25
+ val v = Vec1i { it }
26
+ val (x) = v
27
+ x shouldBe 0
28
+ }
29
+ " v2 component" {
30
+ val v = Vec2 { it.f }
31
+ val (x, y) = v
32
+ x shouldBe 0f
33
+ y shouldBe 1f
34
+ }
35
+ " v2i component" {
36
+ val v = Vec2i { it }
37
+ val (x, y) = v
38
+ x shouldBe 0
39
+ y shouldBe 1
40
+ }
41
+ " v3 component" {
42
+ val v = Vec3 { it.f }
43
+ val (x, y, z) = v
44
+ x shouldBe 0f
45
+ y shouldBe 1f
46
+ z shouldBe 2f
47
+ }
48
+ " v3i component" {
49
+ val v = Vec3i { it }
50
+ val (x, y, z) = v
51
+ x shouldBe 0
52
+ y shouldBe 1
53
+ z shouldBe 2
54
+ }
55
+ " v4 component" {
56
+ val v = Vec4 { it.f }
57
+ val (x, y, z, w) = v
58
+ x shouldBe 0f
59
+ y shouldBe 1f
60
+ z shouldBe 2f
61
+ w shouldBe 3f
62
+ }
63
+ " v4i component" {
64
+ val v = Vec4i { it }
65
+ val (x, y, z, w) = v
66
+ x shouldBe 0
67
+ y shouldBe 1
68
+ z shouldBe 2
69
+ w shouldBe 3
70
+ }
71
+ }
72
+ }
You can’t perform that action at this time.
0 commit comments