|
Porytiles
|
Service that mangles duplicate key frame tiles to make them unique. More...
#include <anim_key_frame_mangler.hpp>
Public Member Functions | |
| AnimKeyFrameMangler (gsl::not_null< const UserDiagnostics * > diag, gsl::not_null< const TilePrinter * > tile_printer) | |
| virtual | ~AnimKeyFrameMangler ()=default |
| ChainableResult< MangleResult > | mangle_duplicates (const std::string &anim_name, std::vector< PixelTile< IndexPixel > > tiles, const std::vector< const Palette< Rgba32, pal::max_size > * > &palettes, const Rgba32 &extrinsic_transparency, const std::set< PixelTile< IndexPixel > > &existing_tiles) const |
| Mangles duplicate tiles to make them unique. | |
Service that mangles duplicate key frame tiles to make them unique.
During animation decompilation, multiple key frame tiles may be identical. This is problematic because recompilation cannot distinguish between identical tiles. This service modifies duplicate tiles by swapping individual pixels to visually similar colors that already exist in the tile, making each tile unique.
The mangling algorithm:
The service uses palette-aware RGB distance to find visually similar color alternatives, ensuring the mangled tile looks as close as possible to the original while still being technically unique.
Definition at line 92 of file anim_key_frame_mangler.hpp.
|
explicit |
Definition at line 296 of file anim_key_frame_mangler.cpp.
|
virtualdefault |
| ChainableResult< MangleResult > porytiles::AnimKeyFrameMangler::mangle_duplicates | ( | const std::string & | anim_name, |
| std::vector< PixelTile< IndexPixel > > | tiles, | ||
| const std::vector< const Palette< Rgba32, pal::max_size > * > & | palettes, | ||
| const Rgba32 & | extrinsic_transparency, | ||
| const std::set< PixelTile< IndexPixel > > & | existing_tiles | ||
| ) | const |
Mangles duplicate tiles to make them unique.
Processes the input tiles and ensures all duplicates are modified to be unique. The algorithm finds duplicates, selects pixels to modify based on visual impact priority (corners first, then edges, then interior), and swaps colors to visually similar alternatives already present in the tile.
| anim_name | Animation name (for diagnostic messages) |
| tiles | Key frame tiles to process (will be copied and potentially modified) |
| palettes | Per-tile palettes for color similarity calculations (one pointer per tile) |
| extrinsic_transparency | The extrinsic transparency color (for tile color conversion in diagnostics) |
| existing_tiles | Set of all existing tiles to check uniqueness against |
palettes size must equal tiles size. Definition at line 302 of file anim_key_frame_mangler.cpp.