11. API Reference

This section provides a detailed description of the API provided by the ARGear Plugin.

11.1 ARGearManager

The ARGearManager oversees the overall flow and status and manages the lifecycle of ARgear. It also provides the methods that make all the ARGear functions possible.

11.1.1 Overview

Method

Description

Awake

Resets ARGear.

OnPostRender

Renders the camera data received through ARGear in Unity OpenGL.

LateUpdate

Processes the camera data received through ARGear after updating.

OnApplicationPause

Restarts or pauses ARGear based on the lifecycle.

OnDestroy

Destroys the ARGear session.

GetFaceTransform

Converts the transform object that has face data.

UpdateFaceObjects

Relays the ARGSession sampleBuffer and connection.

ChangeCameraFacing

Changes between the front/back camera.

RequestSignedUrl

Requests a SignedURL for Contents Download.

SetItem

Applies contents.

SetBeauty

Selects the beauty function type and sets the strength level.

SetBulge

Sets the Fun Bulge.

SetFilterLevel

Sets the strength level of the filter.

ClearContents

Clears the contents.

SetDrawLandmark

Turns the landmark debugging mode on and off.

ConvertBeautyData

Converts to an Android beauty data type.

11.1.2 Details

Awake()

When the script instance is loaded, it resets permissions, main camera, and renderer needed to drive ARGear.

OnPostRender()

Takes the camera data received in the ARGear Session and renders it in Unity OpenGL. It also saves the FaceTracking and Segmentation data in the Unity transform object.

LateUpdate()

After the update is run, it converts the ARGear Session's camera data to fit the window of the Unity Player.

OnApplicationPause(bool pause)

Resets/ pauses the ARGear session based on the state of the Unity Player.

Parameters

  • bool pause: the value of the Unity player's state

OnDestroy()

Destroys the ARGear session when the Unity player is destroyed.

GetFaceTransform(int index)

Returns the specific location of the face transform array object.

Parameters

  • int index: the location from the array.

Returns

  • Transform: an object with face scale, position, and rotation data

UpdateFaceObjects()

Renews the transform data with the face data from ARGear as a foundation every time OpenGL is rendered in the Unity Player.

ChangeCameraFacing()

Changes between the front/back camera.

RequestSignedUrl(string url, string title, string uuid)

Takes the URL, title, and type data of the content file to be downloaded and returns a string of a signed URL where contents download is possible.

Parameters

  • string url: a basic URL of the file to be downloaded

  • string title: Title of contents

  • string uuid: the unique URL (uuid) of the contents

Returns

  • string: a signed URL where contents download is possible

SetItem(ARGEnum.ContentsType type, string filePath, string uuid, ARGearContentsCallback callback = null)

Delivers the file path of the downloaded Type and Contents File and the Contents' uuid and makes it possible to render the contents on the camera screen.

Parameters

  • ARGEnum.ContentsType type: the ContentType of the content to be set

  • string filePath: the file path where the contents will be downloaded to

  • string uuid: the unique URL (uuid) of the contents

  • callback: callback result

SetBeauty(float[] values)

Applies 16 types of Beauty Type values consistently.

Parameters

  • float[] values: arranges a float of size 16

SetBulge(ARGEnum.BulgeType type)

Applies the selected type from 6 types of Fun Bulge. Choosing the ARGEnum.BulgeType.NONE option turns off Fun Bulge.

Parameters

  • ARGEnum.BulgeType type: chosen Fun Bulge type

SetFilterLevel(float level)

Sets the strength level of the currently selected filter. It is set from 0 to 100, and the closer to 100, the filter strength is closer to 100%.

Parameters

  • float level: strength of the chosen filter (0~100)

ClearContents(ARGEnum.ContentsType type)

Clears the contents of the received ARGEnum.ContentsType.

Parameters

  • ARGEnum.ContentsType type: ARGear contents type

SetDrawLandmark(bool isVisible)

A function that switches the debug mode of the landmark sign on and off.

Parameters

  • bool isVisible: Landmark Debug on/off

ConvertBeautyData(float[] values)

Converts the Beauty data values set in Unity to fit Android values. This is a method exclusively for Android.

Parameters

  • float[] values: Unity Beauty data

Returns

  • float[] values: the values converted to Android Beauty data

11.2 ARGearCamera

11.2.1 Overview

Method

Description

Start

Resets the ARGear Session.

Update

Gets the camera data after the ARGear Session is reset.

SetCameraTexture

Sets the ARGear camera texture in the Unity Renderer.

GetRigidPose

Changes ARGear's face data so that it can be used in Unity.

11.2.2 Details

Start()

Gives ARGear the Unity Player settings of ApiKey, SecretKey, AuthKey, and Config and resets.

Update()

Returns the ARGear Session's camera width and height when each frame of the Unity Player is updated.

SetCameraTexture(int width, int height, System.IntPtr ptr)

Sets the screen texture in Unity with the camera data from ARGear.

Parameters

  • int width: URL of file

  • in height: Title of Contents

  • System.IntPtr ptr: Type of Contents

GetRigidPose()

Takes the active face data from ARGear and saves it as a transform object with rotation and position values in Unity.

11.3 ARGearNative

11.3.1 Overview

Method

Description

ARGearNative

A creator to reset ARGear sessions on each platform

11.3.2 Details

ARGearNative(string url, string key string secretKey, string authKey, int[] inferenceConfig)

Uses the inferenceConfig value to reset Android/ iOS ARGear.

If you use Feature enum and set the

[Serializable]

public enum Feature

{

FACE_TRACKING = 0,

// FACE_BLEND_SHAPES = 1,

SEGMENTATION_HALF = 2

}

Last updated