# HG changeset patch # User sam # Date 1730565632 -25200 # Node ID fe9a8922333c128f3e5b0a3011dac1aabc7c79d2 # Parent b95d19124e90beffcefaeb580ecaec597542d5ab fix: remove converter diff -r b95d19124e90 -r fe9a8922333c semicongine/contrib/algorithms/collision.nim --- a/semicongine/contrib/algorithms/collision.nim Sat Nov 02 16:49:09 2024 +0700 +++ b/semicongine/contrib/algorithms/collision.nim Sat Nov 02 23:40:32 2024 +0700 @@ -185,7 +185,7 @@ normal = normal * -1'f32 distance = distance * -1'f32 - normals.add normal.ToVec4(distance) + normals.add normal.toVec4(distance) if distance < minDistance: minTriangle = i div 3 @@ -237,7 +237,7 @@ var uniqueEdges: seq[(int, int)] var i = 0 while i < normals.len: - if sameDirection(normals[i], support): + if sameDirection(normals[i].toVec3(), support): var f = i * 3 addIfUniqueEdge(uniqueEdges, faces, f + 0, f + 1) @@ -302,7 +302,7 @@ ij = vertexJ - vertexI var normal = vec2(ij.y, -ij.x).normalized() - distance = normal.dot(vertexI) + distance = normal.dot(vertexI.toVec2()) if (distance < 0): distance *= -1'f32 @@ -314,8 +314,8 @@ minIndex = j let - support = supportPoint(a, b, minNormal.ToVec3) - sDistance = minNormal.dot(support) + support = supportPoint(a, b, minNormal.toVec3()) + sDistance = minNormal.dot(support.toVec2()) if (abs(sDistance - minDistance) > 0.001): minDistance = high(float32) diff -r b95d19124e90 -r fe9a8922333c semicongine/core/matrix.nim --- a/semicongine/core/matrix.nim Sat Nov 02 16:49:09 2024 +0700 +++ b/semicongine/core/matrix.nim Sat Nov 02 23:40:32 2024 +0700 @@ -417,10 +417,10 @@ a = a * b func `*`*(mat: Mat4, vec: Vec3f): Vec3f = - (mat * vec.ToVec4(1)).ToVec3 + (mat * vec.toVec4(1)).toVec3 func `*`*(mat: Mat3, vec: Vec2f): Vec2f = - (mat * vec.ToVec3(1)).ToVec2 + (mat * vec.toVec3(1)).toVec2 func transposed*[T](m: TMat2[T]): TMat2[T] = TMat2[T](data: [m[0, 0], m[1, 0], m[0, 1], m[1, 1]]) diff -r b95d19124e90 -r fe9a8922333c semicongine/core/vector.nim --- a/semicongine/core/vector.nim Sat Nov 02 16:49:09 2024 +0700 +++ b/semicongine/core/vector.nim Sat Nov 02 23:40:32 2024 +0700 @@ -21,20 +21,20 @@ Vec2i8* = TVec2[int8] Vec3i8* = TVec3[int8] -converter ToVec1*[T: SomeNumber](orig: TVec3[T] | TVec4[T]): TVec1[T] = +func toVec1*[T: SomeNumber](orig: TVec3[T] | TVec4[T]): TVec1[T] = TVec1[T]([orig[0]]) -converter ToVec2*[T: SomeNumber](orig: TVec3[T] | TVec4[T]): TVec2[T] = +func toVec2*[T: SomeNumber](orig: TVec3[T] | TVec4[T]): TVec2[T] = TVec2[T]([orig[0], orig[1]]) -converter ToVec3*[T: SomeNumber](orig: TVec4[T]): TVec3[T] = +func toVec3*[T: SomeNumber](orig: TVec4[T]): TVec3[T] = TVec3[T]([orig[0], orig[1], orig[2]]) -func ToVec4*[T: SomeNumber](orig: TVec3[T], value: T = default(T)): TVec4[T] = +func toVec4*[T: SomeNumber](orig: TVec3[T], value: T = default(T)): TVec4[T] = TVec4[T]([orig[0], orig[1], orig[2], value]) -func ToVec3*[T: SomeNumber](orig: TVec2[T], value: T = default(T)): TVec3[T] = +func toVec3*[T: SomeNumber](orig: TVec2[T], value: T = default(T)): TVec3[T] = TVec3[T]([orig[0], orig[1], value]) -func ToVec2*[T: SomeNumber](orig: TVec1[T], value: T = default(T)): TVec2[T] = +func toVec2*[T: SomeNumber](orig: TVec1[T], value: T = default(T)): TVec2[T] = TVec2[T]([orig[0], value]) # shortcuts Vec3f