作为一个哈克解决方案,我已经改变了立方体的形状稍微不立方米,而更像
使边缘消失(假设相机在里面)。纹理被裁剪了一点,但是这不太明显。
我用来定义3×8个顶点作为位置:
let _positions = [
SCNVector3(x:-halfSide, y:-halfSide, z: halfSide),
SCNVector3(x: halfSide, y:-halfSide, z: halfSide),
SCNVector3(x:-halfSide, y:-halfSide, z: -halfSide),
SCNVector3(x: halfSide, y:-halfSide, z: -halfSide),
SCNVector3(x:-halfSide, y: halfSide, z: halfSide),
SCNVector3(x: halfSide, y: halfSide, z: halfSide),
SCNVector3(x:-halfSide, y: halfSide, z: -halfSide),
SCNVector3(x: halfSide, y: halfSide, z: -halfSide),
]
let positions = _positions + _positions + _positions
,现在我通过替换最后一行:
let X = 0
let Y = 8
let Z = 16
func killEdgeStitching(positions: [SCNVector3], axis: Int) -> [SCNVector3] {
var res = [SCNVector3]()
let delta = Float(0.99)
for pos in positions {
var newPosition = SCNVector3(x: pos.x, y: pos.y, z: pos.z)
switch axis {
case X:
newPosition.x *= delta
case Y:
newPosition.y *= delta
default:
newPosition.z *= delta
}
res.append(newPosition)
}
return res
}
let positions = killEdgeStitching(positions: _positions, axis: X) +
killEdgeStitching(positions: _positions, axis: Y) +
killEdgeStitching(positions: _positions, axis: Z)
我会离开,在那里,但希望有人会有一个真正的答案!