Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpriteSheet does not scale Texture coords correctly for non-multiples-of-2 #53

Closed
sorlok opened this issue Apr 18, 2019 · 1 comment
Closed

Comments

@sorlok
Copy link

sorlok commented Apr 18, 2019

Given the following metadata in spritesheet/something.json:

"meta": {
"image": "something.png",
"format": "RGBA8888",
"size": {"w":192,"h":192},
"scale": "1"
}

...the Texture coords for each frame are generated incorrectly as "width/size.w", "height/size.h".

This is because, somewhere in the conversion process, "something.png" is re-generated (into assets_unpacked) as a 256x256 texture file. This causes the Texture coords to be incorrect. They should be calculated as "width/256", "height/256".

Changing the meta to lie about the size of the input image fixes this:
"size": {"w":256,"h":256},

...however, it should be possible to take the expanded size into account when converting the SpriteSheet (i.e., round up to a multiple of 2). If I can figure out where this is done in the code I'll file a pull request.

(Note: I'm aware that I should be generating power-of-2 size images in the first place, but I still think the tool should do the right thing with images it's changing the size of.)

@sorlok
Copy link
Author

sorlok commented Apr 20, 2019

Hmm... it looks like what's happening here is more complicated: the spritesheet I'm using defaults to "trim: true", so empty space on the left is removed. This creates a situation where scaling to 256 "seems" to fix things. I'm closing this issue until I can track this down better.

@sorlok sorlok closed this as completed Apr 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant