Lens Scripting API

    Class DepthTextureProvider

    Provides depth information of the video feed that the Lens is being applied to when available. Can be accessed from mainPass.baseTex.control of a Spectacles Depth material.

    // Get a reference to the Spectacles Depth material, set in the Inspector panel
    // @input Asset.Material depthMaterial

    // Bind an event to run every frame
    script.createEvent("UpdateEvent").bind(function()
    {
    // The point at the center of the screen
    var screenPosition = new vec2(0.5, 0.5);

    // Get the depth at the screen position
    var depth = script.depthMaterial.mainPass.baseTex.control.getDepth(screenPosition);

    // Print the depth value
    print (depth);
    });

    Hierarchy (View Summary, Expand)

    Index

    Constructors

    Methods

    • Returns the texture's aspect ratio, which is calculated as width / height.

      Returns number

    • Returns the width of the texture in pixels.

      Returns number

    • Returns true if the object matches or derives from the passed in type.

      Parameters

      • type: string

      Returns boolean

    • Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

      Parameters

      Returns boolean

    • Exposes User Data

      Get the depth at the given point.

      Parameters

      Returns number

    MMNEPVFCICPMFPCPTTAAATR