public Dictionary <ARFace.BlendShapeLocation, float> GetBlendShapeData(IntPtr blendShapesHandle)
        {
            IntPtr dataHandle      = IntPtr.Zero;
            IntPtr shapeTypeHandle = IntPtr.Zero;
            int    dataSize        = 0;
            Dictionary <ARFace.BlendShapeLocation, float> ret = new Dictionary <ARFace.BlendShapeLocation, float>();

            NDKAPI.HwArFaceBlendShapes_getCount(m_ndkSession.SessionHandle, blendShapesHandle, ref dataSize);

            if (dataSize < 0 || dataSize > AdapterConstants.Enum_FaceBlendShapeLocation_MaxIntValue)
            {
                ARDebug.LogWarning("HwArFaceBlendShapes_getCount return value:{0}, while the legal max value is {1}",
                                   dataSize, AdapterConstants.Enum_FaceBlendShapeLocation_MaxIntValue);
                return(ret);
            }

            NDKAPI.HwArFaceBlendShapes_acquireTypes(m_ndkSession.SessionHandle, blendShapesHandle, ref shapeTypeHandle);
            NDKAPI.HwArFaceBlendShapes_acquireData(m_ndkSession.SessionHandle, blendShapesHandle, ref dataHandle);

            for (int i = 0; i < dataSize; i++)
            {
                int location = MarshalingHelper.GetValueOfUnmanagedArrayElement <int>(shapeTypeHandle, i);
                if (!ValueLegalityChecker.CheckInt("GetBlendShapeData", location,
                                                   AdapterConstants.Enum_FaceBlendShapeLocation_MinIntValue,
                                                   AdapterConstants.Enum_FaceBlendShapeLocation_MaxIntValue - 1))
                {
                    continue;
                }

                float val = MarshalingHelper.GetValueOfUnmanagedArrayElement <float>(dataHandle, i);

                ret.Add((ARFace.BlendShapeLocation)location, val);
            }
            return(ret);
        }
Exemplo n.º 2
0
 public void Config(ARConfigBase config)
 {
     if (ARSessionStatus.PAUSED != Instance.SessionStatus &&
         ARSessionStatus.INIT != Instance.SessionStatus)
     {
         ARDebug.LogWarning("config when session is not init or paused, ignore it");
     }
     Instance.m_ndkSession.SessionAdapter.Config(config);
 }
Exemplo n.º 3
0
 public ARAnchor AddAnchor(Pose pose)
 {
     if (ARSessionStatus.RUNNING != Instance.SessionStatus)
     {
         ARDebug.LogWarning("add anchor when session is not running, ignore it");
         throw new ARNotYetAvailableException();
     }
     return(Instance.m_ndkSession.SessionAdapter.CreateAnchor(pose));
 }
 public static bool CheckInt(string methodName, int toCheckValue, int minValue, int maxValue = Int32.MaxValue)
 {
     if (toCheckValue < minValue || toCheckValue > maxValue)
     {
         ARDebug.LogWarning("{0}: value is {1}, while legal min value is {2}, max value is {3}",
                            methodName, toCheckValue, minValue, maxValue);
         return(false);
     }
     return(true);
 }
Exemplo n.º 5
0
 public void Pause()
 {
     if (ARSessionStatus.STOPPED == SessionStatus)
     {
         ARDebug.LogWarning("session is stopped when pause, ignore it");
         return;
     }
     m_ndkSession.SessionAdapter.Pause();
     SessionStatus = ARSessionStatus.PAUSED;
 }
Exemplo n.º 6
0
 public void SetDisplayGeometry(int width, int height)
 {
     if (ARSessionStatus.STOPPED == SessionStatus)
     {
         ARDebug.LogWarning("Session is stopped when SetDisplayGeometry, ignore it");
         return;
     }
     m_ndkSession.SessionAdapter.SetDisplayGeometry(Screen.orientation, Screen.width, Screen.height);
     DisplayGeometrySet = true;
 }
Exemplo n.º 7
0
 public void Update()
 {
     if (SessionStatus != ARSessionStatus.RESUMED &&
         SessionStatus != ARSessionStatus.RUNNING)
     {
         ARDebug.LogWarning("update when state is not resumed or running, ignore it");
         return;
     }
     m_ndkSession.SessionAdapter.Update();
     SessionStatus = ARSessionStatus.RUNNING;
 }
Exemplo n.º 8
0
 public void Resume()
 {
     if (ARSessionStatus.STOPPED == SessionStatus)
     {
         ARDebug.LogWarning("Session is stopped when resume, ignore it");
         return;
     }
     if (!AndroidPermissionsRequest.IsPermissionGranted("android.permission.CAMERA"))
     {
         throw new ARCameraPermissionDeniedException();
     }
     m_ndkSession.SessionAdapter.Resume();
     SessionStatus = ARSessionStatus.RESUMED;
 }