8 using System.Runtime.InteropServices;
51 OpticalSeeThrough = 1,
69 public string activeProfile {
get;
set; }
71 private WearableCalibration()
81 if (Application.platform == RuntimePlatform.IPhonePlayer)
98 public bool Init(
string modelName,
int width,
int height)
102 if (Application.platform == RuntimePlatform.IPhonePlayer)
111 Debug.Log(
"Wearable Init is " + result.ToString());
113 AndroidJavaClass javaUnityPlayer =
new AndroidJavaClass(
"com.unity3d.player.UnityPlayer");
114 AndroidJavaObject currentActivity = javaUnityPlayer.GetStatic<AndroidJavaObject>(
"currentActivity");
116 AndroidJavaClass javaClass =
new AndroidJavaClass(
"com.maxst.ar.WearableCalibration");
117 AndroidJavaObject javaObject = javaClass.CallStatic<AndroidJavaObject>(
"getInstance");
119 if (!javaObject.Call<
bool>(
"readActiveProfile", currentActivity, modelName))
121 Debug.Log(
"Read Default Profile.");
124 activeProfile = javaObject.Call<
string>(
"getActiveProfileName");
126 javaObject.Call(
"setSurfaceSize", Screen.width, Screen.height);
128 currentActivity.Dispose();
129 javaUnityPlayer.Dispose();
139 if (Application.platform == RuntimePlatform.IPhonePlayer)
173 float[] viewport =
new float[4];
174 if (Application.platform == RuntimePlatform.IPhonePlayer)
198 float[] projection =
new float[16];
199 if (Application.platform == RuntimePlatform.IPhonePlayer)
201 NativeStaticAPI.WearableCalibration_getProjectionMatrix(projection, (
int)eyeType);
205 NativeSharedAPI.WearableCalibration_getProjectionMatrix(projection, (
int)eyeType);
bool Init(string modelName, int width, int height)
Initialize the HMD device.
float [] GetViewport(EyeType eyeType)
Get HMD screen viewport.
WearableType
Wearable Device Type
float [] GetProjectionMatrix(EyeType eyeType)
Get calibrated HMD projection matrix.
API for wearable calibration.
bool IsActivated()
Confirm that the HMD unit is initialized.
static WearableCalibration GetInstance()
Get a WearableCalibration instance.
void Deinit()
Deinitialize the HMD device.