class AwarenessUtils (Niantic.ARDK.AR.Awareness.AwarenessUtils)¶
Overview¶
A collection of utility methods for working with contextual awareness buffers. More…
class AwarenessUtils { public: // methods static bool CopySemanticConfidencesARGB32( this IARFrame frame, string channelName, int viewportWidth, int viewportHeight, ref Texture2D texture, out Matrix4x4 samplerTransform ); static bool CopySemanticConfidencesRFloat( this IARFrame frame, string channelName, int viewportWidth, int viewportHeight, ref Texture2D texture, out Matrix4x4 samplerTransform ); static Vector2Int FromBufferToScreenPosition< TBuffer >( AwarenessBufferProcessor<TBuffer> processor, int x, int y ); };
Detailed Documentation¶
A collection of utility methods for working with contextual awareness buffers.
Methods¶
static bool CopySemanticConfidencesARGB32( this IARFrame frame, string channelName, int viewportWidth, int viewportHeight, ref Texture2D texture, out Matrix4x4 samplerTransform )
Extracts raw semantic confidences from the frame and uploads it to GPU memory in the form of a texture. If the frame does not hold semantics data, this API does nothing.
Parameters:
frame |
The AR frame to get semantics data from. |
channelName |
The name of the semantic class to create a texture of. |
viewportWidth |
The width of the viewport the texture needs to be mapped to. |
viewportHeight |
The height of the viewport the texture needs to be mapped to. |
texture |
The texture to copy the data to. If this reference is null, the texture will be allocated. Deallocating the texture is the responsibility of the caller. |
samplerTransform |
The transformation matrix to be used to sample the texture. |
Returns:
Whether the texture has been successfully created/updated.
static bool CopySemanticConfidencesRFloat( this IARFrame frame, string channelName, int viewportWidth, int viewportHeight, ref Texture2D texture, out Matrix4x4 samplerTransform )
Extracts raw semantic confidences from the frame and uploads it to GPU memory in the form of a texture. If the frame does not hold semantics data, this API does nothing.
Parameters:
frame |
The AR frame to get semantics data from. |
channelName |
The name of the semantic class to create a texture of. |
viewportWidth |
The width of the viewport the texture needs to be mapped to. |
viewportHeight |
The height of the viewport the texture needs to be mapped to. |
texture |
The texture to copy the data to. If this reference is null, the texture will be allocated. Deallocating the texture is the responsibility of the caller. |
samplerTransform |
The transformation matrix to be used to sample the texture. |
Returns:
Whether the texture has been successfully created/updated.
static Vector2Int FromBufferToScreenPosition< TBuffer >( AwarenessBufferProcessor<TBuffer> processor, int x, int y )
Converts pixel coordinates from the raw awareness buffer’s coordinate frame to viewport pixel coordinates.
Parameters:
processor |
Reference to the context awareness processor. |
x |
Awareness buffer pixel position on the x axis. |
y |
Awareness buffer pixel position on the y axis. |
Returns:
Pixel coordinates on the viewport.