mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
perf: batch springs
This commit is contained in:
parent
e115372e6b
commit
6ce4d25081
1 changed files with 25 additions and 22 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
local batch = require "./batch"
|
||||||
local graph = require "./graph"
|
local graph = require "./graph"
|
||||||
type Node<T> = graph.Node<T>
|
type Node<T> = graph.Node<T>
|
||||||
type SourceNode<T> = graph.SourceNode<T>
|
type SourceNode<T> = graph.SourceNode<T>
|
||||||
|
|
@ -263,6 +264,8 @@ local function step_springs(dt: number)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function update_spring_sources()
|
local function update_spring_sources()
|
||||||
|
graph.bump_update_id()
|
||||||
|
batch(function()
|
||||||
for data, output in springs do
|
for data, output in springs do
|
||||||
local x0_123, x1_123, v_123,
|
local x0_123, x1_123, v_123,
|
||||||
x0_456, x1_456, v_456 =
|
x0_456, x1_456, v_456 =
|
||||||
|
|
@ -285,9 +288,9 @@ local function update_spring_sources()
|
||||||
output.cache = vec6_to_type[typeof(data.source_value)](x0_123, x0_456)
|
output.cache = vec6_to_type[typeof(data.source_value)](x0_123, x0_456)
|
||||||
end
|
end
|
||||||
|
|
||||||
graph.bump_update_id()
|
|
||||||
update_descendants(output)
|
update_descendants(output)
|
||||||
end
|
end
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
return function()
|
return function()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue