feat: add runtime particle timeline playback
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled

This commit is contained in:
OpenAI Codex
2026-09-03 21:23:29 +08:00
parent 73bf01ebc0
commit 49b2e8aebd
17 changed files with 491 additions and 140 deletions

View File

@@ -241,6 +241,25 @@ TEST(Source, RasterArrayGpuReuseConsumesNewRevision) {
EXPECT_FALSE(particle::fieldIdentityChanged(assignedAfterReuse, wantedNewT0));
}
TEST(Source, RasterArrayTimelineKeepsCoreOwnedWindowAndPlaybackControls) {
std::vector<style::RasterArrayTimelineRuntime::Entry> entries;
for (uint64_t index = 0; index < 5; ++index) {
entries.push_back({std::make_shared<particle::ParticleFieldSnapshot>(
particle::OfflineFixtureParticleAdapter::load("uniform-east", index + 1)),
index * 4000});
}
style::RasterArrayTimelineRuntime timeline{std::move(entries)};
EXPECT_EQ(timeline.frame().t0Index, 0u);
EXPECT_TRUE(timeline.play());
EXPECT_TRUE(timeline.pause());
EXPECT_TRUE(timeline.setSpeed(0.5f));
EXPECT_FALSE(timeline.setSpeed(3.0f));
EXPECT_TRUE(timeline.step(1));
EXPECT_EQ(timeline.frame().t0Index, 1u);
EXPECT_TRUE(timeline.seek(4));
EXPECT_EQ(timeline.frame().state, style::RasterArrayPlaybackState::Ended);
}
TEST(Source, RasterArrayRuntimeFieldWindowAdvancesWithoutReplacingTheSource) {
SourceTest test;
const auto eastMetadata = fixtureBytes("uniform-east", "metadata.json");