class DepthBufferProcessor (Niantic.ARDK.AR.Awareness.Depth.DepthBufferProcessor)

Overview

class DepthBufferProcessor:
    Niantic.ARDK.AR.Awareness.AwarenessBufferProcessor,
    Niantic.ARDK.AR.Awareness.Depth.IDepthBufferProcessor {
public:
    // properties

    float??? MaxDepth;
    float??? MinDepth;

    // methods

    void AssignViewport(RenderTarget target);

    void CopyToAlignedTextureARGB32(
        ref Texture2D texture,
        ScreenOrientation orientation
    );

    void CopyToAlignedTextureRFloat(
        ref Texture2D texture,
        ScreenOrientation orientation
    );

    DepthBufferProcessor();
    DepthBufferProcessor(RenderTarget viewport);
    float GetDepth(int viewportX, int viewportY);
    float GetDistance(int viewportX, int viewportY);
    Vector3 GetSurfaceNormal(int viewportX, int viewportY);
    Vector3 GetWorldPosition(int viewportX, int viewportY);
};

Inherited Members

public:
    // properties

    TBuffer AwarenessBuffer;
    ArdkEventHandler<ContextAwarenessArgs<TBuffer>> AwarenessStreamBegan;
    Vector2Int CurrentViewportResolution;
    InterpolationMode InterpolationMode;
    float InterpolationPreference;
    Matrix4x4 SamplerTransform;
    InterpolationMode InterpolationMode;
    float InterpolationPreference;
    Matrix4x4 SamplerTransform;
    IDepthBuffer AwarenessBuffer;
    float MaxDepth;
    float MinDepth;

    // events

    event AwarenessStreamUpdated();

    // methods

    void Dispose();

    void CopyToAlignedTextureARGB32(
        ref Texture2D texture,
        ScreenOrientation orientation
    );

    void CopyToAlignedTextureRFloat(
        ref Texture2D texture,
        ScreenOrientation orientation
    );

    float GetDepth(int viewportX, int viewportY);
    float GetDistance(int viewportX, int viewportY);
    Vector3 GetSurfaceNormal(int viewportX, int viewportY);
    Vector3 GetWorldPosition(int viewportX, int viewportY);

Detailed Documentation

Methods

void AssignViewport(RenderTarget target)

Assigns a new render target descriptor for the depth processor. The render target defines the viewport attributes to correctly fit the depth buffer.

void CopyToAlignedTextureARGB32(
    ref Texture2D texture,
    ScreenOrientation orientation
)

Pushes the current state of the depth buffer to the specified target texture. The resulting texture will contain a display aligned representation of normalized depth values.

Note

Only use this call if you absolutely need the texture to be display aligned. It is faster to create a texture from the awareness buffer itself.

Parameters:

texture

The target texture (ARGB32). If this texture does not exist, it will be created. It is the responsibility of the caller to release this texture.

orientation

The target orientation of the texture. This determines the resolution of the container. This has to be either landscape or portrait.

void CopyToAlignedTextureRFloat(
    ref Texture2D texture,
    ScreenOrientation orientation
)

Pushes the current state of the depth buffer to the specified target texture. The resulting texture will contain a display aligned representation of the raw depth values.

Note

Only use this call if you absolutely need the texture to be display aligned. It is faster to create a texture from the awareness buffer itself.

Parameters:

texture

The target texture (RFloat). If this texture does not exist, it will be created. It is the responsibility of the caller to release this texture.

orientation

The target orientation of the texture. This determines the resolution of the container. This has to be either landscape or portrait.

DepthBufferProcessor()

Allocates a new depth buffer processor. By default, the awareness buffer will be fit to the main camera’s viewport.

DepthBufferProcessor(RenderTarget viewport)

Allocates a new depth buffer processor.

Parameters:

viewport

Determines the target viewport to fit the awareness buffer to.

float GetDepth(int viewportX, int viewportY)

Returns the eye depth of the specified pixel.

Parameters:

viewportX

Horizontal coordinate in viewport space.

viewportY

Vertical coordinate in viewport space.

Returns:

The perpendicular depth from the camera plane if exists or float.PositiveInfinity if the depth information is unavailable.

float GetDistance(int viewportX, int viewportY)

Returns the distance of the specified pixel from the camera origin.

Parameters:

viewportX

Horizontal coordinate in viewport space.

viewportY

Vertical coordinate in viewport space.

Returns:

The distance from the camera if exists or float.PositiveInfinity if the depth information is unavailable.

Vector3 GetSurfaceNormal(int viewportX, int viewportY)

Returns the surface normal of the specified pixel.

Parameters:

viewportX

Horizontal coordinate in viewport space.

viewportY

Vertical coordinate in viewport space.

Returns:

Normal if exists or Vector3.up if the depth information is unavailable.

Vector3 GetWorldPosition(int viewportX, int viewportY)

Returns the world position of the specified pixel.

Parameters:

viewportX

Horizontal coordinate in viewport space.

viewportY

Vertical coordinate in viewport space.

Returns:

World position if exists or Vector3.zero if the depth information is unavailable.