interface ISemanticBuffer (Niantic.ARDK.AR.Awareness.Semantics.ISemanticBuffer)

Overview

interface ISemanticBuffer:
    Niantic.ARDK.AR.Awareness.IDataBuffer,
    IDisposable {
    // properties

    uint ChannelCount;
    string[] ChannelNames;

    // methods

    bool CreateOrUpdateTextureARGB32(
        ref Texture2D texture,
        int channelIndex,
        FilterMode filterMode = FilterMode.Point
    );

    bool CreateOrUpdateTextureARGB32(
        ref Texture2D texture,
        int[] channels,
        FilterMode filterMode = FilterMode.Point
    );

    bool CreateOrUpdateTextureRFloat(
        ref Texture2D texture,
        FilterMode filterMode = FilterMode.Point
    );

    bool DoesChannelExist(int channelIndex);
    bool DoesChannelExist(string channelName);
    bool DoesChannelExistAt(int x, int y, int channelIndex);
    bool DoesChannelExistAt(int x, int y, string channelName);
    bool DoesChannelExistAt(Vector2 uv, int channelIndex);
    bool DoesChannelExistAt(Vector2 uv, string channelName);
    int GetChannelIndex(string channelName);
    UInt32 GetChannelTextureMask(int channelIndex);
    UInt32 GetChannelTextureMask(int[] channelIndices);
    UInt32 GetChannelTextureMask(string channelName);
    UInt32 GetChannelTextureMask(string[] channelNames);
};

Inherited Members

public:
    // properties

    UInt32 Height;
    CameraIntrinsics Intrinsics;
    bool IsKeyframe;
    Matrix4x4 ViewMatrix;
    UInt32 Width;
    NativeArray<T> Data;

    // methods

    IAwarenessBuffer GetCopy();
    T Sample(Vector2 uv);
    T Sample(Vector2 uv, Matrix4x4 transform);

Detailed Documentation

Properties

uint ChannelCount

The number of channels contained in this buffer.

string[] ChannelNames

An array of semantic class names, in the order their channels appear in the data.

Methods

bool CreateOrUpdateTextureARGB32(
    ref Texture2D texture,
    int channelIndex,
    FilterMode filterMode = FilterMode.Point
)

Update (or create, if needed) a texture with data of one of this buffer’s channels.

Parameters:

texture

Reference to the texture to copy to. This method will create a texture if the reference is null.

channelIndex

Channel index of the semantic class to copy.

filterMode

Texture filtering mode.

Returns:

True if the buffer was successfully copied to the given texture.

bool CreateOrUpdateTextureARGB32(
    ref Texture2D texture,
    int[] channels,
    FilterMode filterMode = FilterMode.Point
)

Update (or create, if needed) a texture with data composited of multiple channels from this buffer.

Parameters:

texture

Reference to the texture to copy to. This method will create a texture if the reference is null.

channels

Semantic channel indices to copy to this texture.

filterMode

Texture filtering mode.

Returns:

True if the buffer was successfully copied to the given texture.

bool CreateOrUpdateTextureRFloat(
    ref Texture2D texture,
    FilterMode filterMode = FilterMode.Point
)

Update (or create, if needed) a texture with this data of the entire buffer.

Parameters:

croppedRect

Rectangle defining how to crop the buffer’s data before copying to the texture.

texture

Reference to the texture to copy to. This method will create a texture if the reference is null.

Returns:

True if the buffer was successfully copied to the given texture.

bool DoesChannelExist(int channelIndex)

Check if a certain channel exists anywhere in this buffer.

Parameters:

channelIndex

Channel index of the semantic class to look for.

Returns:

True if the channel exists.

bool DoesChannelExist(string channelName)

Check if a certain channel exists anywhere in this buffer.

Parameters:

channelName

Name of the semantic class to look for.

Returns:

True if the channel exists.

bool DoesChannelExistAt(int x, int y, int channelIndex)

Check if a pixel in this semantic buffer contains a certain channel.

Parameters:

x

Pixel position on the x-axis.

y

Pixel position on the y-axis.

channelIndex

Channel index of the semantic class to look for.

Returns:

True if the channel exists at the given coordinates.

bool DoesChannelExistAt(int x, int y, string channelName)

Check if a pixel in this semantic buffer contains a certain channel.

Parameters:

x

Pixel position on the x-axis.

y

Pixel position on the y-axis.

channelName

Name of the semantic class to look for.

Returns:

True if the channel exists at the given coordinates.

bool DoesChannelExistAt(Vector2 uv, int channelIndex)

Check if a pixel in this semantic buffer contains a certain channel. This method samples the semantics buffer using normalised texture coordinates.

Parameters:

uv

Normalised texture coordinates. The bottom-left is (0,1); the top-right is (1,0).

channelIndex

Channel index of the semantic class to look for.

Returns:

True if the channel exists at the given coordinates.

bool DoesChannelExistAt(Vector2 uv, string channelName)

Check if a pixel in this semantic buffer contains a certain channel. This method samples the semantics buffer using normalised texture coordinates.

Parameters:

uv

Normalised texture coordinates. The bottom-left is (0,1); the top-right is (1,0).

channelName

Name of the semantic class to look for.

Returns:

True if the channel exists at the given coordinates.

int GetChannelIndex(string channelName)

Get the channel index of a specified semantic class.

Parameters:

channelName

Name of semantic class.

Returns:

The index of the specified semantic class, or -1 if the channel does not exist.

UInt32 GetChannelTextureMask(int channelIndex)

Get a mask with only the specified channel’s bit enabled. Can be used to quickly check if a channel exists at a particular pixel in this semantic buffer.

Parameters:

channelIndex

Channel index of the semantic class to mask for.

Returns:

A mask with only the specified channel’s bit enabled.

UInt32 GetChannelTextureMask(int[] channelIndices)

Get a mask with only the specified channels’ bits enabled. Can be used to quickly check if a set of channels exists at a particular pixel in this semantic buffer.

Parameters:

channelIndices

Channel indices of the semantic classes to mask for.

Returns:

A mask with only the specified channels’ bits enabled.

UInt32 GetChannelTextureMask(string channelName)

Get a mask with only the specified channel’s bit enabled. Can be used to quickly check if a channel exists at a particular pixel in this semantic buffer.

Parameters:

channelName

Name of the semantic class to mask for.

Returns:

A mask with only the specified channel’s bit enabled.

UInt32 GetChannelTextureMask(string[] channelNames)

Get a mask with only the specified channels’ bits enabled. Can be used to quickly check if a set of channels exists at a particular pixel in this semantic buffer.

Parameters:

channelNames

Names of the semantic classes to mask for.

Returns:

A mask with only the specified channels’ bits enabled.