Stage 1: headless Image and AudioData; GPU and playback caches in the UI

- resource::Image (pixels, size, uid) replaces Texture in documents, undo and
  wizards; it lives in anm2ed_core with no GL. uid changes with the pixels.
- resource::texture::id_get uploads lazily and evicts textures not drawn in a frame
- resource::AudioData (bytes, uid) replaces Audio; resource::audio::play/stop/
  track_detach/is_playing cache decoded audio and tracks per uid
- Resources::icon_id_get shortens the icon call sites
- tests/assets.cpp covers Image png round trip, uid tracking, merge_append

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shweetandClaude Opus 5.5 committed 2026-10-03 14:52:34 -04:00
1 parent 5311c2835f
commit 26ab394fe4
37 files changed
+538 -614

No files matched your search

+4 -4
View File
@@ -153,7 +153,7 @@ namespace anm2ed::imgui::wizard
if (auto spritesheets = state.anm2.element_get(ElementType::SPRITESHEETS))
for (auto& spritesheet : spritesheets->children)
if (spritesheet.type == ElementType::SPRITESHEET)
state.textures[spritesheet.id] = Texture(info.png, info.pngSize);
state.textures[spritesheet.id] = resource::Image(info.png, info.pngSize);
auto animation = friend_animation_get(state);
if (!animation)
@@ -216,8 +216,8 @@ namespace anm2ed::imgui::wizard
auto tint = frame.tint * rootFrame.tint;
auto colorOffset = frame.colorOffset + rootFrame.colorOffset;
state.canvas->texture_render(resources.shaders[shader::TEXTURE], texture.id, transform, tint, colorOffset,
uvVertices.data());
state.canvas->texture_render(resources.shaders[shader::TEXTURE], resource::texture::id_get(texture), transform,
tint, colorOffset, uvVertices.data());
}
void friend_canvas_draw(About::FriendState& state, Resources& resources, ImVec2 displaySize)
@@ -332,7 +332,7 @@ namespace anm2ed::imgui::wizard
void About::reset(Resources& resources)
{
resources.music_track().play(true);
resource::audio::play(resources.music_track(), true);
creditsState = {};
creditsState.spawnTimer = CREDIT_DELAY;