Skip to content

Commit d1ae058

Browse files
authored
Merge pull request #3 from eugenebokhan/fix-warnings
fix warnings
2 parents fdcfd7a + 3808a71 commit d1ae058

16 files changed

+463
-463
lines changed

Sources/Matrix3x3.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
public extension Matrix3x3f {
66
/// Returns the identity matrix
7-
public static let identity = Matrix3x3f(diagonal: vec3(1.0))
7+
static let identity = Matrix3x3f(diagonal: vec3(1.0))
88

99
/// Creates a new instance from the values provided in row-major order
10-
public init(
10+
init(
1111
_ m00: Float, _ m01: Float, _ m02: Float,
1212
_ m10: Float, _ m11: Float, _ m12: Float,
1313
_ m20: Float, _ m21: Float, _ m22: Float) {

Sources/Matrix4x4+Extensions.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//
88

99
public extension Matrix4x4f {
10-
public func translated(by v: Vector3f) -> Matrix4x4f {
10+
func translated(by v: Vector3f) -> Matrix4x4f {
1111
let col3 = self * vec4(v)
1212

1313
return Matrix4x4f(
@@ -34,7 +34,7 @@ public extension Matrix4x4f {
3434
/// - returns:
3535
/// A new vector created by first multiplying the matrix by the
3636
/// vector and then performing perspective division on the result vector.
37-
public func multiplyAndProject(v: Vector3f) -> Vector3f {
37+
func multiplyAndProject(v: Vector3f) -> Vector3f {
3838
var r = self * Vector4f(v)
3939
r *= 1.0/r.w
4040
return Vector3f(r.x, r.y, r.z)

Sources/Matrix4x4+simd.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public struct Matrix4x4f {
8888
}
8989

9090
public extension matrix_float4x4 {
91-
public init(_ mat4x4f: Matrix4x4f) {
91+
init(_ mat4x4f: Matrix4x4f) {
9292
self = mat4x4f.d
9393
}
9494
}

Sources/Matrix4x4.swift

+19-19
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88

99
public extension Matrix4x4f {
1010
/// Returns the identity matrix
11-
public static let identity = Matrix4x4f(diagonal: vec4(1.0))
11+
static let identity = Matrix4x4f(diagonal: vec4(1.0))
1212

1313
/// Creates a new instance from the values provided in row-major order
14-
public init(
14+
init(
1515
_ m00: Float, _ m01: Float, _ m02: Float, _ m03: Float,
1616
_ m10: Float, _ m11: Float, _ m12: Float, _ m13: Float,
1717
_ m20: Float, _ m21: Float, _ m22: Float, _ m23: Float,
@@ -26,11 +26,11 @@ public extension Matrix4x4f {
2626

2727
//MARK: matrix operations
2828

29-
public static func lookAt(eye: Vector3f, at: Vector3f, up: Vector3f = Vector3f(0.0, 1.0, 0.0)) -> Matrix4x4f {
29+
static func lookAt(eye: Vector3f, at: Vector3f, up: Vector3f = Vector3f(0.0, 1.0, 0.0)) -> Matrix4x4f {
3030
return lookAtLH(eye: eye, at: at, up: up)
3131
}
3232

33-
public static func lookAtLH(eye: Vector3f, at: Vector3f, up: Vector3f) -> Matrix4x4f {
33+
static func lookAtLH(eye: Vector3f, at: Vector3f, up: Vector3f) -> Matrix4x4f {
3434
let view = (at - eye).normalized
3535
return lookAt(eye: eye, view: view, up: up)
3636
}
@@ -48,14 +48,14 @@ public extension Matrix4x4f {
4848
}
4949

5050
/// Creates a left-handed perspective projection matrix
51-
public static func proj(fovy: Angle, aspect: Float, near: Float, far: Float) -> Matrix4x4f {
51+
static func proj(fovy: Angle, aspect: Float, near: Float, far: Float) -> Matrix4x4f {
5252
let height = 1.0 / tan(fovy * 0.5)
5353
let width = height * 1.0/aspect;
5454
return projLH(x: 0, y: 0, w: width, h: height, near: near, far: far)
5555
}
5656

5757
/// Creates a left-handed perspective projection matrix
58-
public static func projLH(x: Float, y: Float, w: Float, h: Float, near: Float, far: Float) -> Matrix4x4f {
58+
static func projLH(x: Float, y: Float, w: Float, h: Float, near: Float, far: Float) -> Matrix4x4f {
5959
let diff = far - near
6060
let aa = far / diff
6161
let bb = near * aa
@@ -73,7 +73,7 @@ public extension Matrix4x4f {
7373
}
7474

7575
/// Creates a right-handed perspective projection matrix
76-
public static func projRH(x: Float, y: Float, w: Float, h: Float, near: Float, far: Float) -> Matrix4x4f {
76+
static func projRH(x: Float, y: Float, w: Float, h: Float, near: Float, far: Float) -> Matrix4x4f {
7777
let diff = far - near
7878
let aa = far / diff
7979
let bb = near * aa
@@ -91,12 +91,12 @@ public extension Matrix4x4f {
9191
}
9292

9393
/// Creates a left-handed orthographic projection matrix
94-
public static func ortho(left: Float, right: Float, bottom: Float, top: Float, near: Float, far: Float) -> Matrix4x4f {
94+
static func ortho(left: Float, right: Float, bottom: Float, top: Float, near: Float, far: Float) -> Matrix4x4f {
9595
return orthoLH(left: left, right: right, bottom: bottom, top: top, near: near, far: far)
9696
}
9797

9898
/// Creates a left-handed orthographic projection matrix
99-
public static func orthoLH(left: Float, right: Float, bottom: Float, top: Float, near: Float, far: Float, offset: Float = 0.0) -> Matrix4x4f {
99+
static func orthoLH(left: Float, right: Float, bottom: Float, top: Float, near: Float, far: Float, offset: Float = 0.0) -> Matrix4x4f {
100100
let aa = 2.0 / (right - left)
101101
let bb = 2.0 / (top - bottom)
102102
let cc = 1.0 / (far - near)
@@ -117,7 +117,7 @@ public extension Matrix4x4f {
117117
}
118118

119119
/// Creates a right-handed orthographic projection matrix
120-
public static func orthoRH(left: Float, right: Float, bottom: Float, top: Float, near: Float, far: Float, offset: Float = 0.0) -> Matrix4x4f {
120+
static func orthoRH(left: Float, right: Float, bottom: Float, top: Float, near: Float, far: Float, offset: Float = 0.0) -> Matrix4x4f {
121121
let aa = 2.0 / (right - left)
122122
let bb = 2.0 / (top - bottom)
123123
let cc = 1.0 / (far - near)
@@ -139,11 +139,11 @@ public extension Matrix4x4f {
139139

140140
//MARK: matrix operations
141141

142-
public static func scale(sx: Float, sy: Float, sz: Float) -> Matrix4x4f {
142+
static func scale(sx: Float, sy: Float, sz: Float) -> Matrix4x4f {
143143
return Matrix4x4f(diagonal: vec4(sx, sy, sz, 1.0))
144144
}
145145

146-
public static func translate(tx: Float, ty: Float, tz: Float) -> Matrix4x4f {
146+
static func translate(tx: Float, ty: Float, tz: Float) -> Matrix4x4f {
147147
return Matrix4x4f(
148148
vec4(1.0, 0.0, 0.0, 0.0),
149149
vec4(0.0, 1.0, 0.0, 0.0),
@@ -158,7 +158,7 @@ public extension Matrix4x4f {
158158
/// - parameter x: angle
159159
///
160160
/// - returns: a new rotation matrix
161-
public static func rotate(x: Angle) -> Matrix4x4f {
161+
static func rotate(x: Angle) -> Matrix4x4f {
162162
let (sin: sx, cos: cx) = sincos(x)
163163

164164
var r = Matrix4x4f()
@@ -173,7 +173,7 @@ public extension Matrix4x4f {
173173
}
174174

175175
/// Returns a transformation matrix that rotates around the y axis
176-
public static func rotate(y: Angle) -> Matrix4x4f {
176+
static func rotate(y: Angle) -> Matrix4x4f {
177177
let (sin: sy, cos: cy) = sincos(y)
178178

179179
var r = Matrix4x4f()
@@ -188,7 +188,7 @@ public extension Matrix4x4f {
188188
}
189189

190190
/// Returns a transformation matrix that rotates around the z axis
191-
public static func rotate(z: Angle) -> Matrix4x4f {
191+
static func rotate(z: Angle) -> Matrix4x4f {
192192
let (sin: sz, cos: cz) = sincos(z)
193193

194194
var r = Matrix4x4f()
@@ -203,7 +203,7 @@ public extension Matrix4x4f {
203203
}
204204

205205
/// Returns a transformation matrix that rotates around the x and then y axes
206-
public static func rotate(x: Angle, y: Angle) -> Matrix4x4f {
206+
static func rotate(x: Angle, y: Angle) -> Matrix4x4f {
207207
let (sin: sx, cos: cx) = sincos(x)
208208
let (sin: sy, cos: cy) = sincos(y)
209209

@@ -216,7 +216,7 @@ public extension Matrix4x4f {
216216
}
217217

218218
/// Returns a transformation matrix that rotates around the x, y and then z axes
219-
public static func rotate(x: Angle, y: Angle, z: Angle) -> Matrix4x4f {
219+
static func rotate(x: Angle, y: Angle, z: Angle) -> Matrix4x4f {
220220
let (sin: sx, cos: cx) = sincos(x)
221221
let (sin: sy, cos: cy) = sincos(y)
222222
let (sin: sz, cos: cz) = sincos(z)
@@ -237,7 +237,7 @@ public extension Matrix4x4f {
237237
}
238238

239239
/// Returns a transformation matrix that rotates around the z, y and then x axes
240-
public static func rotate(z: Angle, y: Angle, x: Angle) -> Matrix4x4f {
240+
static func rotate(z: Angle, y: Angle, x: Angle) -> Matrix4x4f {
241241
let (sin: sx, cos: cx) = sincos(x)
242242
let (sin: sy, cos: cy) = sincos(y)
243243
let (sin: sz, cos: cz) = sincos(z)
@@ -258,7 +258,7 @@ public extension Matrix4x4f {
258258
}
259259

260260
/// Returns a transformation matrix which can be used to scale, rotate and translate vectors
261-
public static func scaleRotateTranslate(sx _sx: Float, sy _sy: Float, sz _sz: Float,
261+
static func scaleRotateTranslate(sx _sx: Float, sy _sy: Float, sz _sz: Float,
262262
ax: Angle, ay: Angle, az: Angle,
263263
tx: Float, ty: Float, tz: Float) -> Matrix4x4f {
264264
let (sin: sx, cos: cx) = sincos(ax)

Sources/Point.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public typealias Point = Vector2f
1010
public typealias p2d = Point
1111

1212
public extension Rect {
13-
public nonmutating func contains(point: Point) -> Bool {
13+
nonmutating func contains(point: Point) -> Bool {
1414
let x = point.x
1515
let y = point.y
1616
return x >= minX && x <= maxX && y >= minY && y <= maxY

Sources/Rect.swift

+11-11
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
public typealias Size = Vector2f
1010

1111
public extension Size {
12-
public var width: Float {
12+
var width: Float {
1313
get {
1414
return x
1515
}
@@ -18,7 +18,7 @@ public extension Size {
1818
}
1919
}
2020

21-
public var height: Float {
21+
var height: Float {
2222
get {
2323
return y
2424
}
@@ -27,11 +27,11 @@ public extension Size {
2727
}
2828
}
2929

30-
public init(width: Float, height: Float) {
30+
init(width: Float, height: Float) {
3131
self.init(width, height)
3232
}
3333

34-
public init(width: Int, height: Int) {
34+
init(width: Int, height: Int) {
3535
self.init(Float(width), Float(height))
3636
}
3737
}
@@ -40,7 +40,7 @@ public extension Size {
4040
/**
4141
Check if a size has power of two dimensions.
4242
*/
43-
public var isPOT: Bool {
43+
var isPOT: Bool {
4444
let w = UInt(width)
4545
let h = UInt(height)
4646
return w == w.nextPOT && h == h.nextPOT
@@ -99,15 +99,15 @@ extension Rect: Equatable {
9999
}
100100

101101
public extension Rect {
102-
public func sizeScaled(by s: Float) -> Rect {
102+
func sizeScaled(by s: Float) -> Rect {
103103
return Rect(origin: origin, size: size * s)
104104
}
105105

106-
public func originScaled(by s: Float) -> Rect {
106+
func originScaled(by s: Float) -> Rect {
107107
return Rect(origin: origin * s, size: size)
108108
}
109109

110-
public func scaled(by s: Float) -> Rect {
110+
func scaled(by s: Float) -> Rect {
111111
return Rect(origin: origin * s, size: size * s)
112112
}
113113
}
@@ -119,7 +119,7 @@ public extension Rect {
119119
consists solely of scales, flips and translations, then the returned
120120
rectangle coincides with the rectangle constructed from the four
121121
transformed corners. */
122-
public nonmutating func applying(matrix: Matrix4x4f) -> Rect {
122+
nonmutating func applying(matrix: Matrix4x4f) -> Rect {
123123
let bl = matrix * bottomLeft
124124
let br = matrix * bottomRight
125125
let tl = matrix * topLeft
@@ -147,7 +147,7 @@ public extension Rect {
147147
* Returns an array of 2d points which repsent triangles,
148148
* ordered in counter-clockwise manner
149149
*/
150-
public var triangles: [Vector2f] {
150+
var triangles: [Vector2f] {
151151
return [
152152
origin, topLeft, bottomRight,
153153
bottomRight, topLeft, topRight
@@ -158,7 +158,7 @@ public extension Rect {
158158
* Returns an array of 2d points which represent a triangle strip
159159
* First triangle is ordered in counter-clockwise manner
160160
*/
161-
public var triangleStrip: [Vector2f] {
161+
var triangleStrip: [Vector2f] {
162162
return [
163163
origin, topLeft, bottomRight, topRight
164164
]

Sources/String+Math.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import Foundation
1010
internal extension String {
11-
internal var floatArray: [Float] {
11+
var floatArray: [Float] {
1212
let ignoredCharacters = CharacterSet(charactersIn: "{} ,")
1313
let components = self.components(separatedBy: ignoredCharacters)
1414
return components.filter { $0.count > 0 }
@@ -18,7 +18,7 @@ internal extension String {
1818

1919
public extension Vector2f {
2020
// String should be {p.x, p.y}
21-
public init(_ string: String) {
21+
init(_ string: String) {
2222
let components = string.floatArray
2323

2424
if components.count == 2 {
@@ -31,7 +31,7 @@ public extension Vector2f {
3131

3232
public extension Rect {
3333
// String should be {o.x, o.y, s.w, s.h}
34-
public init(_ string: String) {
34+
init(_ string: String) {
3535
let components = string.floatArray
3636

3737
if components.count == 2 {

0 commit comments

Comments
 (0)