Example #1
0
        public Vector3[] GetHandSkeletonData(IntPtr handHandle)
        {
            int    skeletonCount  = GetHandSkeletonCount(handHandle);
            IntPtr skeletonHandle = IntPtr.Zero;

            NDKAPI.HwArHand_getHandSkeletonArray(m_ndkSession.SessionHandle, handHandle, ref skeletonHandle);
            //if native returned camera coordinate, do not negative z,
            //since the camera coordinate in opengl and unity are the same, which is right hand
            if (ARCoordinateSystemType.COORDINATE_SYSTEM_TYPE_3D_CAMERA ==
                GetSkeletonCoordinateSystemType(handHandle))
            {
                return(MarshalingHelper.GetArrayOfUnmanagedArrayElement <Vector3>(skeletonHandle, skeletonCount));
            }
            //otherwise negative z,
            //since the world and model coordinate in opengl and unity are converse
            //and z value in image coordinate is useless
            else
            {
                Vector3[] ret = new Vector3[skeletonCount];
                for (int i = 0; i < skeletonCount; i++)
                {
                    Vector3 vector = new Vector3();
                    vector.x = MarshalingHelper.GetValueOfUnmanagedArrayElement <float>(skeletonHandle, 3 * i);
                    vector.y = MarshalingHelper.GetValueOfUnmanagedArrayElement <float>(skeletonHandle, 3 * i + 1);
                    vector.z = -MarshalingHelper.GetValueOfUnmanagedArrayElement <float>(skeletonHandle, 3 * i + 2);
                    ret[i]   = vector;
                }
                return(ret);
            }
        }
Example #2
0
        public int[] GetHandSkeletonType(IntPtr handHandle)
        {
            int    skeletonCount = GetHandSkeletonCount(handHandle);
            IntPtr typeHandle    = IntPtr.Zero;

            NDKAPI.HwArHand_getHandSkeletonType(m_ndkSession.SessionHandle, handHandle, ref typeHandle);
            return(MarshalingHelper.GetArrayOfUnmanagedArrayElement <int>(typeHandle, skeletonCount));
        }
Example #3
0
        public int[] GetSkeletonType(IntPtr bodyHandle)
        {
            int    skeletonCnt = GetSkeletonPointCount(bodyHandle);
            IntPtr typeHandle  = IntPtr.Zero;

            NDKAPI.HwArBody_getSkeletonTypes(m_ndkSession.SessionHandle, bodyHandle, ref typeHandle);
            return(MarshalingHelper.GetArrayOfUnmanagedArrayElement <int>(typeHandle, skeletonCnt));
        }
        public float[] GetSkeletonConfidence(IntPtr bodyHandle)
        {
            int    skeletonCnt = GetSkeletonPointCount(bodyHandle);
            IntPtr skeletonConfidenceHandle = IntPtr.Zero;

            NDKAPI.HwArBody_getSkeletonConfidence(m_ndkSession.SessionHandle, bodyHandle, ref skeletonConfidenceHandle);
            return(MarshalingHelper.GetArrayOfUnmanagedArrayElement <float>(skeletonConfidenceHandle, skeletonCnt));
        }
Example #5
0
        public Vector3[] GetSkeletonPoint2D(IntPtr bodyHandle)
        {
            int    skeletonCnt      = GetSkeletonPointCount(bodyHandle);
            IntPtr skeleton2DHandle = IntPtr.Zero;

            NDKAPI.HwArBody_getSkeletonPoint2D(m_ndkSession.SessionHandle, bodyHandle,
                                               ref skeleton2DHandle);
            return(MarshalingHelper.GetArrayOfUnmanagedArrayElement <Vector3>(skeleton2DHandle, skeletonCnt));
        }
Example #6
0
        public float[] GetParameterValueArray(IntPtr trackableHandle)
        {
            int count = 0;

            NDKAPI.HwArTrackable_getParameterCount(m_ndkSession.SessionHandle, trackableHandle, ref count);
            IntPtr data = IntPtr.Zero;

            NDKAPI.HwArTrackable_getParameterValueArray(m_ndkSession.SessionHandle, trackableHandle, ref data);
            return(MarshalingHelper.GetArrayOfUnmanagedArrayElement <float>(data, count));
        }
Example #7
0
        public int[] GetGestureAction(IntPtr handHandle)
        {
            int actionCount = 0;

            NDKAPI.HwArHand_getGestureActionSize(m_ndkSession.SessionHandle, handHandle, ref actionCount);
            IntPtr actionDataHandle = IntPtr.Zero;

            NDKAPI.HwArHand_getGestureAction(m_ndkSession.SessionHandle, handHandle, ref actionDataHandle);
            return(MarshalingHelper.GetArrayOfUnmanagedArrayElement <int>(actionDataHandle, actionCount));
        }
Example #8
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));
        }
        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));
        }
Example #11
0
        public int[] GetParameterTypeArray(IntPtr trackableHandle)
        {
            int count = 0;

            NDKAPI.HwArTrackable_getParameterCount(m_ndkSession.SessionHandle, trackableHandle, ref count);

            IntPtr types = IntPtr.Zero;

            NDKAPI.HwArTrackable_getParameterTypeArray(m_ndkSession.SessionHandle, trackableHandle, ref types);
            int[] dataArray = new int[count];
            if (types == null)
            {
                return(dataArray);
            }

            if (dataArray == null)
            {
                return(dataArray);
            }

            return(MarshalingHelper.GetArrayOfUnmanagedArrayElement <int>(types, count));
        }