1
animate()
ループ外の値を更新しても問題がなければnot clearです。ThreeJS外部ループ更新
ループ外の更新がレンダリングのパフォーマンスに影響しますか?
私が見ることができる唯一の欠点は、次回のアニメーションコールが完全に表示されるのを待たなければならない場合があることです。
私には欠点がありますか?
function animate() {
requestAnimationFrame(animate)
updatePositions()
}
対
function animate() {
requestAnimationFrame(animate)
}
function onWebSocketUpdate() {
updatePositions()
}
それを見て別の方法:
onWebSocketUpdate(data) {
// Option 1
// ws directly applies the update
model.update(data)
// Option 2
// ws saves data to buffer
buffer.push(data)
// when animate() runs, it pops buffer data
model.update(buffer.pop())
}