Stage 9b: animations draw from a model draw list

- model::animation_draws_get returns what an animation draws at a time (root,
  group roots, layers, nulls; onion-skin samples first), with root and group
  root transforms as each item's parent and their tint/offset folded into
  layer frames.
- The preview, the About friends and animation_rect all use it; the
  preview's render lambda shrinks to drawing the list.
- Tests for draw order and root folding.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shweetandClaude Opus 5.5 committed 2026-10-03 18:11:19 -04:00
1 parent 595658581f
commit 39ccfb723a
6 files changed
+306 -374

No files matched your search

+48
View File
@@ -0,0 +1,48 @@
#pragma once
#include <vector>
#include "model.hpp"
// What an animation draws at a time, as plain data: every canvas (preview, render, about) draws from this list.
namespace anm2ed::model
{
enum class DrawType
{
ROOT,
GROUP_ROOT,
LAYER,
NULL_
};
// An onion-skin sample: a time offset, or (when sampling by index) an offset in each track's frames.
struct DrawSample
{
float timeOffset{};
int indexOffset{};
};
struct DrawOptions
{
float time{};
bool isRootTransform{};
bool isIndexSampled{};
std::vector<DrawSample> samples{};
};
// An item's frame at a time; `parent` is the transform of its root and group root when root transforms are shown
// (whose tint and color offset are then folded into a layer's frame). `sample` indexes the samples, -1 for now.
struct Draw
{
DrawType type{};
int id{-1};
int groupType{NONE};
int sample{-1};
float time{};
Frame frame{};
glm::mat4 parent{1.0f};
};
glm::mat4 draw_quad_model_get(const Draw&);
std::vector<Draw> animation_draws_get(const Model&, const Animation&, const DrawOptions&);
}