anm2ed-cli and render tests: look at animations without the editor

- anm2ed-cli info|frame|render: a text summary, one frame as a PNG, or the
  whole animation as a contact sheet, PNG sequence, GIF or video, drawn by
  the editor's OpenGL renderer in a hidden window (render::HeadlessGL).
- render::animation_frame_render / animation_record draw an animation's
  layers over its bounds (Canvas::layers_render, also used by About) and
  record them through the existing Recorder.
- The editor's code builds as anm2ed_app, shared by the editor, the CLI and
  anm2ed_render_tests, which checks a fixture's pixels and golden PNGs
  (with tolerance; skipped without OpenGL) and leaves its renders in
  build/renders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shweetandClaude Opus 5.5 committed 2026-10-05 13:32:42 -04:00
1 parent 356d74ebb6
commit 2dbbfa5e86
13 files changed
+643 -27

No files matched your search

+23
View File
@@ -6,6 +6,7 @@
#include <glm/gtc/type_ptr.hpp>
#include "math.hpp"
#include "texture.hpp"
using namespace glm;
using namespace anm2ed::resource;
@@ -270,6 +271,28 @@ namespace anm2ed
rect_end(rectVAO, mode, count);
}
// An animation's layers alone (no markers or helpers); spritesheet images and custom shaders are looked up by id.
void Canvas::layers_render(Shader& shader, const model::Model& model, const model::Animation& animation,
const model::DrawOptions& options, const mat4& transform,
const std::function<const Image*(int)>& image_get,
const std::function<Shader*(int)>& shader_get) const
{
for (const auto& draw : model::animation_draws_get(model, animation, options))
{
if (draw.type != model::DrawType::LAYER) continue;
auto& frame = draw.frame;
auto layer = model::item_get(model.content.layers, draw.id);
auto image = layer ? image_get(layer->spritesheetId) : nullptr;
if (!image || !image->is_valid() || frame.size == vec2()) continue;
auto imageSize = vec2(image->size);
auto uvVertices = math::uv_vertices_get(frame.crop / imageSize, (frame.crop + frame.size) / imageSize);
auto customShader = shader_get ? shader_get(frame.shaderId) : nullptr;
texture_render(customShader ? *customShader : shader, texture::id_get(*image),
transform * draw.parent * model::draw_quad_model_get(draw), frame.tint, frame.colorOffset,
uvVertices.data(), imageSize, draw.time);
}
}
void Canvas::rect_render(Shader& shader, const mat4& transform, const mat4& model, vec4 color, float dashLength,
float dashGap, float dashOffset) const
{