public static ReturnStatus DestroyScene(ref INTERACTION_SCENE scene)
        {
            var rs = LeapIEDestroyScene(ref scene);

            Logger.HandleReturnStatus("Destroy Scene", LogLevel.Info, rs);
            return(rs);
        }
        public static ReturnStatus GetShapeInstanceResults(ref INTERACTION_SCENE scene,
                                                           List <INTERACTION_SHAPE_INSTANCE_RESULTS> results)
        {
            UInt32 nResults;
            IntPtr papResultsBuffer;
            var    rs = LeapIEGetShapeInstanceResults(ref scene,
                                                      out nResults,
                                                      out papResultsBuffer);

            results.Clear();
            if (rs == ReturnStatus.Success)
            {
                for (int i = 0; i < nResults; i++)
                {
                    IntPtr resultPtr;
                    StructMarshal <IntPtr> .ArrayElementToStruct(papResultsBuffer, i, out resultPtr);

                    INTERACTION_SHAPE_INSTANCE_RESULTS result;
                    StructMarshal <INTERACTION_SHAPE_INSTANCE_RESULTS> .PtrToStruct(resultPtr, out result);

                    results.Add(result);
                }
            }

            Logger.HandleReturnStatus(scene, "Get Velocities", LogLevel.AllCalls, rs);
            return(rs);
        }
Exemple #3
0
        public static void HandleReturnStatus(INTERACTION_SCENE scene, string methodName, LogLevel methodLevel, ReturnStatus rs)
        {
            IntPtr messagePtr;

            InteractionC.GetLastError(ref scene, out messagePtr);
            handleReturnStatusInternal(methodName, methodLevel, rs, messagePtr);
        }
        public static ReturnStatus RemoveShapeDescription(ref INTERACTION_SCENE scene,
                                                          ref INTERACTION_SHAPE_DESCRIPTION_HANDLE handle)
        {
            var rs = LeapIERemoveShapeDescription(ref scene, ref handle);

            Logger.HandleReturnStatus(scene, "Remove Shape Description", LogLevel.CreateDestroy, rs);
            return(rs);
        }
        public static ReturnStatus UpdateController(ref INTERACTION_SCENE scene,
                                                    ref INTERACTION_TRANSFORM controllerTransform)
        {
            var rs = LeapIEUpdateController(ref scene, ref controllerTransform);

            Logger.HandleReturnStatus(scene, "Update Controller", LogLevel.AllCalls, rs);
            return(rs);
        }
        public static ReturnStatus GetLastError(ref INTERACTION_SCENE scene,
                                                out IntPtr messagePtr)
        {
            ReturnStatus rs = GetLastError(ref scene);

            messagePtr = GetLastErrorString();
            return(rs);
        }
        public static ReturnStatus UpdateSceneInfo(ref INTERACTION_SCENE scene,
                                                   ref INTERACTION_SCENE_INFO sceneInfo)
        {
            var rs = LeapIEUpdateSceneInfo(ref scene, ref sceneInfo);

            Logger.HandleReturnStatus(scene, "Update Scene Info", LogLevel.Info, rs);
            return(rs);
        }
        public static ReturnStatus EnableDebugFlags(ref INTERACTION_SCENE scene,
                                                    UInt32 flags)
        {
            var rs = LeapIEEnableDebugFlags(ref scene, flags);

            Logger.HandleReturnStatus(scene, "Enable Debug Flags", LogLevel.Info, rs);
            return(rs);
        }
        public static ReturnStatus DestroyShapeInstance(ref INTERACTION_SCENE scene,
                                                        ref INTERACTION_SHAPE_INSTANCE_HANDLE instance)
        {
            var rs = LeapIEDestroyShapeInstance(ref scene, ref instance);

            Logger.HandleReturnStatus(scene, "Destroy Shape Instance", LogLevel.CreateDestroy, rs);
            return(rs);
        }
        public static ReturnStatus UpdateHands(ref INTERACTION_SCENE scene,
                                               UInt32 nHands,
                                               IntPtr pHands)
        {
            var rs = LeapIEUpdateHands(ref scene, nHands, pHands);

            Logger.HandleReturnStatus(scene, "Update Hands", LogLevel.AllCalls, rs);
            return(rs);
        }
        public static ReturnStatus AddShapeDescription(ref INTERACTION_SCENE scene,
                                                       IntPtr pDescription,
                                                       out INTERACTION_SHAPE_DESCRIPTION_HANDLE handle)
        {
            var rs = LeapIEAddShapeDescription(ref scene, pDescription, out handle);

            Logger.HandleReturnStatus(scene, "Add Shape Description", LogLevel.CreateDestroy, rs);
            return(rs);
        }
        public static ReturnStatus OverrideHandResult(ref INTERACTION_SCENE scene,
                                                      UInt32 handId,
                                                      ref INTERACTION_HAND_RESULT handResult)
        {
            var rs = LeapIEOverrideHandResult(ref scene, handId, ref handResult);

            Logger.HandleReturnStatus(scene, "Override Hand Result", LogLevel.AllCalls, rs);
            return(rs);
        }
        public static ReturnStatus UpdateShapeInstance(ref INTERACTION_SCENE scene,
                                                       ref INTERACTION_TRANSFORM transform,
                                                       ref INTERACTION_UPDATE_SHAPE_INFO updateInfo,
                                                       ref INTERACTION_SHAPE_INSTANCE_HANDLE instance)
        {
            var rs = LeapIEUpdateShapeInstance(ref scene, ref transform, ref updateInfo, ref instance);

            Logger.HandleReturnStatus(scene, "Update Shape Instance", LogLevel.AllCalls, rs);
            return(rs);
        }
        public static ReturnStatus CreateShapeInstance(ref INTERACTION_SCENE scene,
                                                       ref INTERACTION_SHAPE_DESCRIPTION_HANDLE handle,
                                                       ref INTERACTION_TRANSFORM transform,
                                                       ref INTERACTION_CREATE_SHAPE_INFO shapeInfo,
                                                       out INTERACTION_SHAPE_INSTANCE_HANDLE instance)
        {
            var rs = LeapIECreateShapeInstance(ref scene, ref handle, ref transform, ref shapeInfo, out instance);

            Logger.HandleReturnStatus(scene, "Create Shap eInstance", LogLevel.CreateDestroy, rs);
            return(rs);
        }
        public static ReturnStatus GetDebugLines(ref INTERACTION_SCENE scene,
                                                 List <INTERACTION_DEBUG_LINE> lines)
        {
            UInt32 lineCount;
            IntPtr arrayPtr;
            var    rs = LeapIEGetDebugLines(ref scene, out lineCount, out arrayPtr);

            lines.Clear();
            for (int i = 0; i < lineCount; i++)
            {
                INTERACTION_DEBUG_LINE line;
                StructMarshal <INTERACTION_DEBUG_LINE> .ArrayElementToStruct(arrayPtr, i, out line);

                lines.Add(line);
            }

            return(rs);
        }
        public static ReturnStatus GetDebugStrings(ref INTERACTION_SCENE scene,
                                                   List <string> strings)
        {
            UInt32 nStrings;
            IntPtr pppStrings;
            var    rs = LeapIEGetDebugStrings(ref scene, out nStrings, out pppStrings);

            strings.Clear();
            if (rs == ReturnStatus.Success)
            {
                for (int i = 0; i < nStrings; i++)
                {
                    IntPtr charPtr;
                    StructMarshal <IntPtr> .ArrayElementToStruct(pppStrings, i, out charPtr);

                    string str = Marshal.PtrToStringAnsi(charPtr);
                    strings.Add(str);
                }
            }

            Logger.HandleReturnStatus(scene, "Get Debug Strings", LogLevel.AllCalls, rs);
            return(rs);
        }
 private static extern ReturnStatus LeapIEGetDebugLines(ref INTERACTION_SCENE scene,
                                                        out UInt32 nLines,
                                                        out IntPtr ppLineBuffer);
 private static extern ReturnStatus LeapIEUpdateSceneInfo(ref INTERACTION_SCENE scene,
                                                          ref INTERACTION_SCENE_INFO sceneInfo);
 private static extern ReturnStatus LeapIEEnableDebugFlags(ref INTERACTION_SCENE scene,
                                                           UInt32 flags);
 public static extern ReturnStatus GetLastError(ref INTERACTION_SCENE scene);
 private static extern ReturnStatus LeapIEGetShapeInstanceResults(ref INTERACTION_SCENE scene,
                                                                  out UInt32 nResults,
                                                                  out IntPtr papResultsBuffer);
 private static extern ReturnStatus LeapIEUpdateShapeInstance(ref INTERACTION_SCENE scene,
                                                              ref INTERACTION_TRANSFORM transform,
                                                              ref INTERACTION_UPDATE_SHAPE_INFO updateInfo,
                                                              ref INTERACTION_SHAPE_INSTANCE_HANDLE instance);
 private static extern ReturnStatus LeapIEOverrideHandResult(ref INTERACTION_SCENE scene,
                                                             UInt32 handId,
                                                             ref INTERACTION_HAND_RESULT handResult);
 private static extern ReturnStatus LeapIERemoveShapeDescription(ref INTERACTION_SCENE scene,
                                                                 ref INTERACTION_SHAPE_DESCRIPTION_HANDLE handle);
 private static extern ReturnStatus LeapIEUpdateController(ref INTERACTION_SCENE scene,
                                                           ref INTERACTION_TRANSFORM controllerTransform);
 private static extern ReturnStatus LeapIECreateShapeInstance(ref INTERACTION_SCENE scene,
                                                              ref INTERACTION_SHAPE_DESCRIPTION_HANDLE handle,
                                                              ref INTERACTION_TRANSFORM transform,
                                                              ref INTERACTION_CREATE_SHAPE_INFO shapeInfo,
                                                              out INTERACTION_SHAPE_INSTANCE_HANDLE instance);
 private static extern ReturnStatus LeapIEUpdateHands(ref INTERACTION_SCENE scene,
                                                      UInt32 nHands,
                                                      IntPtr pHands);
 private static extern ReturnStatus LeapIEGetDebugStrings(ref INTERACTION_SCENE scene,
                                                          out UInt32 nStrings,
                                                          out IntPtr pppStrings);
 private static extern ReturnStatus LeapIEAddShapeDescription(ref INTERACTION_SCENE scene,
                                                              IntPtr pDescription,
                                                              out INTERACTION_SHAPE_DESCRIPTION_HANDLE handle);
 private static extern ReturnStatus LeapIEDestroyShapeInstance(ref INTERACTION_SCENE scene,
                                                               ref INTERACTION_SHAPE_INSTANCE_HANDLE instance);