diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c3a6ef55..3bc2f23ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -79,6 +79,7 @@ * Added example component `SkeletonRenderTexture` to render a `SkeletonRenderer` to a `RenderTexture`, mainly for proper transparency. Added an example scene named `RenderTexture FadeOut Transparency` that demonstrates usage for a fadeout transparency effect. * Added another fadeout example component named `SkeletonRenderTextureFadeout` which takes over transparency fadeout when enabled. You can use this component as-is, attach it in disabled state and enable it to start a fadeout effect. * Timeline clips now offer an additional `Alpha` parameter for setting a custom constant mix alpha value other than 1.0, just as `TrackEntry.Alpha`. Defaults to 1.0. + * `GetRemappedClone` copying from `Sprite` now provides additional `pmaCloneTextureFormat` and `pmaCloneMipmaps` parameters to explicitly specify the texture format of a newly created PMA texture. * **Breaking changes** diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Utility/AttachmentCloneExtensions.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Utility/AttachmentCloneExtensions.cs index 601af1faf..bb7fe0dc8 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Utility/AttachmentCloneExtensions.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Utility/AttachmentCloneExtensions.cs @@ -52,14 +52,23 @@ namespace Spine.Unity.AttachmentTools { /// If true and the original Attachment is a RegionAttachment, then /// the original region's scale value is used instead of the Sprite's pixels per unit property. Since uniform scale is used, /// x scale of the original attachment (width scale) is used, scale in y direction (height scale) is ignored. + /// If premultiplyAlpha is true>, the TextureFormat of the + /// newly created PMA attachment Texture. + /// If premultiplyAlpha is , whether the newly created + /// PMA attachment Texture has mipmaps enabled. /// When parameter premultiplyAlpha is set to true, a premultiply alpha clone of the /// original texture will be created. Additionally, this PMA Texture clone is cached for later re-use, /// which might steadily increase the Texture memory footprint when used excessively. /// See on how to clear these cached textures. public static Attachment GetRemappedClone (this Attachment o, Sprite sprite, Material sourceMaterial, bool premultiplyAlpha = true, bool cloneMeshAsLinked = true, bool useOriginalRegionSize = false, - bool pivotShiftsMeshUVCoords = true, bool useOriginalRegionScale = false) { - var atlasRegion = premultiplyAlpha ? sprite.ToAtlasRegionPMAClone(sourceMaterial) : sprite.ToAtlasRegion(new Material(sourceMaterial) { mainTexture = sprite.texture }); + bool pivotShiftsMeshUVCoords = true, bool useOriginalRegionScale = false, + TextureFormat pmaCloneTextureFormat = AtlasUtilities.SpineTextureFormat, + bool pmaCloneMipmaps = AtlasUtilities.UseMipMaps) { + + var atlasRegion = premultiplyAlpha ? + sprite.ToAtlasRegionPMAClone(sourceMaterial, pmaCloneTextureFormat, pmaCloneMipmaps) : + sprite.ToAtlasRegion(new Material(sourceMaterial) { mainTexture = sprite.texture }); if (!pivotShiftsMeshUVCoords && o is MeshAttachment) { // prevent non-central sprite pivot setting offsetX/Y and shifting uv coords out of mesh bounds atlasRegion.offsetX = 0;