基本上,我想将一些更改应用到SCNNode (例如,更改morpher.weights或更改骨架转换)并在此之后呈现场景。
scnRenderer.scene = sceneView?.scene
scnRenderer.pointOfView = sceneView?.pointOfView
scnRenderer.sceneTime = 1
scnRenderer.render(atTime: 0, viewport: viewport, commandBuffer: commandBuffer, passDescriptor:
currentPassDescriptor)
commandBuffer.addCompletedHandler { (buffer) in
animateNextStep?()
}
commandBuffer.commit()我想为整个动画制作它。伪码看起来像:
func animateNextStep() { //will be called in render function after rendering
guard step < count else { return }
step += 1
node.applySomeChanges()
render()
}目前,80%的图像是好的,包含模型,正确的骨骼位置和正确的莫费尔权值,20%不是(看起来是用以前的值渲染)。在将更改应用到节点之后,我需要一些完成处理程序。
我可以用DispathQueue.main.asyncAfter包装渲染,但我认为应该有一些好的解决方案。
怎么做才对?
发布于 2019-11-27 14:23:52
这可能是交易的一个问题,但是如果没有更多的上下文就很难说了。
在applySomeChanges中,您可以尝试使用显式事务
[SCNTransaction begin];
[SCNTransaction setAnimationDuration:0];
// changes to SceneKit objects
[SCNTransaction commit];您还可以尝试在[SCNTransaction flush];方法的开头调用render。
https://stackoverflow.com/questions/59072033
复制相似问题