-
Notifications
You must be signed in to change notification settings - Fork 12
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
Fitting test #29
Comments
Hi, thanks! I don't think the atlas allocator can do much better than what you would do manually, that is try to allocate all of the images, and if they don't fit, deallocate them. |
I basically have a list of AtlasAllocator, where each atlas corresponds to a layer. I have alongside a giant buffer that contains the texture data packed according to each layer:
Basically when trying to fit an image, I go through the atlas one by one for a fit, and eventually resize the data buffer if needed. It's quite hard to know in advance whether a list of images will fit. I guess my best solution would be to make some estimate based on the size of the input images, and pre-allocate some atlases. |
If I understand correctly the giant pixel buffer is what's taking a long time to reallocate. It shouldn't be an issue if you are performing all atlas allocations (or as many as you can) before before creating/filling the image buffer (which I assume you can do since you know about the image sizes enough in advance to want to do a dry run). |
Hey! Nice library, thanks a lot :)
Do you think it would make sense to add a dry-run of allocating a bunch of images to see if they fit?
I am basically making layers of atlas, and sometimes I need to allocate a new atlas and to resize my texture data. However, Rust vector resize is crazy slow, and I would like to know beforehand how much capacity I need to pre-allocate.
I am not sure it's possible, but the algorithm looks fast enough in some case to be worth it.
The text was updated successfully, but these errors were encountered: