Skip to content

bevy_image::TextureAtlasBuilder: Symmetric texture atlas padding #22776

@ickshonpe

Description

@ickshonpe

What problem does this solve or what need does it fill?

The TextureAtlasBuilder and DynamicTextureAtlasBuilder builders pack padded images asymmetrically, with padding only added to the bottom and right edges. As a result, images that are positioned at the top or left edges of the atlas are flush against the atlas boundary, with no padding on those sides.

This can result in inconsistent rendering behavior that depends on where the packer placed the image in the atlas.

What solution would you like?

An option to reserve intial padding on the top and left edges of a texture atlas. Currently with TextureAtlasBuilder with padding set to 2, the first image you add to a texture atlas will be placed with its top-left corner at position (0,0). Instead, with this option, it would be placed at position (2, 2).

I think symmetric padding should probably become the default behaviour, I'm not certain though. We could add this feature first, then decide on the most desirable default after.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-RenderingDrawing game state to the screenC-FeatureA new feature, making something new possibleD-StraightforwardSimple bug fixes and API improvements, docs, test and examplesS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!

    Type

    No type

    Projects

    Status

    Needs SME Triage

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions