docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method compress

    compress(int*, int, int4, bool4)

    Packs components with an enabled mask to the left.

    Declaration
    public static int compress(int* output, int index, int4 val, bool4 mask)
    Parameters
    Type Name Description
    int* output

    Pointer to packed output array where enabled components should be stored to.

    int index

    Index into output array where first enabled component should be stored to.

    int4 val

    The value to to compress.

    bool4 mask

    Mask indicating which components are enabled.

    Returns
    Type Description
    int

    Index to element after the last one stored.

    Remarks

    This function is also known as left packing. The effect of this function is to filter out components that are not enabled and leave an output buffer tightly packed with only the enabled components. A common use case is if you perform intersection tests on arrays of data in structure of arrays (SoA) form and need to produce an output array of the things that intersected.

    compress(uint*, int, uint4, bool4)

    Packs components with an enabled mask to the left.

    Declaration
    public static int compress(uint* output, int index, uint4 val, bool4 mask)
    Parameters
    Type Name Description
    uint* output

    Pointer to packed output array where enabled components should be stored to.

    int index

    Index into output array where first enabled component should be stored to.

    uint4 val

    The value to to compress.

    bool4 mask

    Mask indicating which components are enabled.

    Returns
    Type Description
    int

    Index to element after the last one stored.

    Remarks

    This function is also known as left packing. The effect of this function is to filter out components that are not enabled and leave an output buffer tightly packed with only the enabled components. A common use case is if you perform intersection tests on arrays of data in structure of arrays (SoA) form and need to produce an output array of the things that intersected.

    compress(float*, int, float4, bool4)

    Packs components with an enabled mask to the left.

    Declaration
    public static int compress(float* output, int index, float4 val, bool4 mask)
    Parameters
    Type Name Description
    float* output

    Pointer to packed output array where enabled components should be stored to.

    int index

    Index into output array where first enabled component should be stored to.

    float4 val

    The value to to compress.

    bool4 mask

    Mask indicating which components are enabled.

    Returns
    Type Description
    int

    Index to element after the last one stored.

    Remarks

    This function is also known as left packing. The effect of this function is to filter out components that are not enabled and leave an output buffer tightly packed with only the enabled components. A common use case is if you perform intersection tests on arrays of data in structure of arrays (SoA) form and need to produce an output array of the things that intersected.

    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)