Skip to content

Commit ee653dd

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 344bb5c + fb71c62 commit ee653dd

File tree

21 files changed

+1259
-915
lines changed

21 files changed

+1259
-915
lines changed

src/main/kotlin/glm_/vec1/Vec1ub.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import glm_.toByte
55
import glm_.ub
66
import glm_.vec2.Vec2bool
77
import glm_.vec2.Vec2t
8-
import glm_.vec2.operators.vec2ub_operators
8+
import glm_.vec2.operators.opVec2ub
99
import glm_.vec3.Vec3bool
1010
import glm_.vec3.Vec3t
1111
import glm_.vec4.Vec4bool
@@ -86,7 +86,7 @@ class Vec1ub(x: Ubyte) : Vec1t<Ubyte>(x) {
8686
}
8787

8888

89-
companion object : vec2ub_operators {
89+
companion object /*: opVec2ub*/ {
9090
@JvmField
9191
val length = 1
9292
@JvmField

src/main/kotlin/glm_/vec1/Vec1ui.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package glm_.vec1
33
import glm_.*
44
import glm_.vec2.Vec2bool
55
import glm_.vec2.Vec2t
6-
import glm_.vec2.operators.vec2ui_operators
6+
import glm_.vec2.operators.opVec2ui
77
import glm_.vec3.Vec3bool
88
import glm_.vec3.Vec3t
99
import glm_.vec4.Vec4bool
@@ -101,7 +101,7 @@ class Vec1ui(x: Uint) : Vec1t<Uint>(x) {
101101
}
102102

103103

104-
companion object : vec2ui_operators {
104+
companion object /*: opVec2ui */ {
105105
@JvmField
106106
val length = 1
107107
@JvmField

src/main/kotlin/glm_/vec2/Vec2.kt

Lines changed: 63 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package glm_.vec2
22

33
import glm_.*
4-
import glm_.vec2.operators.vec2_operators
4+
import glm_.vec2.operators.opVec2
55
import glm_.vec3.Vec3bool
66
import glm_.vec3.Vec3t
77
import glm_.vec4.Vec4bool
@@ -63,7 +63,7 @@ class Vec2(x: Float, y: Float) : Vec2t<Float>(x, y) {
6363
if (oneByteOneFloat) {
6464
x = bytes[index].f
6565
y = bytes[index + 1].f
66-
}else {
66+
} else {
6767
x = bytes.getFloat(index, bigEndian)
6868
y = bytes.getFloat(index + Float.BYTES, bigEndian)
6969
}
@@ -73,7 +73,7 @@ class Vec2(x: Float, y: Float) : Vec2t<Float>(x, y) {
7373
if (oneByteOneFloat) {
7474
x = bytes[index].f
7575
y = bytes[index + 1].f
76-
}else {
76+
} else {
7777
x = bytes.getFloat(index)
7878
y = bytes.getFloat(index + Float.BYTES)
7979
}
@@ -113,7 +113,7 @@ class Vec2(x: Float, y: Float) : Vec2t<Float>(x, y) {
113113
}
114114

115115

116-
companion object : vec2_operators {
116+
companion object : opVec2() {
117117
@JvmField
118118
val length = 2
119119
@JvmField
@@ -136,7 +136,7 @@ class Vec2(x: Float, y: Float) : Vec2t<Float>(x, y) {
136136
}
137137

138138
infix fun to(bytes: ByteBuffer) = to(bytes, bytes.position())
139-
fun to(bytes: ByteBuffer, offset: Int):ByteBuffer {
139+
fun to(bytes: ByteBuffer, offset: Int): ByteBuffer {
140140
bytes.putFloat(offset, x)
141141
bytes.putFloat(offset + Float.BYTES, y)
142142
return bytes
@@ -152,13 +152,14 @@ class Vec2(x: Float, y: Float) : Vec2t<Float>(x, y) {
152152
// -- Increment main.and decrement operators --
153153

154154
operator fun inc() = plus(Vec2(), this, 1f, 1f)
155+
155156
infix fun inc(res: Vec2) = plus(res, this, 1f, 1f)
156-
fun inc_() = plus(this, this, 1f, 1f)
157+
fun incAssign() = plus(this, this, 1f, 1f)
157158

158159

159160
operator fun dec() = minus(Vec2(), this, 1f, 1f)
160161
infix fun dec(res: Vec2) = minus(res, this, 1f, 1f)
161-
fun dec_() = minus(this, this, 1f, 1f)
162+
fun decAssign() = minus(this, this, 1f, 1f)
162163

163164
// -- Specific binary arithmetic operators --
164165

@@ -171,9 +172,14 @@ class Vec2(x: Float, y: Float) : Vec2t<Float>(x, y) {
171172
fun plus(b: Float, res: Vec2) = plus(res, this, b, b)
172173
fun plus(b: Vec2, res: Vec2) = plus(res, this, b.x, b.y)
173174

174-
fun plus_(bX: Float, bY: Float) = plus(this, this, bX, bY)
175-
infix fun plus_(b: Float) = plus(this, this, b, b)
176-
infix fun plus_(b: Vec2) = plus(this, this, b.x, b.y)
175+
fun plusAssign(bX: Float, bY: Float) = plus(this, this, bX, bY)
176+
infix operator fun plusAssign(b: Float) {
177+
plus(this, this, b, b)
178+
}
179+
180+
infix operator fun plusAssign(b: Vec2) {
181+
plus(this, this, b.x, b.y)
182+
}
177183

178184

179185
infix operator fun minus(b: Float) = minus(Vec2(), this, b, b)
@@ -185,9 +191,14 @@ class Vec2(x: Float, y: Float) : Vec2t<Float>(x, y) {
185191
fun minus(b: Float, res: Vec2) = minus(res, this, b, b)
186192
fun minus(b: Vec2, res: Vec2) = minus(res, this, b.x, b.y)
187193

188-
fun minus_(bX: Float, bY: Float) = minus(this, this, bX, bY)
189-
infix fun minus_(b: Float) = minus(this, this, b, b)
190-
infix fun minus_(b: Vec2) = minus(this, this, b.x, b.y)
194+
fun minusAssign(bX: Float, bY: Float) = minus(this, this, bX, bY)
195+
infix operator fun minusAssign(b: Float) {
196+
minus(this, this, b, b)
197+
}
198+
199+
infix operator fun minusAssign(b: Vec2) {
200+
minus(this, this, b.x, b.y)
201+
}
191202

192203

193204
infix operator fun times(b: Float) = times(Vec2(), this, b, b)
@@ -199,9 +210,13 @@ class Vec2(x: Float, y: Float) : Vec2t<Float>(x, y) {
199210
fun times(b: Float, res: Vec2) = times(res, this, b, b)
200211
fun times(b: Vec2, res: Vec2) = times(res, this, b.x, b.y)
201212

202-
fun times_(bX: Float, bY: Float) = times(this, this, bX, bY)
203-
infix fun times_(b: Float) = times(this, this, b, b)
204-
infix fun times_(b: Vec2) = times(this, this, b.x, b.y)
213+
fun timesAssign(bX: Float, bY: Float) = times(this, this, bX, bY)
214+
infix operator fun timesAssign(b: Float) {
215+
times(this, this, b, b)
216+
}
217+
infix operator fun timesAssign(b: Vec2) {
218+
times(this, this, b.x, b.y)
219+
}
205220

206221

207222
infix operator fun div(b: Float) = div(Vec2(), this, b, b)
@@ -213,9 +228,14 @@ class Vec2(x: Float, y: Float) : Vec2t<Float>(x, y) {
213228
fun div(b: Float, res: Vec2) = div(res, this, b, b)
214229
fun div(b: Vec2, res: Vec2) = div(res, this, b.x, b.y)
215230

216-
fun div_(bX: Float, bY: Float) = div(this, this, bX, bY)
217-
infix fun div_(b: Float) = div(this, this, b, b)
218-
infix fun div_(b: Vec2) = div(this, this, b.x, b.y)
231+
fun divAssign(bX: Float, bY: Float) = div(this, this, bX, bY)
232+
infix operator fun divAssign(b: Float) {
233+
div(this, this, b, b)
234+
}
235+
236+
infix operator fun divAssign(b: Vec2) {
237+
div(this, this, b.x, b.y)
238+
}
219239

220240

221241
infix operator fun rem(b: Float) = rem(Vec2(), this, b, b)
@@ -227,9 +247,14 @@ class Vec2(x: Float, y: Float) : Vec2t<Float>(x, y) {
227247
fun rem(b: Float, res: Vec2) = rem(res, this, b, b)
228248
fun rem(b: Vec2, res: Vec2) = rem(res, this, b.x, b.y)
229249

230-
fun rem_(bX: Float, bY: Float) = rem(this, this, bX, bY)
231-
infix fun rem_(b: Float) = rem(this, this, b, b)
232-
infix fun rem_(b: Vec2) = rem(this, this, b.x, b.y)
250+
fun remAssign(bX: Float, bY: Float) = rem(this, this, bX, bY)
251+
infix operator fun remAssign(b: Float) {
252+
rem(this, this, b, b)
253+
}
254+
255+
infix operator fun remAssign(b: Vec2) {
256+
rem(this, this, b.x, b.y)
257+
}
233258

234259

235260
// -- Generic binary arithmetic operators --
@@ -243,9 +268,14 @@ class Vec2(x: Float, y: Float) : Vec2t<Float>(x, y) {
243268
fun plus(b: Number, res: Vec2) = plus(res, this, b.f, b.f)
244269
fun plus(b: Vec2t<out Number>, res: Vec2) = plus(res, this, b.x.f, b.y.f)
245270

246-
fun plus_(bX: Number, bY: Number) = plus(this, this, bX.f, bY.f)
247-
infix fun plus_(b: Number) = plus(this, this, b.f, b.f)
248-
infix fun plus_(b: Vec2t<out Number>) = plus(this, this, b.x.f, b.y.f)
271+
fun plusAssign(bX: Number, bY: Number) = plus(this, this, bX.f, bY.f)
272+
infix operator fun plusAssign(b: Number) {
273+
plus(this, this, b.f, b.f)
274+
}
275+
276+
infix operator fun plusAssign(b: Vec2t<out Number>) {
277+
plus(this, this, b.x.f, b.y.f)
278+
}
249279

250280

251281
infix operator fun minus(b: Number) = minus(Vec2(), this, b.f, b.f)
@@ -257,9 +287,14 @@ class Vec2(x: Float, y: Float) : Vec2t<Float>(x, y) {
257287
fun minus(b: Number, res: Vec2) = minus(res, this, b.f, b.f)
258288
fun minus(b: Vec2t<out Number>, res: Vec2) = minus(res, this, b.x.f, b.y.f)
259289

260-
fun minus_(bX: Number, bY: Number) = minus(this, this, bX.f, bY.f)
261-
infix fun minus_(b: Number) = minus(this, this, b.f, b.f)
262-
infix fun minus_(b: Vec2t<out Number>) = minus(this, this, b.x.f, b.y.f)
290+
fun minusAssign(bX: Number, bY: Number) = minus(this, this, bX.f, bY.f)
291+
infix operator fun minusAssign(b: Number) {
292+
minus(this, this, b.f, b.f)
293+
}
294+
295+
infix operator fun minusAssign(b: Vec2t<out Number>) {
296+
minus(this, this, b.x.f, b.y.f)
297+
}
263298

264299

265300
infix operator fun times(b: Number) = times(Vec2(), this, b.f, b.f)

0 commit comments

Comments
 (0)