| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697 |
- /*******************************************************************************
- Copyright © 2015-2022 PICO Technology Co., Ltd.All rights reserved.
- NOTICE:All information contained herein is, and remains the property of
- PICO Technology Co., Ltd. The intellectual and technical concepts
- contained herein are proprietary to PICO Technology Co., Ltd. and may be
- covered by patents, patents in process, and are protected by trade secret or
- copyright law. Dissemination of this information or reproduction of this
- material is strictly forbidden unless prior written permission is obtained from
- PICO Technology Co., Ltd.
- *******************************************************************************/
- using System.Runtime.InteropServices;
- namespace Unity.XR.PXR
- {
- /// <summary>
- /// The codes that indicates the state of motion tracking features.
- /// </summary>
- public enum TrackingStateCode
- {
- /// <summary>
- /// Request succeeded.
- /// </summary>
- PXR_MT_SUCCESS = 0,
- /// <summary>
- /// Request failed.
- /// </summary>
- PXR_MT_FAILURE = -1,
- /// <summary>
- /// Invalid mode.
- /// </summary>
- PXR_MT_MODE_NONE = -2,
- /// <summary>
- /// The current device does not support this feature.
- /// </summary>
- PXR_MT_DEVICE_NOT_SUPPORT = -3,
- /// <summary>
- /// This feature is not started.
- /// </summary>
- PXR_MT_SERVICE_NEED_START = -4,
- /// <summary>
- /// Eye tracking permission denied.
- /// </summary>
- PXR_MT_ET_PERMISSION_DENIED = -5,
- /// <summary>
- /// Face tracking permission denied.
- /// </summary>
- PXR_MT_FT_PERMISSION_DENIED = -6,
- /// <summary>
- /// Microphone permission denied.
- /// </summary>
- PXR_MT_MIC_PERMISSION_DENIED = -7,
- /// <summary>
- /// (Reserved)
- /// </summary>
- PXR_MT_SYSTEM_DENIED = -8,
- /// <summary>
- /// Unknown error.
- /// </summary>
- PXR_MT_UNKNOW_ERROR = -9
- }
- #region Eye Tracking
- /// <summary>
- /// Eye tracking modes.
- /// </summary>
- public enum EyeTrackingMode
- {
- /// <summary>
- /// To disable eye tracking.
- /// </summary>
- PXR_ETM_NONE = -1,
- /// <summary>
- /// To enable eye tracking.
- /// </summary>
- PXR_ETM_BOTH = 0,
- /// <summary>
- /// (Reserved)
- /// </summary>
- PXR_ETM_COUNT = 1
- }
- public enum PerEyeUsage
- {
- LeftEye = 0,
- RightEye = 1,
- Combined = 2,
- EyeCount = 3
- }
- /// <summary>
- /// Eye tracking data flags.
- /// </summary>
- public enum EyeTrackingDataGetFlags : long
- {
- /// <summary>
- /// Do not return any data.
- /// </summary>
- PXR_EYE_DEFAULT = 0,
- /// <summary>
- /// To return the positions of both eyes.
- /// </summary>
- PXR_EYE_POSITION = 1 << 0,
- /// <summary>
- /// To return the orientations of both eyes.
- /// </summary>
- PXR_EYE_ORIENTATION = 1 << 1
- }
- /// <summary>
- /// The information to pass for starting eye tracking. This information remains effective during the period when eye tracking is enabled.
- /// </summary>
- public struct EyeTrackingStartInfo
- {
- private int apiVersion;
- /// <summary>
- /// Whether the app needs eye tracking calibration.
- /// * `0`: needs
- /// * `1`: does not need
- /// </summary>
- public byte needCalibration;
- /// <summary>
- /// Select an eye tracking mode for the app. Refer to the `EyeTrackingMode` enum for details.
- /// </summary>
- public EyeTrackingMode mode;
- public void SetVersion(int version)
- {
- apiVersion = version;
- }
- public override string ToString()
- {
- return string.Format("apiVersion :{0}, needCalibration:{1}, mode:{2}", apiVersion, needCalibration, mode);
- }
- }
- public struct EyeTrackingStopInfo
- {
- private int apiVersion;
- public void SetVersion(int version)
- {
- apiVersion = version;
- }
- public override string ToString()
- {
- return string.Format("apiVersion :{0}", apiVersion);
- }
- }
- /// <summary>
- /// Information about the state of eye tracking.
- /// </summary>
- public struct EyeTrackingState
- {
- private int apiVersion;
- /// <summary>
- /// Eye tracking mode. Refer to the `EyeTrackingMode` enum for details.
- /// </summary>
- public EyeTrackingMode currentTrackingMode;
- /// <summary>
- /// The state code of eye tracking. Refer to the `TrackingStateCode` enum for details.
- /// </summary>
- public TrackingStateCode code;
- public void SetVersion(int version)
- {
- apiVersion = version;
- }
- public override string ToString()
- {
- return string.Format("apiVersion :{0}, currentTrackingMode:{1}, code:{2}", apiVersion, currentTrackingMode, code);
- }
- }
- /// <summary>
- /// The information to pass for getting eye tracking data. Should be called at every frame when you need to update eye tracking data.
- /// </summary>
- public struct EyeTrackingDataGetInfo
- {
- private int apiVersion;
- /// <summary>
- /// Reserved. Pass `0`.
- /// </summary>
- public long displayTime;
- /// <summary>
- /// Specifies what eye tracking data to return. Refer to the `EyeTrackingDataGetFlags` enum for details.
- /// </summary>
- public EyeTrackingDataGetFlags flags;
- public void SetVersion(int version)
- {
- apiVersion = version;
- }
- public override string ToString()
- {
- return string.Format("apiVersion :{0}, displayTime:{1}, flags:{2}", apiVersion, displayTime, flags);
- }
- }
- /// <summary>
- /// The data of the eye.
- /// </summary>
- public struct PerEyeData
- {
- private int apiVersion;
- /// <summary>
- /// The pose (postion and orientation) of the eye.
- /// </summary>
- public Posef pose;
- /// <summary>
- /// Whether the pose data is valid.
- /// </summary>
- public byte isPoseValid;
- /// <summary>
- /// The openness of the eye, which is a float value ranges from `0.0` to `1.0`. `0.0` indicates completely closed, `1.0` indicates completely open.
- /// </summary>
- public float openness;
- /// <summary>
- /// Whether the openness value is valid.
- /// </summary>
- public byte isOpennessValid;
- public void SetVersion(int version)
- {
- apiVersion = version;
- }
- public override string ToString()
- {
- return string.Format("apiVersion :{0}, pose:{1}, isPoseValid:{2}, openness:{3}, isOpennessValid:{4}", apiVersion, pose, isPoseValid, openness, isOpennessValid);
- }
- }
- /// <summary>
- /// Eye tracking data.
- /// </summary>
- public struct EyeTrackingData
- {
- private int apiVersion;
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = (int)PerEyeUsage.EyeCount)]
- /// <summary>
- /// Eye data. Index `0`: left eye. Index `1`: right eye. Index `2`: combined eyes (left and right eyes).
- /// @note Currently, only index `2` returns data.
- /// </summary>
- public PerEyeData[] eyeDatas;
- public void SetVersion(int version)
- {
- apiVersion = version;
- }
- public override string ToString()
- {
- return string.Format("apiVersion :{0},\n eyeDatas[0]:{1},\n eyeDatas[1]:{2},\n eyeDatas[2]:{3}", apiVersion, eyeDatas[0], eyeDatas[1], eyeDatas[2]);
- }
- }
- /// <summary>
- /// The information about the pupils of both eyes.
- /// </summary>
- [StructLayout(LayoutKind.Sequential)]
- public unsafe struct EyePupilInfo
- {
- /// <summary>
- /// The diameter (unit: pixels) of the left eye's pupil.
- /// </summary>
- public float leftEyePupilDiameter;
- /// <summary>
- /// The diameter (unit: pixels) of the right eye's pupil.
- /// </summary>
- public float rightEyePupilDiameter;
- /// <summary>
- /// The position of the left eye's pupil.
- /// </summary>
- public fixed float leftEyePupilPosition[2];
- /// <summary>
- /// The position of the right eye's pupil.
- /// </summary>
- public fixed float rightEyePupilPosition[2];
- public override string ToString()
- {
- string str = string.Format("leftEyePupilDiameter :{0}, rightEyePupilDiameter:{1}", leftEyePupilDiameter.ToString("F6"), rightEyePupilDiameter.ToString("F6"));
- for (int i = 0; i < 2; i++)
- {
- str += string.Format("\nleftEyePupilPosition[{0}] :{1}", i, leftEyePupilPosition[i].ToString("F6"));
- str += string.Format(" rightEyePupilPosition[{0}] :{1}", i, rightEyePupilPosition[i].ToString("F6"));
- }
- return str;
- }
- }
- #endregion
- #region Face Tracking
- /// <summary>
- /// Face tracking modes.
- /// </summary>
- public enum FaceTrackingSupportedMode
- {
- /// <summary>
- /// No face tracking.
- /// </summary>
- PXR_FTM_NONE = -1,
- /// <summary>
- /// Face tracking only (without lipsync).
- /// </summary>
- PXR_FTM_FACE = 0,
- /// <summary>
- /// Lipsync only.
- /// </summary>
- PXR_FTM_LIPS = 1,
- /// <summary>
- /// Hybrid mode. Enable both face tracking and lipsync. The lip data's output format is viseme.
- /// </summary>
- PXR_FTM_FACE_LIPS_VIS = 2,
- /// <summary>
- /// Hybrid mode. Enable both face tracking and lipsync. The lip data's output format is blendshape.
- /// </summary>
- PXR_FTM_FACE_LIPS_BS = 3,
- /// <summary>
- /// (Reserved)
- /// </summary>
- PXR_FTM_COUNT = 4
- }
- /// <summary>
- /// Specifies the face tracking data to return.
- /// </summary>
- public enum FaceTrackingDataGetFlags : long
- {
- /// <summary>
- /// To return all types of face tracking data.
- /// </summary>
- PXR_FACE_DEFAULT = 0,
- }
- /// <summary>
- /// The information to pass for starting eye tracking.
- /// </summary>
- public struct FaceTrackingStartInfo
- {
- private int apiVersion;
- /// <summary>
- /// The face tracking mode to enable. Refer to the `FaceTrackingSupportedMode` enum for details.
- /// </summary>
- public FaceTrackingSupportedMode mode;
- public void SetVersion(int version)
- {
- apiVersion = version;
- }
- public override string ToString()
- {
- return string.Format("apiVersion :{0}, mode:{1}", apiVersion, mode);
- }
- }
- /// <summary>
- /// The information to pass for stopping face tracking.
- /// </summary>
- public struct FaceTrackingStopInfo
- {
- private int apiVersion;
- /// <summary>
- /// Determines whether to pause face tracking.
- /// * `0`: pause
- /// * `1`: do not pause, directly stop face tracking
- /// </summary>
- public byte pause;
- public void SetVersion(int version)
- {
- apiVersion = version;
- }
- public override string ToString()
- {
- return string.Format("apiVersion :{0}, pause:{1}", apiVersion, pause);
- }
- }
- /// <summary>
- /// Information about the state of face tracking.
- /// </summary>
- public struct FaceTrackingState
- {
- private int apiVersion;
- /// <summary>
- /// The face tracking mode of the app. Refer to the `FaceTrackingSupportedMode` enum for details.
- /// </summary>
- public FaceTrackingSupportedMode currentTrackingMode;
- /// <summary>
- /// Face tracking state code. Refer to the `TrackingStateCode` enum for details.
- /// </summary>
- public TrackingStateCode code;
- public void SetVersion(int version)
- {
- apiVersion = version;
- }
- public override string ToString()
- {
- return string.Format("apiVersion :{0}, currentTrackingMode:{1}, code:{2}", apiVersion, currentTrackingMode, code);
- }
- }
- /// <summary>
- /// The information to pass for getting face tracking data.
- /// </summary>
- public struct FaceTrackingDataGetInfo
- {
- private int apiVersion;
- /// <summary>
- /// Reserved. Pass `0`.
- /// </summary>
- public long displayTime;
- public void SetVersion(int version)
- {
- apiVersion = version;
- }
- public FaceTrackingDataGetFlags flags;
- public override string ToString()
- {
- return string.Format("apiVersion :{0}, displayTime:{1}, flags:{2}", apiVersion, displayTime, flags);
- }
- }
- /// <summary>
- /// Face tracking data.
- /// </summary>
- public unsafe struct FaceTrackingData
- {
- private int apiVersion;
- /// <summary>
- /// A float* value, the length must be 72. Refer to `BlendShapeIndex` for the definition of each value.
- /// </summary>
- public float* blendShapeWeight;
- /// <summary>
- /// The timestamp for the current data.
- /// </summary>
- public long timestamp;
- /// <summary>
- /// The laughing prob is a float ranging from `0` to `1`.
- /// </summary>
- public float laughingProb;
- /// <summary>
- /// Whether the data of the eye area is valid.
- /// </summary>
- public byte eyeValid;
- /// <summary>
- /// Whether the data of the face area is valid.
- /// </summary>
- public byte faceValid;
- public void SetVersion(int version)
- {
- apiVersion = version;
- }
- public override string ToString()
- {
- string str = string.Format("apiVersion :{0}, timestamp:{1}, laughingProb:{2}, eyeValid:{3}, faceValid:{4}\n", apiVersion, timestamp, laughingProb, eyeValid, faceValid);
- for (int i = 0; i < 72; i++)
- {
- str += string.Format(" blendShapeWeight[{0}]:{1}", i, blendShapeWeight[i].ToString("F6"));
- }
- return str;
- }
- }
- #endregion
- public class PXR_MotionTracking
- {
- //Eye Tracking
- public const int PXR_EYE_TRACKING_API_VERSION = 1;
- /// <summary>
- /// Wants eye tracking service for the current app.
- /// </summary>
- /// <returns>Returns `0` for success and other values for failure.</returns>
- public static int WantEyeTrackingService()
- {
- return PXR_Plugin.MotionTracking.UPxr_WantEyeTrackingService();
- }
- /// <summary>
- /// Gets whether the current device supports eye tracking.
- /// </summary>
- /// <param name="supported">
- /// Returns a bool indicating whether eye tracking is supported:
- /// * `true`: supported
- /// * `false`: not supported
- /// </param>
- /// <param name="supportedModesCount">
- /// Returns the number of eye tracking modes supported by the current device.
- /// </param>
- /// <param name="supportedModes">
- /// Returns the eye tracking modes supported by the current device.
- /// </param>
- /// <returns>Returns `0` for success and other values for failure.</returns>
- public static int GetEyeTrackingSupported(ref bool supported, ref int supportedModesCount, ref EyeTrackingMode supportedModes)
- {
- return PXR_Plugin.MotionTracking.UPxr_GetEyeTrackingSupported(ref supported, ref supportedModesCount, ref supportedModes);
- }
- /// <summary>
- /// Starts eye tracking.
- /// @note Supported by PICO Neo3 Pro Eye, PICO 4 Pro, and PICO 4 Enterprise.
- /// </summary>
- /// <param name="startInfo">Passes the information for starting eye tracking.
- /// </param>
- /// <returns>Returns `0` for success and other values for failure.</returns>
- public static int StartEyeTracking(ref EyeTrackingStartInfo startInfo)
- {
- startInfo.SetVersion(PXR_EYE_TRACKING_API_VERSION);
- return PXR_Plugin.MotionTracking.UPxr_StartEyeTracking1(ref startInfo);
- }
- /// <summary>
- /// Stops eye tracking.
- /// @note Supported by PICO Neo3 Pro Eye, PICO 4 Pro, and PICO 4 Enterprise.
- /// </summary>
- /// <param name="stopInfo">Passes the information for stopping eye tracking. Currently, you do not need to pass anything.</param>
- /// <returns>Returns `0` for success and other values for failure.</returns>
- public static int StopEyeTracking(ref EyeTrackingStopInfo stopInfo)
- {
- stopInfo.SetVersion(PXR_EYE_TRACKING_API_VERSION);
- return PXR_Plugin.MotionTracking.UPxr_StopEyeTracking1(ref stopInfo);
- }
- /// <summary>
- /// Gets the state of eye tracking.
- /// @note Supported by PICO Neo3 Pro Eye, PICO 4 Pro, and PICO 4 Enterprise.
- /// </summary>
- /// <param name="isTracking">Returns a bool that indicates whether eye tracking is working:
- /// * `true`: eye tracking is working
- /// * `false`: eye tracking has been stopped
- /// </param>
- /// <param name="state">Returns the eye tracking state information, including the eye tracking mode and eye tracking state code.</param>
- /// <returns>Returns `0` for success and other values for failure.</returns>
- public static int GetEyeTrackingState(ref bool isTracking, ref EyeTrackingState state)
- {
- state.SetVersion(PXR_EYE_TRACKING_API_VERSION);
- return PXR_Plugin.MotionTracking.UPxr_GetEyeTrackingState(ref isTracking, ref state);
- }
- /// <summary>
- /// Gets eye tracking data.
- /// @note Supported by PICO Neo3 Pro Eye, PICO 4 Pro, and PICO 4 Enterprise.
- /// </summary>
- /// <param name="getInfo">Specifies the eye tracking data you want.</param>
- /// <param name="data">Returns the desired eye tracking data.</param>
- /// <returns>Returns `0` for success and other values for failure.</returns>
- public static int GetEyeTrackingData(ref EyeTrackingDataGetInfo getInfo, ref EyeTrackingData data)
- {
- getInfo.SetVersion(PXR_EYE_TRACKING_API_VERSION);
- data.SetVersion(PXR_EYE_TRACKING_API_VERSION);
- return PXR_Plugin.MotionTracking.UPxr_GetEyeTrackingData1(ref getInfo, ref data);
- }
- //PICO4E
- /// <summary>
- /// Gets the opennesses of the left and right eyes.
- /// @note
- /// - Supported by PICO 4 Enterprise.
- /// - To use this API, you need to add '<meta-data android:name="pvr.app.et_tob_advance" android:value="true"/>' to the app's AndroidManifest file.
- /// </summary>
- /// <param name="leftEyeOpenness">The openness of the left eye, which is a float value ranges from `0.0` to `1.0`. `0.0` indicates completely closed, `1.0` indicates completely open.</param>
- /// <param name="rightEyeOpenness">The openness of the right eye, which is a float value ranges from `0.0` to `1.0`. `0.0` indicates completely closed, `1.0` indicates completely open.</param>
- /// <returns>Returns `0` for success and other values for failure.</returns>
- public static int GetEyeOpenness(ref float leftEyeOpenness, ref float rightEyeOpenness)
- {
- return PXR_Plugin.MotionTracking.UPxr_GetEyeOpenness(ref leftEyeOpenness, ref rightEyeOpenness);
- }
- /// <summary>
- /// Gets the information about the pupils of both eyes.
- /// @note
- /// - Supported by PICO 4 Enterprise.
- /// - To use this API, you need to add '<meta-data android:name="pvr.app.et_tob_advance" android:value="true"/>' to the app's AndroidManifest file.
- /// </summary>
- /// <param name="eyePupilPosition">Returns the diameters and positions of both pupils.</param>
- /// <returns>Returns `0` for success and other values for failure.</returns>
- public static int GetEyePupilInfo(ref EyePupilInfo eyePupilPosition)
- {
- return PXR_Plugin.MotionTracking.UPxr_GetEyePupilInfo(ref eyePupilPosition);
- }
- /// <summary>
- /// Gets the poses of the left and right eyes.
- /// @note
- /// - Supported by PICO 4 Enterprise.
- /// - To use this API, you need to add '<meta-data android:name="pvr.app.et_tob_advance" android:value="true"/>' to the app's AndroidManifest file.
- /// </summary>
- /// <param name="timestamp">Returns the timestamp (unit: nanosecond) of the eye pose information.</param>
- /// <param name="leftEyePose">Returns the position and rotation of the left eye.</param>
- /// <param name="rightPose">Returns the position and rotation of the right eye.</param>
- /// <returns>Returns `0` for success and other values for failure.</returns>
- public static int GetPerEyePose(ref long timestamp, ref Posef leftEyePose, ref Posef rightPose)
- {
- return PXR_Plugin.MotionTracking.UPxr_GetPerEyePose(ref timestamp, ref leftEyePose, ref rightPose);
- }
- /// <summary>
- /// Gets whether the left and right eyes blinked.
- /// @note
- /// - Supported by PICO 4 Enterprise.
- /// - To use this API, you need to add '<meta-data android:name="pvr.app.et_tob_advance" android:value="true"/>' to the app's AndroidManifest file.
- /// </summary>
- /// <param name="timestamp">Returns the timestamp (unit: nanosecond) of the eye blink information.</param>
- /// <param name="isLeftBlink">Returns whether the left eye blinked:
- /// * `true`: blinked (the user's left eye is closed, which will usually open again immediately to generate a blink event)
- /// * `false`: didn't blink (the user's left eye is open)
- /// </param>
- /// <param name="isRightBlink">Returns whether the right eye blined:
- /// * `true`: blinked (the user's right eye is closed, which will usually open again immediately to generate a blink event)
- /// * `false`: didn't blink (the user's right eye is open)
- /// </param>
- /// <returns>Returns `0` for success and other values for failure.</returns>
- public static int GetEyeBlink(ref long timestamp, ref bool isLeftBlink, ref bool isRightBlink)
- {
- return PXR_Plugin.MotionTracking.UPxr_GetEyeBlink(ref timestamp, ref isLeftBlink, ref isRightBlink);
- }
- //Face Tracking
- public const int PXR_FACE_TRACKING_API_VERSION = 1;
- /// <summary>
- /// Wants face tracking service for the current app.
- /// </summary>
- /// <returns>Returns `0` for success and other values for failure.</returns>
- public static int WantFaceTrackingService()
- {
- return PXR_Plugin.MotionTracking.UPxr_WantFaceTrackingService();
- }
- /// <summary>
- /// Gets whether the current device supports face tracking.
- /// </summary>
- /// <param name="supported">Indicates whether the device supports face tracking:
- /// * `true`: support
- /// * `false`: not support
- /// </param>
- /// <param name="supportedModesCount">Returns the total number of face tracking modes supported by the device.</param>
- /// <param name="supportedModes">Returns the specific face tracking modes supported by the device.</param>
- /// <returns>Returns `0` for success and other values for failure.</returns>
- public static int GetFaceTrackingSupported(ref bool supported, ref int supportedModesCount, ref FaceTrackingSupportedMode supportedModes)
- {
- return PXR_Plugin.MotionTracking.UPxr_GetFaceTrackingSupported(ref supported, ref supportedModesCount, ref supportedModes);
- }
- /// <summary>
- /// Starts face tracking.
- /// @note Supported by PICO 4 Pro and PICO 4 Enterprise.
- /// </summary>
- /// <param name="startInfo">Passes the information for starting face tracking.</param>
- /// <returns>Returns `0` for success and other values for failure.</returns>
- public static int StartFaceTracking(ref FaceTrackingStartInfo startInfo)
- {
- startInfo.SetVersion(PXR_FACE_TRACKING_API_VERSION);
- return PXR_Plugin.MotionTracking.UPxr_StartFaceTracking(ref startInfo);
- }
- /// <summary>
- /// Stops face tracking.
- /// @note Supported by PICO 4 Pro and PICO 4 Enterprise.
- /// </summary>
- /// <param name="stopInfo">Passes the information for stopping face tracking.</param>
- /// <returns>Returns `0` for success and other values for failure.</returns>
- public static int StopFaceTracking(ref FaceTrackingStopInfo stopInfo)
- {
- stopInfo.SetVersion(PXR_FACE_TRACKING_API_VERSION);
- return PXR_Plugin.MotionTracking.UPxr_StopFaceTracking(ref stopInfo);
- }
- /// <summary>
- /// Gets the state of face tracking.
- /// @note Supported by PICO 4 Pro and PICO 4 Enterprise.
- /// </summary>
- /// <param name="isTracking">Returns a bool indicating whether face tracking is working:
- /// * `true`: face tracking is working
- /// * `false`: face tracking has been stopped
- /// </param>
- /// <param name="state">Returns the state of face tracking, including the face tracking mode and face tracking state code.
- /// </param>
- /// <returns>Returns `0` for success and other values for failure.</returns>
- public static int GetFaceTrackingState(ref bool isTracking, ref FaceTrackingState state)
- {
- state.SetVersion(PXR_FACE_TRACKING_API_VERSION);
- return PXR_Plugin.MotionTracking.UPxr_GetFaceTrackingState(ref isTracking, ref state);
- }
- /// <summary>
- /// Gets face tracking data.
- /// @note Supported by PICO 4 Pro and PICO 4 Enterprise.
- /// </summary>
- /// <param name="getInfo">Specifies the face tracking data you want.</param>
- /// <param name="data">Returns the desired face tracking data.</param>
- /// <returns>Returns `0` for success and other values for failure.</returns>
- public static int GetFaceTrackingData(ref FaceTrackingDataGetInfo getInfo, ref FaceTrackingData data)
- {
- getInfo.SetVersion(PXR_FACE_TRACKING_API_VERSION);
- data.SetVersion(PXR_FACE_TRACKING_API_VERSION);
- return PXR_Plugin.MotionTracking.UPxr_GetFaceTrackingData1(ref getInfo, ref data);
- }
- }
- }
|