-
Notifications
You must be signed in to change notification settings - Fork 1
/
VoxelMapAnchor.swift
42 lines (34 loc) · 945 Bytes
/
VoxelMapAnchor.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//
// VoxelMapAnchor.swift
// ARNavigationKit
//
// Created by Ferdinand Lösch on 08/02/2020.
//
import ARKit
/// - Tag: SnapshotAnchor
public class VoxelMapAnchor: ARAnchor {
public let map: Data
public init(map: Data) {
self.map = map
super.init(name: "VoxelMap", transform: float4x4())
}
public required init(anchor: ARAnchor) {
map = (anchor as! VoxelMapAnchor).map
super.init(anchor: anchor)
}
override public class var supportsSecureCoding: Bool {
return true
}
public required init?(coder aDecoder: NSCoder) {
if let snapshot = aDecoder.decodeObject(forKey: "VoxelMap") as? Data {
map = snapshot
} else {
return nil
}
super.init(coder: aDecoder)
}
public override func encode(with aCoder: NSCoder) {
super.encode(with: aCoder)
aCoder.encode(map, forKey: "VoxelMap")
}
}