Secrets of custom export. Part 2


Hi everyone! Hope your week was as good as mine. 

Today post is second one from the series about export. Who needs atlas custom export, I would recommend to read our previous post, in order to understand the whole process.

We have already discussed what these magic export and write functions are, what they do and where are implemented. The only unrevealed thing is arguments of export function. So, let's dive in.

Export function accepts 2 arguments:  atlasImages and atlas.

Atlas is an object that contains all general information. It is:

-atlas image name;
-scale;
-texture pixel format, default value is RGBA8888;

For now, this is all general data we give access to. Probably, it is not the last iteration and it will be expanded, but this minimum is enough for game engine to work with atlas.

AtlasImages - another function argument. It's a little bit more complicated than previous one. It is an array of objects that contains detailed information about every image.

-name - identifier by which lately you find'll a texture to create a sprite - "load.png" for e.g. Image name can be trimmed. It means file extension is cut and we have "load" instead of "load.png".

-isTrimmed - is a boolean value that shows whether image in atlas has preserved its original size or transparent pixels were cut.

-x, y - position of image in generated atlas.

-w,h - size of image in generated atlas.

-srcW, srcH - original size of the image we added to packer.

-cropX, cropY, cropW, cropH - position and size of trimmed image within the origin. If image was not trimmed cropX / cropY are 0 and cropW/cropH equal srcW/srcH.

This data also can be expended due to more features in GAP like pivot/anchor changing possibility or other packing algorithm than can rotate images for atlas size optimization or desirable hit area. But all this will be possible, if you need GAP. 

Hope this post and previous one show you that there is no special magic in custom export and it 's easy deal. If you have any suggestions and comments, do not hesitate to write below.

Thanks. 

Files

GAP_Windows64_v018.zip 1.4 MB
May 06, 2024

Get GAP : Generic Atlas Packer

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.