Skip to content

Smarter padding in bin packer #7

Description

@Jjagg

When padding is enabled the bin packer puts the padding around every rectangle. This wastes bin space, because we end up with double padding between rectangles. In 1D, with 2 insertions of size 1 and padding 1 we get _#__#_ where _ is padding and # is the inserted object. Whereas we could have _#_#_ or even #_# if padding at the edges isn't required. This can save a bunch of pixels for a font atlas.

For the implementation we can store padded rectangles, but when looking for a spot to place a rectangle, don't apply padding.

  • Should make padding at edges optional (because it will be off by default with this technique).
  • Should ignore overlap/OOB when inserting padded rectangle (padding of inserted rectangles will overlap with filled space in the bin or might fall outside bin).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions