@@ -144,13 +144,11 @@ class Vec3(x: Float, y: Float, z: Float) : Vec3t<Float>(x, y, z) {
144
144
else -> throw ArrayIndexOutOfBoundsException ()
145
145
}
146
146
147
- companion object : vec3_operators {
147
+ companion object : vec3_operators() {
148
148
@JvmField
149
149
val length = 3
150
150
@JvmField
151
151
val size = length * Float .BYTES
152
-
153
-
154
152
}
155
153
156
154
@@ -181,9 +179,9 @@ class Vec3(x: Float, y: Float, z: Float) : Vec3t<Float>(x, y, z) {
181
179
fun plus (b : Float , res : Vec3 = Vec3 ()) = plus(res, this , b, b, b)
182
180
fun plus (b : Vec3 , res : Vec3 = Vec3 ()) = plus(res, this , b.x, b.y, b.z)
183
181
184
- fun plus_ (bX : Float , bY : Float , bZ : Float ) = plus(this , this , bX, bY, bZ)
185
- infix fun plus_ (b : Float ) = plus(this , this , b, b, b)
186
- infix fun plus_ (b : Vec3 ) = plus(this , this , b.x, b.y, b.z)
182
+ fun plusAssign (bX : Float , bY : Float , bZ : Float ) = plus(this , this , bX, bY, bZ)
183
+ infix fun plusAssign (b : Float ) = plus(this , this , b, b, b)
184
+ infix fun plusAssign (b : Vec3 ) = plus(this , this , b.x, b.y, b.z)
187
185
188
186
189
187
infix operator fun minus (b : Float ) = minus(Vec3 (), this , b, b, b)
@@ -195,9 +193,9 @@ class Vec3(x: Float, y: Float, z: Float) : Vec3t<Float>(x, y, z) {
195
193
fun minus (b : Float , res : Vec3 = Vec3 ()) = minus(res, this , b, b, b)
196
194
fun minus (b : Vec3 , res : Vec3 = Vec3 ()) = minus(res, this , b.x, b.y, b.z) // TODO overload others
197
195
198
- fun minus_ (bX : Float , bY : Float , bZ : Float ) = minus(this , this , bX, bY, bZ)
199
- infix fun minus_ (b : Float ) = minus(this , this , b, b, b)
200
- infix fun minus_ (b : Vec3 ) = minus(this , this , b.x, b.y, b.z)
196
+ fun minusAssign (bX : Float , bY : Float , bZ : Float ) = minus(this , this , bX, bY, bZ)
197
+ infix fun minusAssign (b : Float ) = minus(this , this , b, b, b)
198
+ infix fun minusAssign (b : Vec3 ) = minus(this , this , b.x, b.y, b.z)
201
199
202
200
203
201
infix operator fun times (b : Float ) = times(Vec3 (), this , b, b, b)
@@ -209,9 +207,9 @@ class Vec3(x: Float, y: Float, z: Float) : Vec3t<Float>(x, y, z) {
209
207
fun times (b : Float , res : Vec3 = Vec3 ()) = times(res, this , b, b, b)
210
208
fun times (b : Vec3 , res : Vec3 = Vec3 ()) = times(res, this , b.x, b.y, b.z)
211
209
212
- fun times_ (bX : Float , bY : Float , bZ : Float ) = times(this , this , bX, bY, bZ)
213
- infix fun times_ (b : Float ) = times(this , this , b, b, b)
214
- infix fun times_ (b : Vec3 ) = times(this , this , b.x, b.y, b.z)
210
+ fun timesAssign (bX : Float , bY : Float , bZ : Float ) = times(this , this , bX, bY, bZ)
211
+ infix fun timesAssign (b : Float ) = times(this , this , b, b, b)
212
+ infix fun timesAssign (b : Vec3 ) = times(this , this , b.x, b.y, b.z)
215
213
216
214
217
215
operator fun div (b : Float ) = div(Vec3 (), this , b, b, b)
@@ -223,9 +221,9 @@ class Vec3(x: Float, y: Float, z: Float) : Vec3t<Float>(x, y, z) {
223
221
fun div (b : Float , res : Vec3 = Vec3 ()) = div(res, this , b, b, b)
224
222
fun div (b : Vec3 , res : Vec3 = Vec3 ()) = div(res, this , b.x, b.y, b.z)
225
223
226
- fun div_ (bX : Float , bY : Float , bZ : Float ) = div(this , this , bX, bY, bZ)
227
- infix fun div_ (b : Float ) = div(this , this , b, b, b)
228
- infix fun div_ (b : Vec3 ) = div(this , this , b.x, b.y, b.z)
224
+ fun divAssign (bX : Float , bY : Float , bZ : Float ) = div(this , this , bX, bY, bZ)
225
+ infix fun divAssign (b : Float ) = div(this , this , b, b, b)
226
+ infix fun divAssign (b : Vec3 ) = div(this , this , b.x, b.y, b.z)
229
227
230
228
231
229
infix operator fun rem (b : Float ) = rem(Vec3 (), this , b, b, b)
@@ -237,9 +235,9 @@ class Vec3(x: Float, y: Float, z: Float) : Vec3t<Float>(x, y, z) {
237
235
fun rem (b : Float , res : Vec3 = Vec3 ()) = rem(res, this , b, b, b)
238
236
fun rem (b : Vec3 , res : Vec3 = Vec3 ()) = rem(res, this , b.x, b.y, b.z)
239
237
240
- fun rem_ (bX : Float , bY : Float , bZ : Float ) = rem(this , this , bX, bY, bZ)
241
- infix fun rem_ (b : Float ) = rem(this , this , b, b, b)
242
- infix fun rem_ (b : Vec3 ) = rem(this , this , b.x, b.y, b.z)
238
+ fun remAssign (bX : Float , bY : Float , bZ : Float ) = rem(this , this , bX, bY, bZ)
239
+ infix fun remAssign (b : Float ) = rem(this , this , b, b, b)
240
+ infix fun remAssign (b : Vec3 ) = rem(this , this , b.x, b.y, b.z)
243
241
244
242
245
243
// -- Generic binary arithmetic operators --
@@ -253,9 +251,9 @@ class Vec3(x: Float, y: Float, z: Float) : Vec3t<Float>(x, y, z) {
253
251
fun plus (b : Number , res : Vec3 ) = plus(res, this , b.f, b.f, b.f)
254
252
fun plus (b : Vec3t <out Number >, res : Vec3 = Vec3 ()) = plus(res, this , b.x.f, b.y.f, b.z.f)
255
253
256
- fun plus_ (bX : Number , bY : Number , bZ : Number ) = plus(this , this , bX.f, bY.f, bZ.f)
257
- infix fun plus_ (b : Number ) = plus(this , this , b.f, b.f, b.f)
258
- infix fun plus_ (b : Vec3t <out Number >) = plus(this , this , b.x.f, b.y.f, b.z.f)
254
+ fun plusAssign (bX : Number , bY : Number , bZ : Number ) = plus(this , this , bX.f, bY.f, bZ.f)
255
+ infix fun plusAssign (b : Number ) = plus(this , this , b.f, b.f, b.f)
256
+ infix fun plusAssign (b : Vec3t <out Number >) = plus(this , this , b.x.f, b.y.f, b.z.f)
259
257
260
258
261
259
infix operator fun minus (b : Number ) = minus(Vec3 (), this , b.f, b.f, b.f)
@@ -265,9 +263,9 @@ class Vec3(x: Float, y: Float, z: Float) : Vec3t<Float>(x, y, z) {
265
263
fun minus (b : Number , res : Vec3 = Vec3 ()) = minus(res, this , b.f, b.f, b.f)
266
264
fun minus (b : Vec3t <out Number >, res : Vec3 = Vec3 ()) = minus(res, this , b.x.f, b.y.f, b.z.f)
267
265
268
- fun minus_ (bX : Number , bY : Number , bZ : Number ) = minus(this , this , bX.f, bY.f, bZ.f)
269
- infix fun minus_ (b : Number ) = minus(this , this , b.f, b.f, b.f)
270
- infix fun minus_ (b : Vec3t <out Number >) = minus(this , this , b.x.f, b.y.f, b.z.f)
266
+ fun minusAssign (bX : Number , bY : Number , bZ : Number ) = minus(this , this , bX.f, bY.f, bZ.f)
267
+ infix fun minusAssign (b : Number ) = minus(this , this , b.f, b.f, b.f)
268
+ infix fun minusAssign (b : Vec3t <out Number >) = minus(this , this , b.x.f, b.y.f, b.z.f)
271
269
272
270
273
271
infix operator fun times (b : Number ) = times(Vec3 (), this , b.f, b.f, b.f)
@@ -277,9 +275,9 @@ class Vec3(x: Float, y: Float, z: Float) : Vec3t<Float>(x, y, z) {
277
275
fun times (b : Number , res : Vec3 = Vec3 ()) = times(res, this , b.f, b.f, b.f)
278
276
fun times (b : Vec3t <out Number >, res : Vec3 = Vec3 ()) = times(res, this , b.x.f, b.y.f, b.z.f)
279
277
280
- fun times_ (bX : Number , bY : Number , bZ : Number ) = times(this , this , bX.f, bY.f, bZ.f)
281
- infix fun times_ (b : Number ) = times(this , this , b.f, b.f, b.f)
282
- infix fun times_ (b : Vec3t <out Number >) = times(this , this , b.x.f, b.y.f, b.z.f)
278
+ fun timesAssign (bX : Number , bY : Number , bZ : Number ) = times(this , this , bX.f, bY.f, bZ.f)
279
+ infix fun timesAssign (b : Number ) = times(this , this , b.f, b.f, b.f)
280
+ infix fun timesAssign (b : Vec3t <out Number >) = times(this , this , b.x.f, b.y.f, b.z.f)
283
281
284
282
285
283
infix operator fun div (b : Number ) = div(Vec3 (), this , b.f, b.f, b.f)
@@ -289,9 +287,9 @@ class Vec3(x: Float, y: Float, z: Float) : Vec3t<Float>(x, y, z) {
289
287
fun div (b : Number , res : Vec3 = Vec3 ()) = div(res, this , b.f, b.f, b.f)
290
288
fun div (b : Vec3t <out Number >, res : Vec3 = Vec3 ()) = div(res, this , b.x.f, b.y.f, b.z.f)
291
289
292
- fun div_ (bX : Number , bY : Number , bZ : Number ) = div(this , this , bX.f, bY.f, bZ.f)
293
- infix fun div_ (b : Number ) = div(this , this , b.f, b.f, b.f)
294
- infix fun div_ (b : Vec3t <out Number >) = div(this , this , b.x.f, b.y.f, b.z.f)
290
+ fun divAssign (bX : Number , bY : Number , bZ : Number ) = div(this , this , bX.f, bY.f, bZ.f)
291
+ infix fun divAssign (b : Number ) = div(this , this , b.f, b.f, b.f)
292
+ infix fun divAssign (b : Vec3t <out Number >) = div(this , this , b.x.f, b.y.f, b.z.f)
295
293
296
294
297
295
infix operator fun rem (b : Number ) = rem(Vec3 (), this , b.f, b.f, b.f)
@@ -301,9 +299,9 @@ class Vec3(x: Float, y: Float, z: Float) : Vec3t<Float>(x, y, z) {
301
299
fun rem (b : Number , res : Vec3 = Vec3 ()) = rem(res, this , b.f, b.f, b.f)
302
300
fun rem (b : Vec3t <out Number >, res : Vec3 = Vec3 ()) = rem(res, this , b.x.f, b.y.f, b.z.f)
303
301
304
- fun rem_ (bX : Number , bY : Number , bZ : Number ) = rem(this , this , bX.f, bY.f, bZ.f)
305
- infix fun rem_ (b : Number ) = rem(this , this , b.f, b.f, b.f)
306
- infix fun rem_ (b : Vec3t <out Number >) = rem(this , this , b.x.f, b.y.f, b.z.f)
302
+ fun remAssign (bX : Number , bY : Number , bZ : Number ) = rem(this , this , bX.f, bY.f, bZ.f)
303
+ infix fun remAssign (b : Number ) = rem(this , this , b.f, b.f, b.f)
304
+ infix fun remAssign (b : Vec3t <out Number >) = rem(this , this , b.x.f, b.y.f, b.z.f)
307
305
308
306
309
307
// -- functions --
@@ -313,10 +311,10 @@ class Vec3(x: Float, y: Float, z: Float) : Vec3t<Float>(x, y, z) {
313
311
@JvmOverloads
314
312
fun normalize (res : Vec3 = Vec3 ()) = glm.normalize(this , res) // TODO others
315
313
316
- fun normalize_ () = glm.normalize(this , this )
314
+ fun normalizeAssign () = glm.normalize(this , this )
317
315
318
316
infix fun cross (b : Vec3 ) = glm.cross(this , b, Vec3 ())
319
- infix fun cross_ (b : Vec3 ) = glm.cross(this , b, this )
317
+ infix fun crossAssign (b : Vec3 ) = glm.cross(this , b, this )
320
318
321
319
infix fun dot (b : Vec3 ) = glm.dot(this , b) // TODO others
322
320
@@ -328,7 +326,7 @@ class Vec3(x: Float, y: Float, z: Float) : Vec3t<Float>(x, y, z) {
328
326
return res
329
327
}
330
328
331
- fun negate_ () = negate(this )
329
+ fun negateAssign () = negate(this )
332
330
333
331
334
332
override fun equals (other : Any? ) = other is Vec3 && this [0 ] == other[0 ] && this [1 ] == other[1 ] && this [2 ] == other[2 ]
0 commit comments