Mercurial > games > semicongine
changeset 1317:c5a23e910fea
add: floorMod for vec/vec operations
author | sam <sam@basx.dev> |
---|---|
date | Mon, 12 Aug 2024 21:33:08 +0700 |
parents | 544709f64ac4 |
children | 03400de84910 |
files | semicongine/core/vector.nim |
diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/semicongine/core/vector.nim Mon Aug 12 17:52:29 2024 +0700 +++ b/semicongine/core/vector.nim Mon Aug 12 21:33:08 2024 +0700 @@ -259,19 +259,23 @@ func `*`*(a, b: TVec3): auto = TVec3([a[0] * b[0], a[1] * b[1], a[2] * b[2]]) func `*`*(a, b: TVec4): auto = TVec4([a[0] * b[0], a[1] * b[1], a[2] * b[2], a[3] * b[3]]) func `div`*[T: SomeInteger](a, b: TVec1[T]): auto = TVec1([a[0] div b[0]]) -func `floorDiv`*[T: SomeInteger](a, b: TVec1[T]): auto = TVec1([floorDiv(a[0], b[0])]) +func floorDiv*[T: SomeInteger](a, b: TVec1[T]): auto = TVec1([floorDiv(a[0], b[0])]) +func floorMod*[T: SomeInteger](a, b: TVec1[T]): auto = TVec1([floorMod(a[0], b[0])]) func `/`*[T: SomeInteger](a, b: TVec1[T]): auto = TVec1([a[0] / b[0]]) func `/`*[T: SomeFloat](a, b: TVec1[T]): auto = TVec1([a[0] / b[0]]) func `div`*[T: SomeInteger](a, b: TVec2[T]): auto = TVec2([a[0] div b[0], a[1] div b[1]]) -func `floorDiv`*[T: SomeInteger](a, b: TVec2[T]): auto = TVec2([floorDiv(a[0], b[0]), floorDiv(a[1], b[1])]) +func floorDiv*[T: SomeInteger](a, b: TVec2[T]): auto = TVec2([floorDiv(a[0], b[0]), floorDiv(a[1], b[1])]) +func floorMod*[T: SomeInteger](a, b: TVec2[T]): auto = TVec2([floorMod(a[0], b[0]), floorMod(a[1], b[1])]) func `/`*[T: SomeInteger](a, b: TVec2[T]): auto = TVec2([a[0] / b[0], a[1] / b[1]]) func `/`*[T: SomeFloat](a, b: TVec2[T]): auto = TVec2([a[0] / b[0], a[1] / b[1]]) func `div`*[T: SomeInteger](a, b: TVec3[T]): auto = TVec3([a[0] div b[0], a[1] div b[1], a[2] div b[2]]) -func `floorDiv`*[T: SomeInteger](a, b: TVec3[T]): auto = TVec3([floorDiv(a[0], b[0]), floorDiv(a[1], b[1]), floorDiv(a[2], b[2])]) +func floorDiv*[T: SomeInteger](a, b: TVec3[T]): auto = TVec3([floorDiv(a[0], b[0]), floorDiv(a[1], b[1]), floorDiv(a[2], b[2])]) +func floorMod*[T: SomeInteger](a, b: TVec3[T]): auto = TVec3([floorMod(a[0], b[0]), floorMod(a[1], b[1]), floorMod(a[2], b[2])]) func `/`*[T: SomeInteger](a, b: TVec3[T]): auto = TVec3([a[0] / b[0], a[1] / b[1], a[2] / b[2]]) func `/`*[T: SomeFloat](a, b: TVec3[T]): auto = TVec3([a[0] / b[0], a[1] / b[1], a[2] / b[2]]) func `div`*[T: SomeInteger](a, b: TVec4[T]): auto = TVec4([a[0] div b[0], a[1] div b[1], a[2] div b[2], a[3] div b[3]]) -func `floorDiv`*[T: SomeInteger](a, b: TVec4[T]): auto = TVec4([floorDiv(a[0], b[0]), floorDiv(a[1], b[1]), floorDiv(a[2], b[2]), floorDiv(a[3], b[3])]) +func floorDiv*[T: SomeInteger](a, b: TVec4[T]): auto = TVec4([floorDiv(a[0], b[0]), floorDiv(a[1], b[1]), floorDiv(a[2], b[2]), floorDiv(a[3], b[3])]) +func floorMod*[T: SomeInteger](a, b: TVec4[T]): auto = TVec4([floorMod(a[0], b[0]), floorMod(a[1], b[1]), floorMod(a[2], b[2]), floorMod(a[3], b[3])]) func `/`*[T: SomeInteger](a, b: TVec4[T]): auto = TVec4([a[0] / b[0], a[1] / b[1], a[2] / b[2], a[3] / b[3]]) func `/`*[T: SomeFloat](a, b: TVec4[T]): auto = TVec4([a[0] / b[0], a[1] / b[1], a[2] / b[2], a[3] / b[3]])