docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class PowerOfTwoTextureAtlas

    Texture atlas with rectangular power of two size.

    Inheritance
    object
    Texture2DAtlas
    PowerOfTwoTextureAtlas
    Inherited Members
    Texture2DAtlas.maxMipLevelPadding
    Texture2DAtlas.AtlasTexture
    Texture2DAtlas.Release()
    Texture2DAtlas.ResetAllocator()
    Texture2DAtlas.ClearTarget(CommandBuffer)
    Texture2DAtlas.BlitCubeTexture2D(CommandBuffer, Vector4, Texture, bool, int)
    Texture2DAtlas.AllocateTextureWithoutBlit(Texture, int, int, ref Vector4)
    Texture2DAtlas.AllocateTextureWithoutBlit(int, int, int, ref Vector4)
    Texture2DAtlas.GetTextureID(Texture)
    Texture2DAtlas.GetTextureID(Texture, Texture)
    Texture2DAtlas.IsCached(out Vector4, Texture, Texture)
    Texture2DAtlas.IsCached(out Vector4, Texture)
    Texture2DAtlas.IsCached(out Vector4, int)
    Texture2DAtlas.NeedsUpdate(Texture, bool)
    Texture2DAtlas.NeedsUpdate(Texture, Texture, bool)
    Texture2DAtlas.AddTexture(CommandBuffer, ref Vector4, Texture)
    Texture2DAtlas.UpdateTexture(CommandBuffer, Texture, Texture, ref Vector4, Vector4, bool, bool)
    Texture2DAtlas.UpdateTexture(CommandBuffer, Texture, ref Vector4, bool, bool)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.Rendering
    Assembly: Unity.RenderPipelines.Core.Runtime.dll
    Syntax
    public class PowerOfTwoTextureAtlas : Texture2DAtlas

    Constructors

    PowerOfTwoTextureAtlas(int, int, GraphicsFormat, FilterMode, string, bool)

    Create a new texture atlas, must have power of two size.

    Declaration
    public PowerOfTwoTextureAtlas(int size, int mipPadding, GraphicsFormat format, FilterMode filterMode = FilterMode.Point, string name = "", bool useMipMap = true)
    Parameters
    Type Name Description
    int size

    The size of the atlas in pixels. Must be power of two.

    int mipPadding

    Amount of mip padding in power of two.

    GraphicsFormat format

    Atlas texture format

    FilterMode filterMode

    Atlas texture filter mode.

    string name

    Name of the atlas

    bool useMipMap

    Use mip maps

    Properties

    mipPadding

    Used mipmap padding size in power of two.

    Declaration
    public int mipPadding { get; }
    Property Value
    Type Description
    int

    Methods

    AllocateTexture(CommandBuffer, ref Vector4, Texture, int, int, int)

    Allocate space from the atlas for a texture and copy texture contents into the atlas.

    Declaration
    public override bool AllocateTexture(CommandBuffer cmd, ref Vector4 scaleOffset, Texture texture, int width, int height, int overrideInstanceID = -1)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Target command buffer for graphics commands.

    Vector4 scaleOffset

    Allocated scale (.xy) and offset (.zw)

    Texture texture

    Source Texture

    int width

    Request width in pixels.

    int height

    Request height in pixels.

    int overrideInstanceID

    Override texture instance ID.

    Returns
    Type Description
    bool

    True on success, false otherwise.

    Overrides
    Texture2DAtlas.AllocateTexture(CommandBuffer, ref Vector4, Texture, int, int, int)

    BlitOctahedralTexture(CommandBuffer, Vector4, Texture, Vector4, bool, int)

    Blit octahedral texture into the atlas with padding.

    Declaration
    public override void BlitOctahedralTexture(CommandBuffer cmd, Vector4 scaleOffset, Texture texture, Vector4 sourceScaleOffset, bool blitMips = true, int overrideInstanceID = -1)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Target command buffer for graphics commands.

    Vector4 scaleOffset

    Destination scale (.xy) and offset (.zw)

    Texture texture

    Source Texture

    Vector4 sourceScaleOffset

    Source scale (.xy) and offset(.zw).

    bool blitMips

    Blit mip maps.

    int overrideInstanceID

    Override texture instance ID.

    Overrides
    Texture2DAtlas.BlitOctahedralTexture(CommandBuffer, Vector4, Texture, Vector4, bool, int)

    BlitOctahedralTextureMultiply(CommandBuffer, Vector4, Texture, Vector4, bool, int)

    Blit octahedral texture into the atlas with padding.

    Declaration
    public void BlitOctahedralTextureMultiply(CommandBuffer cmd, Vector4 scaleOffset, Texture texture, Vector4 sourceScaleOffset, bool blitMips = true, int overrideInstanceID = -1)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Target command buffer for graphics commands.

    Vector4 scaleOffset

    Destination scale (.xy) and offset (.zw)

    Texture texture

    Source Texture

    Vector4 sourceScaleOffset

    Source scale (.xy) and offset(.zw).

    bool blitMips

    Blit mip maps.

    int overrideInstanceID

    Override texture instance ID.

    BlitTexture(CommandBuffer, Vector4, Texture, Vector4, bool, int)

    Blit texture into the atlas with padding.

    Declaration
    public override void BlitTexture(CommandBuffer cmd, Vector4 scaleOffset, Texture texture, Vector4 sourceScaleOffset, bool blitMips = true, int overrideInstanceID = -1)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Target command buffer for graphics commands.

    Vector4 scaleOffset

    Destination scale (.xy) and offset (.zw)

    Texture texture

    Source Texture

    Vector4 sourceScaleOffset

    Source scale (.xy) and offset(.zw).

    bool blitMips

    Blit mip maps.

    int overrideInstanceID

    Override texture instance ID.

    Overrides
    Texture2DAtlas.BlitTexture(CommandBuffer, Vector4, Texture, Vector4, bool, int)

    BlitTextureMultiply(CommandBuffer, Vector4, Texture, Vector4, bool, int)

    Blit texture into the atlas with padding and blending.

    Declaration
    public void BlitTextureMultiply(CommandBuffer cmd, Vector4 scaleOffset, Texture texture, Vector4 sourceScaleOffset, bool blitMips = true, int overrideInstanceID = -1)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Target command buffer for graphics commands.

    Vector4 scaleOffset

    Destination scale (.xy) and offset (.zw)

    Texture texture

    Source Texture

    Vector4 sourceScaleOffset

    Source scale (.xy) and offset(.zw).

    bool blitMips

    Blit mip maps.

    int overrideInstanceID

    Override texture instance ID.

    GetApproxCacheSizeInByte(int, int, bool, GraphicsFormat)

    Get cache size in bytes.

    Declaration
    public static long GetApproxCacheSizeInByte(int nbElement, int resolution, bool hasMipmap, GraphicsFormat format)
    Parameters
    Type Name Description
    int nbElement

    The number of elements stored in the cache.

    int resolution

    Atlas resolution (square).

    bool hasMipmap

    Atlas uses mip maps.

    GraphicsFormat format

    Atlas format.

    Returns
    Type Description
    long

    The approximate size of the cache in bytes.

    GetMaxCacheSizeForWeightInByte(int, bool, GraphicsFormat)

    Compute the max size of a power of two atlas for a given size in byte (weight).

    Declaration
    public static int GetMaxCacheSizeForWeightInByte(int weight, bool hasMipmap, GraphicsFormat format)
    Parameters
    Type Name Description
    int weight

    Atlas size in bytes.

    bool hasMipmap

    Atlas uses mip maps.

    GraphicsFormat format

    Atlas format.

    Returns
    Type Description
    int

    The largest possible resolution for a square atlas, constrained by weight, as a power of two value.

    GetPayloadScaleOffset(Texture, in Vector4)

    Get location of the actual texture data without padding in the atlas.

    Declaration
    public Vector4 GetPayloadScaleOffset(Texture texture, in Vector4 scaleOffset)
    Parameters
    Type Name Description
    Texture texture

    The source texture cached in the atlas.

    Vector4 scaleOffset

    Cached atlas location (scale and offset) for the source texture.

    Returns
    Type Description
    Vector4

    Scale and offset for the source texture without padding.

    GetPayloadScaleOffset(in Vector2, in Vector2, in Vector4)

    Get location of the actual texture data without padding in the atlas.

    Declaration
    public static Vector4 GetPayloadScaleOffset(in Vector2 textureSize, in Vector2 paddingSize, in Vector4 scaleOffset)
    Parameters
    Type Name Description
    Vector2 textureSize

    Size of the source texture

    Vector2 paddingSize

    Padding size used for the source texture.

    Vector4 scaleOffset

    Cached atlas location (scale and offset) for the source texture.

    Returns
    Type Description
    Vector4

    Scale and offset for the source texture without padding.

    RelayoutEntries()

    sort all the requested allocation from biggest to smallest and re-insert them. This function does not moves the textures in the atlas, it only changes their coordinates

    Declaration
    public bool RelayoutEntries()
    Returns
    Type Description
    bool

    True if all textures have successfully been re-inserted in the atlas

    ReserveSpace(int, int, int)

    Reserves the space on the texture atlas

    Declaration
    public bool ReserveSpace(int id, int width, int height)
    Parameters
    Type Name Description
    int id

    The id

    int width

    The width

    int height

    The height

    Returns
    Type Description
    bool

    True if the space is reserved

    ReserveSpace(Texture)

    Reserves the space on the texture atlas

    Declaration
    public bool ReserveSpace(Texture texture)
    Parameters
    Type Name Description
    Texture texture

    The source texture

    Returns
    Type Description
    bool

    True if the space is reserved

    ReserveSpace(Texture, int, int)

    Reserves the space on the texture atlas

    Declaration
    public bool ReserveSpace(Texture texture, int width, int height)
    Parameters
    Type Name Description
    Texture texture

    The source texture

    int width

    The width

    int height

    The height

    Returns
    Type Description
    bool

    True if the space is reserved

    ReserveSpace(Texture, Texture, int, int)

    Reserves the space on the texture atlas

    Declaration
    public bool ReserveSpace(Texture textureA, Texture textureB, int width, int height)
    Parameters
    Type Name Description
    Texture textureA

    The source texture A

    Texture textureB

    The source texture B

    int width

    The width

    int height

    The height

    Returns
    Type Description
    bool

    True if the space is reserved

    ResetRequestedTexture()

    Clear tracked requested textures.

    Declaration
    public void ResetRequestedTexture()

    Extension Methods

    ReflectionUtils.GetField(object, string)
    ReflectionUtils.GetFields(object)
    ReflectionUtils.Invoke(object, string, params object[])
    ReflectionUtils.SetField(object, string, object)
    AnalyticsUtils.ToNestedColumnWithDefault<T>(T, T, bool)
    AnalyticsUtils.ToNestedColumn<T>(T, T)
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)