Expand description
Atlas texture coordinate mapping file format support.
This module handles .atlas files which define texture coordinate mappings for UI sprites
and other 2D graphics elements in Total War games. Atlas files map logical sprite names
to rectangular regions within larger texture atlas images.
§File Format
Atlas files use a binary format with the following structure:
- Header with version and metadata
- List of atlas entries mapping sprites to texture coordinates
- Coordinates are stored as percentages of the atlas texture size (4096x4096)
§Coordinate System
Texture coordinates are stored as normalized values (0.0-1.0 range) and converted to
pixel coordinates by multiplying by IMAGE_SIZE (4096). Each entry defines:
- Top-left corner (x1, y1)
- Bottom-right corner (x2, y2)
- Sprite dimensions (width, height)
§Table Conversion
Atlas files can be converted to/from TableInMemory for easy editing as TSV files.
The table format has 8 columns matching the AtlasEntry fields.
§Usage
ⓘ
use rpfm_lib::files::atlas::Atlas;
use rpfm_lib::files::Decodeable;
// Decode an atlas file
let atlas = Atlas::decode(&mut data, &None)?;
// Access entries
for entry in atlas.entries() {
println!("Sprite: {} at ({}, {})", entry.string1(), entry.x_1(), entry.y_1());
}
// Convert to table for TSV export
let table = TableInMemory::from(atlas);Structs§
- Atlas
- Represents a texture atlas mapping file.
- Atlas
Entry - Represents a single sprite entry in an atlas file.
Constants§
- EXTENSION
- File extension for atlas files.