Preparing search index...

    Class RenderTargetProvider

    Controls a camera texture resource. Can be accessed through Texture.control on a Camera texture. For more information, see the Camera and Layers guide.

    Hierarchy (View Summary)

    Index

    Properties

    antialiasingMode: AntialiasingMode

    The anti-aliasing technique applied on the render target.

    Lens Scripting Version 305

    RenderTargetProvider.AntialiasingMode.Disabled
    
    antialiasingQuality: AntialiasingQuality

    The quality of the anti-aliasing technique applied on the render target.

    Lens Scripting Version 305

    RenderTargetProvider.AntialiasingQuality.Default
    
    clearColor: vec4

    When clearColorEnabled is true and inputTexture is null, this color is used to clear this RenderTarget the first time it is drawn to each frame.

    (0, 0, 0, 1)
    
    clearColorEnabled: boolean

    If true, the color on this RenderTarget will be cleared the first time it is drawn to each frame. inputTexture will be used to clear it unless it is null, in which case clearColor is used instead.

    clearColorOption: ClearColorOption

    Sets the clear color option.

    Lens Scripting Version 141

    ClearColorOption.Background
    
    clearDepthEnabled: boolean

    If true, the depth buffer will be cleared on this RenderTarget the first time it is drawn to each frame.

    true
    
    depthBufferUsage: DepthBufferUsage

    Controls the depth buffer usage strategy for this render target.

    Lens Scripting Version 336

    RenderTargetProvider.DepthBufferUsage.Auto
    

    The pixel format of the render target.

    Assigning a different format reallocates the render target's texture, discarding its contents. Not every format is renderable on every device — assigning one that isn't throws an error, so check it first with DeviceInfoSystem#isFormatSupported.

    Lens Scripting Version 375

    TextureFormat.RGBA8Unorm
    
    var target = global.scene.createRenderTargetTexture();
    var format = TextureFormat.RGBA16Float;
    // A render target is normally sampled too, so require Filter alongside Render.
    if (global.deviceInfoSystem.isFormatSupported(format, TextureUsage.Render | TextureUsage.Filter)) {
    target.control.format = format;
    }
    inputTexture: Texture

    When clearColorEnabled is true, this texture is used to clear this RenderTarget the first time it is drawn to each frame. If this texture is null, clearColor will be used instead.

    null
    
    mipmapsEnabled: boolean

    If true, mipmaps will be generated for this render target.

    false
    
    msaaStrategy: MSAAStrategy

    How MSAA should be applied on the render target.

    Lens Scripting Version 305

    RenderTargetProvider.MSAAStrategy.OnlyWhenRequired
    
    outputResolution: OutputResolution

    Controls the resolution source for this render target.

    Lens Scripting Version 336

    RenderTargetProvider.OutputResolution.Custom
    
    resolution: vec2

    When useScreenResolution is false, controls the horizontal and vertical resolution of the Render Target.

    (0, 0)
    
    resolutionScale: number

    When Use Screen Resolution is enabled, this scales the render target resolution relative to the device resolution.

    Lens Scripting Version 190

    1
    
    sliceCount: number

    sliceCount refers to the number of slices in a texture array or 3D texture.

    Lens Scripting Version 336

    textureType: TextureType

    The texture type of the render target.

    RenderTargetProvider.TextureType.Texture2D
    
    useScreenResolution: boolean

    If true, the Render Target's resolution will match the device's screen resolution.

    false
    

    Methods

    • Returns a Promise that resolves once this Provider has finished loading its resource.

      Returns Promise<void>

      If the Provider is already loaded when ensureLoaded() is called, the returned Promise resolves immediately. Otherwise it resolves once loading completes.

      Completion is determined by the Provider's load status (see Provider.getLoadStatus). Some Providers only become loaded once supporting runtime data is available — for example, a Provider whose resource depends on tracking will not report loaded until the relevant tracking data has arrived — so the returned Promise stays pending until that data is produced.

      This method is useful when Lens script needs to await a Provider before reading its data — for example, waiting for a remote-asset Provider to finish downloading before sampling it.

      Lens Scripting Version 370

      Fetch a Texture at runtime via RemoteMediaModule and wait for its Provider to finish loading before using it:

      const internetModule = require("LensStudio:InternetModule");
      const remoteMediaModule = require("LensStudio:RemoteMediaModule");

      function loadImageTexture(url) {
      const resource = internetModule.makeResourceFromUrl(url);
      return new Promise((resolve, reject) => {
      remoteMediaModule.loadResourceAsImageTexture(resource, resolve, reject);
      });
      }

      const texture = await loadImageTexture("https://example.com/image.png");

      // Wait until the fetched Texture's Provider has finished loading before using it.
      await texture.control.ensureLoaded();
      print("Texture ready, loadStatus: " + texture.control.getLoadStatus());
    • Returns the texture's aspect ratio, which is calculated as width / height.

      Returns number

    • Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().

      Returns string

    • 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