Search Results for

    Show / Hide Table of Contents

    Struct RectPackAtlas

    Implementation of the rectangles packing atlas into 2D atlas with padding. Uses simple space division via Binary Tree but stored in a linear memory allocation.

    Implementation based on https://github.com/TeamHypersomnia/rectpack2D?tab=readme-ov-file#algorithm and https://blackpawn.com/texts/lightmaps/default.html.

    Inherited Members
    RectPackAtlas
    Assembly: FlaxEngine.dll
    File: Engine/Utilities/RectPack.h
    Syntax
    public struct RectPackAtlas<NodeType, NodesMemoryChunkSize>
    Type Parameters
    NodeType

    NodesMemoryChunkSize

    Fields

    BordersPadding

    Declaration
    public Size BordersPadding = 0
    Field Value
    Size

    Height

    Declaration
    public Size Height = 0
    Field Value
    Size

    Nodes

    Declaration
    public ChunkedArray<NodeType, NodesMemoryChunkSize> Nodes
    Field Value
    ChunkedArray<NodeType, NodesMemoryChunkSize>

    Width

    Declaration
    public Size Width = 0
    Field Value
    Size

    Methods

    Clear()

    Clears the atlas. This won't invoke OnFree for atlas tiles.

    Declaration
    public void Clear()

    Free(NodeType* node, Args&& ... args)

    Frees the node.

    Declaration
    public void Free(NodeType* node, Args&& ... args)
    Parameters
    NodeType node

    The node to remove from atlas.

    Args... args

    Type Parameters
    Args

    Init(Size atlasWidth, Size atlasHeight, Size bordersPadding = 0)

    Initializes the atlas of a given size. Clears any previously added nodes. This won't invoke OnFree for atlas tiles.

    Declaration
    public void Init(Size atlasWidth, Size atlasHeight, Size bordersPadding = 0)
    Parameters
    Size atlasWidth

    The atlas width (in pixels).

    Size atlasHeight

    The atlas height (in pixels).

    Size bordersPadding

    The nodes padding (in pixels). Distance from node contents to atlas borders or other nodes.

    Insert(Size width, Size height, Args&& ... args)

    Tries to insert a node into the atlas using rectangle pack algorithm.

    Declaration
    public NodeType* Insert(Size width, Size height, Args&& ... args)
    Parameters
    Size width

    The node width (in pixels).

    Size height

    The node height (in pixels).

    Args... args

    The additional arguments.

    Returns
    NodeType

    The node that contains inserted an item or null if failed to find a free space.

    Type Parameters
    Args

    IsInitialized()

    Declaration
    public bool IsInitialized()
    Returns
    bool

    Reset()

    Clears and resets atlas back to the initial state.

    Declaration
    public void Reset()
    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat