Skip to content

Add sprite atlasing #12

@Hamcha

Description

@Hamcha

We need sprite atlasing for the UI and other things.

This includes:

texpacker

A tool (in Go) to take an arbitrary number of input images (format can be limited to Go's builtin formats, ie. PNG JPEG GIF) and output one (or more) textures (in PNG, preferably) with all the input textures packed. The output should also include a header file with data saying where each sprite is (texture path + UV offset + UV size).

What do you mean "one or more" output textures?

Two 128x128 textures are lighter than a single 256x256 texture, if we can't fit something just barely on a 128x128 texture it might be better to have multiple ones.
This is a long term goal with low priority, I rather spend time on having a working tool first and maybe some decent packing algorithm second (not expecting MaxRects, but would be nice)

Better way to initialize sprites

The constructor for a sprite component is

explicit Sprite(const Vector2D& size, const std::shared_ptr<Material>& material,
	            const Rect& bounds = Rect(0, 0, 1, 1))

This means that it takes the full texture (in material) and UV bounds. With texpacker, we should make a simpler version that takes one of the outputs from texture packer or something like that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementMissing or better functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions