Reputation: 125
In the book I found during reading next text:
"If the TexturePacker cannot fit all the subimages into a single texture, it will automatically split them up into several texture atlases. However, there is a chance that the subimages are distributed in an unfavorable way between these atlases if it creates two textures that will be switched between frequently, which in turn could have an impact on render performance. LibGDX's TexturePacker has a very smart feature to tackle this type of problem. All you need to do is group the subimages in their own subfolder in assets-raw. This way TexturePacker will create one image file per subfolder that belongs to the texture atlas. You have to use the full path to the subimage if you want to use this functionality; for example, a subimage assets-raw/items/gold_coin.png would be referenced as items/gold_coin."
Explain me please what does it mean "You have to use the full path to the subimage if you want to use this functionality". If I want to make Texture Atlas I use TexturePacker.process(settings, "assets-raw/images", "../android/assets/images", "anyname.pack");
, how i need to put path to the subimage directly and for what is it??
Upvotes: 1
Views: 178
Reputation: 1041
TexturePacker currently has 2 modi for this scenario.
One that is fully automated - it distributes sprites across as many sheets are required.
The other mode is called manual multipack: You create the sheets and simply drag & drop the folders or single sprites onto these sheets as needed.
We've decided not to create the folder based mode since you would usually get the best solution - and the file system layout will depend on the sprite usage. Our "manual" mode is way more flexible here.
Upvotes: 0
Reputation: 1148
It means that you have to use the folder name in the path when referencing the TextureRegion
from the TextureAtlas
.
So if you have an image called image_a.png
in your images
folder you would load that from the TextureAtlas
normally like this:
myTextureAtlas.findRegion("image_a")
Also if you have an image called image_b.png
in a subfolder called sub
then you need to specify that when loading from the TextureAtlas
:
myTextureAtlas.findRegion("sub/image_b")
Upvotes: 0