public ARFaceGeometry.Label[] GetTriangleLabels(IntPtr geometryHandle)
        {
            int count = 0;

            NDKAPI.HwArFaceGeometry_getTriangleLabelsSize(m_ndkSession.SessionHandle, geometryHandle, ref count);
            if (!ValueLegalityChecker.CheckInt("GetTriangleLabels: count", count, 0))
            {
                return(new ARFaceGeometry.Label[0]);
            }
            ARFaceGeometry.Label[] ret = new ARFaceGeometry.Label[count];
            IntPtr triangleLabelHandle = IntPtr.Zero;

            NDKAPI.HwArFaceGeometry_acquireTriangleLabels(m_ndkSession.SessionHandle, geometryHandle,
                                                          ref triangleLabelHandle);
            for (int i = 0; i < count; i++)
            {
                int val = MarshalingHelper.GetValueOfUnmanagedArrayElement <int>(triangleLabelHandle, i);
                if (!ValueLegalityChecker.CheckInt("GetTriangleLabels: value", val,
                                                   AdapterConstants.Enum_FaceLabel_MinIntValue,
                                                   AdapterConstants.Enum_FaceLabel_MaxIntValue - 1))
                {
                    ret[i] = ARFaceGeometry.Label.Label_Non_Face;
                }
                else
                {
                    ret[i] = (ARFaceGeometry.Label)val;
                }
            }
            return(ret);
        }
        public int[] GetTriangleIndex(IntPtr geometryHandle)
        {
            int count = 0;

            NDKAPI.HwArFaceGeometry_getTriangleIndicesSize(m_ndkSession.SessionHandle, geometryHandle, ref count);
            if (!ValueLegalityChecker.CheckInt("GetTriangleIndex", count, 0))
            {
                return(new int[0]);
            }
            IntPtr triangleIndexHandle = IntPtr.Zero;

            NDKAPI.HwArFaceGeometry_acquireTriangleIndices(m_ndkSession.SessionHandle, geometryHandle,
                                                           ref triangleIndexHandle);
            //int[] ret = new int[count];
            //for (int i = 0; i < count; i++)
            //{
            //    ret[i] = MarshalingHelper.GetValueOfUnmanagedArrayElement<int>(triangleIndexHandle, i) / 3;
            //}

            int[] ret = new int[count];
            for (int i = 0; i < count; i += 3)
            {
                ret[i]     = MarshalingHelper.GetValueOfUnmanagedArrayElement <int>(triangleIndexHandle, i + 2);
                ret[i + 1] = MarshalingHelper.GetValueOfUnmanagedArrayElement <int>(triangleIndexHandle, i + 1);
                ret[i + 2] = MarshalingHelper.GetValueOfUnmanagedArrayElement <int>(triangleIndexHandle, i);
            }
            return(ret);
        }
        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.º 4
0
        public int GetHandSkeletonCount(IntPtr handHandle)
        {
            int count = 0;

            NDKAPI.HwArHand_getHandSkeletonCount(m_ndkSession.SessionHandle, handHandle, ref count);
            if (!ValueLegalityChecker.CheckInt("getHandSkeletonCount", count, 0))
            {
                return(0);
            }
            return(count);
        }
        public int GetTriangleCount(IntPtr geometryHandle)
        {
            int count = 0;

            NDKAPI.HwArFaceGeometry_getTriangleCount(m_ndkSession.SessionHandle, geometryHandle, ref count);
            if (!ValueLegalityChecker.CheckInt("GetTriangleCount", count, 0))
            {
                return(0);
            }
            return(count);
        }
Exemplo n.º 6
0
        public int GetSkeletonPointCount(IntPtr bodyHandle)
        {
            int pointCount = 0;

            NDKAPI.HwArBody_getSkeletonPointCount(m_ndkSession.SessionHandle, bodyHandle, ref pointCount);
            if (!ValueLegalityChecker.CheckInt("GetSkeletonPointCount", pointCount, 0))
            {
                return(0);
            }
            return(pointCount);
        }
        public ARTrackable.TrackingState GetTrackingState(IntPtr cameraHandle)
        {
            int state = (int)ARTrackable.TrackingState.STOPPED;

            NDKAPI.HwArCamera_getTrackingState(m_ndkSession.SessionHandle, cameraHandle, ref state);
            if (!ValueLegalityChecker.CheckInt("GetTrackingState", state,
                                               AdapterConstants.Enum_TrackingState_MinIntValue, AdapterConstants.Enum_TrackingState_MaxIntValue))
            {
                return(ARTrackable.TrackingState.STOPPED);
            }
            return((ARTrackable.TrackingState)state);
        }
Exemplo n.º 8
0
        public ARHand.HandType GetHandType(IntPtr handHandle)
        {
            int ret = 0;

            NDKAPI.HwArHand_getHandType(m_ndkSession.SessionHandle, handHandle, ref ret);
            if (!ValueLegalityChecker.CheckInt("GetHandType", ret,
                                               AdapterConstants.Enum_HandType_MinIntValue, AdapterConstants.Enum_HandType_MaxIntValue))
            {
                return(ARHand.HandType.UNKNOWN);
            }
            return((ARHand.HandType)ret);
        }
Exemplo n.º 9
0
        public int GetGustureType(IntPtr handHandle)
        {
            int ret = 0;

            NDKAPI.HwArHand_getGestureType(m_ndkSession.SessionHandle, handHandle, ref ret);
            //-1 is the min value of gusture type, and it means unknown type
            if (!ValueLegalityChecker.CheckInt("getGestureType", ret, -1))
            {
                return(-1);
            }
            return(ret);
        }
Exemplo n.º 10
0
        public ARCoordinateSystemType GetGestureCoordinateSystemType(IntPtr handHandle)
        {
            int ret = 0;

            NDKAPI.HwArHand_getGestureCoordinateSystem(m_ndkSession.SessionHandle, handHandle, ref ret);
            if (!ValueLegalityChecker.CheckInt("GetGestureCoordinateSystemType", ret,
                                               AdapterConstants.Enum_CoordSystem_MinIntValue, AdapterConstants.Enum_CoordSystem_MaxIntValue))
            {
                return(ARCoordinateSystemType.COORDINATE_SYSTEM_TYPE_2D_IMAGE);
            }
            return((ARCoordinateSystemType)ret);
        }
Exemplo n.º 11
0
        public ARCoordinateSystemType GetSkeletonCoordinateSystemType(IntPtr handHandle)
        {
            int type = 0;

            NDKAPI.HwArHand_getSkeletonCoordinateSystem(m_ndkSession.SessionHandle, handHandle, ref type);
            if (!ValueLegalityChecker.CheckInt("getSkeletonCoordinateSystem", type,
                                               AdapterConstants.Enum_CoordSystem_MinIntValue, AdapterConstants.Enum_CoordSystem_MaxIntValue))
            {
                return(ARCoordinateSystemType.COORDINATE_SYSTEM_TYPE_3D_CAMERA);
            }
            return((ARCoordinateSystemType)type);
        }
Exemplo n.º 12
0
        public ARAlignState GetAlignState()
        {
            int ret = (int)ARAlignState.NONE;

            NDKAPI.HwArFrame_getAlignState(m_ndkSession.SessionHandle, m_ndkSession.FrameHandle, ref ret);
            if (!ValueLegalityChecker.CheckInt("GetAlignState", ret,
                                               AdapterConstants.Enum_ARAlignState_MinIntValue, AdapterConstants.Enum_ARAlignState_MaxIntValue))
            {
                return(ARAlignState.FAILED);
            }
            return((ARAlignState)ret);
        }
Exemplo n.º 13
0
        public ARCoordinateSystemType GetCoordinateSystemType(IntPtr bodyHandle)
        {
            int type = (int)ARCoordinateSystemType.COORDINATE_SYSTEM_TYPE_UNKNOWN;

            NDKAPI.HwArBody_getCoordinateSystemType(m_ndkSession.SessionHandle, bodyHandle, ref type);
            if (!ValueLegalityChecker.CheckInt("GetCoordinateSystemType", type,
                                               AdapterConstants.Enum_CoordSystem_MinIntValue, AdapterConstants.Enum_CoordSystem_MaxIntValue))
            {
                return(ARCoordinateSystemType.COORDINATE_SYSTEM_TYPE_2D_IMAGE);
            }
            return((ARCoordinateSystemType)type);
        }
Exemplo n.º 14
0
        public Vector2Int[] GetSkeletonConnection(IntPtr handHandle)
        {
            int    connectionArraySize = 0;
            IntPtr connectionHandle    = IntPtr.Zero;

            NDKAPI.HwArHand_getHandSkeletonConnectionSize(m_ndkSession.SessionHandle, handHandle, ref connectionArraySize);
            if (!ValueLegalityChecker.CheckInt("GetSkeletonConnection", connectionArraySize, 0))
            {
                return(new Vector2Int[0]);
            }
            NDKAPI.HwArHand_getHandSkeletonConnection(m_ndkSession.SessionHandle, handHandle, ref connectionHandle);
            return(MarshalingHelper.GetArrayOfUnmanagedArrayElement <Vector2Int>(connectionHandle, connectionArraySize / 2));
        }
        public Vector2[] GetTexCoord(IntPtr geometryHandle)
        {
            int count = 0;

            NDKAPI.HwArFaceGeometry_getTexCoordSize(m_ndkSession.SessionHandle, geometryHandle, ref count);
            if (!ValueLegalityChecker.CheckInt("GetTexCoord", count, 0))
            {
                return(new Vector2[0]);
            }
            IntPtr texcoordHandle = IntPtr.Zero;

            NDKAPI.HwArFaceGeometry_acquireTexCoord(m_ndkSession.SessionHandle, geometryHandle, ref texcoordHandle);
            return(MarshalingHelper.GetArrayOfUnmanagedArrayElement <Vector2>(texcoordHandle, count / 2));
        }
Exemplo n.º 16
0
        public ARWorldMappingState GetMappingState()
        {
            int ret = (int)ARWorldMappingState.NOT_AVAILABLE;

            NDKAPI.HwArFrame_getMappingState(m_ndkSession.SessionHandle, m_ndkSession.FrameHandle, ref ret);
            ARDebug.LogError("NDK world map status " + ret);
            if (!ValueLegalityChecker.CheckInt("GetMappingState", ret,
                                               AdapterConstants.Enum_ARWorldMappingState_MinIntValue,
                                               AdapterConstants.Enum_ARWorldMappingState_MaxIntValue))
            {
                return(ARWorldMappingState.NOT_AVAILABLE);
            }
            return((ARWorldMappingState)ret);
        }
Exemplo n.º 17
0
        public int[] GetSkeletonConnection(IntPtr bodyHandle)
        {
            int connectionArraySize = 0;

            NDKAPI.HwArBody_getSkeletonConnectionSize(m_ndkSession.SessionHandle, bodyHandle, ref connectionArraySize);
            if (!ValueLegalityChecker.CheckInt("GetSkeletonConnection", connectionArraySize, 0))
            {
                return(new int[0]);
            }
            IntPtr connectionHandle = IntPtr.Zero;

            NDKAPI.HwArBody_getSkeletonConnection(m_ndkSession.SessionHandle, bodyHandle,
                                                  ref connectionHandle);
            return(MarshalingHelper.GetArrayOfUnmanagedArrayElement <int>(connectionHandle, connectionArraySize));
        }
Exemplo n.º 18
0
        public Vector3[] GetVertexNormals(IntPtr sceneMeshHandle)
        {
            int count = 0;

            NDKAPI.HwArSceneMesh_getVerticesSize(m_ndkSession.SessionHandle, sceneMeshHandle, ref count);
            if (!ValueLegalityChecker.CheckInt("GetVertices", count, 0))
            {
                return(new Vector3[0]);
            }

            IntPtr vertexNormalsHandle = IntPtr.Zero;

            NDKAPI.HwArSceneMesh_acquireVertexNormals(m_ndkSession.SessionHandle, sceneMeshHandle, ref vertexNormalsHandle);
            Vector3[] ret = new Vector3[count / 3];
            for (int i = 0; i < count / 3; i++)
            {
                ret[i]   = new Vector3();
                ret[i].x = MarshalingHelper.GetValueOfUnmanagedArrayElement <float>(vertexNormalsHandle, 3 * i);
                ret[i].y = MarshalingHelper.GetValueOfUnmanagedArrayElement <float>(vertexNormalsHandle, 3 * i + 1);
                ret[i].z = MarshalingHelper.GetValueOfUnmanagedArrayElement <float>(vertexNormalsHandle, 3 * i + 2);
            }
            return(ret);
        }