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:
1 parent
356d74ebb6
commit
2dbbfa5e86
13 files changed
+643
-27
No files matched your search
@@ -251,20 +251,13 @@ namespace anm2ed::imgui::wizard
|
||||
vec2 pan{};
|
||||
state.canvas->set_to_rect(zoom, pan, rect);
|
||||
|
||||
auto transform = state.canvas->transform_get(zoom, pan);
|
||||
for (const auto& draw :
|
||||
model::animation_draws_get(state.model, *animation, {.time = state.time, .isRootTransform = true}))
|
||||
{
|
||||
auto& frame = draw.frame;
|
||||
auto layer = draw.type == model::DrawType::LAYER ? model::item_get(state.model.content.layers, draw.id) : nullptr;
|
||||
auto texture = layer ? state.textures.find(layer->spritesheetId) : state.textures.end();
|
||||
if (texture == state.textures.end() || !texture->second.is_valid() || frame.size == vec2()) continue;
|
||||
auto textureSize = vec2(texture->second.size);
|
||||
auto uvVertices = math::uv_vertices_get(frame.crop / textureSize, (frame.crop + frame.size) / textureSize);
|
||||
state.canvas->texture_render(resources.shaders[shader::TEXTURE], resource::texture::id_get(texture->second),
|
||||
transform * draw.parent * model::draw_quad_model_get(draw), frame.tint,
|
||||
frame.colorOffset, uvVertices.data());
|
||||
}
|
||||
state.canvas->layers_render(resources.shaders[shader::TEXTURE], state.model, *animation,
|
||||
{.time = state.time, .isRootTransform = true}, state.canvas->transform_get(zoom, pan),
|
||||
[&](int id)
|
||||
{
|
||||
auto texture = state.textures.find(id);
|
||||
return texture == state.textures.end() ? nullptr : &texture->second;
|
||||
});
|
||||
|
||||
state.canvas->unbind();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user