Next bugs, StarlingAtlasAttachmentLoader is very buggy, it doesn't work at all.
Ok, let's go:
public function newMeshAttachment (skin:Skin, name:String, path:String) : MeshAttachment {
[…]
attachment.regionV2 = (matrix.tx + subTexture.height) / root.height;
Should be:
attachment.regionV2 = (matrix.ty + subTexture.height) / root.height;
Analogous situation is in newSkinnedMeshAttachment function.
But it still isn't enough.
attachment.regionU = matrix.tx / root.width;
attachment.regionV = matrix.ty / root.height;
attachment.regionU2 = (matrix.tx + subTexture.width) / root.width;
attachment.regionV2 = (matrix.tx + subTexture.height) / root.height;
It doesn't work, u v u2 v2 are not proper calculated, I think it should be:
var rectRegion:Rectangle = atlas.getRegion(path);
attachment.regionU = rectRegion.x / root.width;
attachment.regionV = rectRegion.y / root.height;
attachment.regionU2 = (rectRegion.x + subTexture.width) / root.width;
attachment.regionV2 = (rectRegion.y + subTexture.height) / root.height;
The same for newSkinnedMeshAttachment function. It works for me.
And next I suggest to add below code in newRegionAttachment function:
var subTexture:SubTexture = texture as SubTexture;
if (subTexture)
{
var root:Texture = subTexture.root;
var rectRegion:Rectangle = atlas.getRegion(path);
attachment.regionU = rectRegion.x / root.width;
attachment.regionV = rectRegion.y / root.height;
attachment.regionU2 = (rectRegion.x + subTexture.width) / root.width;
attachment.regionV2 = (rectRegion.y + subTexture.height) / root.height;
attachment.setUVs(attachment.regionU, attachment.regionV, attachment.regionU2, attachment.regionV2, atlas.getRotation(path));
}
We will have more flexible Skeleton class, similar to AtlasAttachmentLoader version.