我有画线,并创建带有尺寸的框。在iPhone 8及更高版本上面临滞后问题,但在iPhone7上运行正常。
用于更新行:
fileprivate func updateLine(_ line: SCNNode, from position: SCNVector3, distance: Float, axis: SCNVector3.Axis) {
guard let box = line.geometry as? SCNBox else {
fatalError("Tried to update something that is not a line")
}
let absDistance = CGFloat(abs(distance))
let offset = distance * 0.5
switch axis {
case .x:
box.width = absDistance
line.position = position + SCNVector3(x: offset, y: 0, z: 0)
case .y:
box.height = absDistance
line.position = position + SCNVector3(x: 0, y: offset, z: 0)
case .z:
box.length = absDistance
line.position = position + SCNVector3(x: 0, y: 0, z: offset)
}
}
iPhone 7:
CPU:48%
内存:199MB
FPS:60
帧渲染时间:1.9毫秒
iPhone 8 Plus: CPU:48%
内存:236 MB
GPU:4.5
FPS:60
帧渲染时间:16.6 ms
项目中没有内存泄漏。
答案 0 :(得分:0)