@@ -9,10 +9,10 @@ import simd
9
9
/// - remark:
10
10
/// Matrices are stored in column-major order
11
11
@frozen
12
- public struct Matrix4x4f {
12
+ public struct Matrix4x4f : Codable , Equatable {
13
13
internal var d : matrix_float4x4
14
14
15
- //MARK: - initializers
15
+ // MARK: - initializers
16
16
17
17
/// Creates an instance initialized with either existing simd matrix or zeros
18
18
public init ( simdMatrix: matrix_float4x4 = . init( ) ) {
@@ -39,7 +39,7 @@ public struct Matrix4x4f {
39
39
self . d = matrix_float4x4 ( columns: ( c0. d, c1. d, c2. d, c3. d) )
40
40
}
41
41
42
- //MARK:- properties
42
+ // MARK:- properties
43
43
44
44
public var transposed : Matrix4x4f {
45
45
return unsafeBitCast ( d. transpose, to: Matrix4x4f . self)
@@ -73,7 +73,7 @@ public struct Matrix4x4f {
73
73
}
74
74
}
75
75
76
- //MARK:- operators
76
+ // MARK:- operators
77
77
78
78
public static prefix func - ( lhs: Matrix4x4f ) -> Matrix4x4f {
79
79
return unsafeBitCast ( - lhs. d, to: Matrix4x4f . self)
@@ -86,6 +86,10 @@ public struct Matrix4x4f {
86
86
public static func * ( lhs: Matrix4x4f , rhs: Matrix4x4f ) -> Matrix4x4f {
87
87
return unsafeBitCast ( lhs. d * rhs. d, to: Matrix4x4f . self)
88
88
}
89
+
90
+ public static func == ( lhs: Matrix4x4f , rhs: Matrix4x4f ) -> Bool {
91
+ lhs. d == rhs. d
92
+ }
89
93
}
90
94
91
95
public extension matrix_float4x4 {
0 commit comments