示例#1
0
        public static void Main(string[] args)
        {
            OSVR.ClientKit.ClientContext context = new OSVR.ClientKit.ClientContext("org.opengoggles.exampleclients.managed.TrackerCallback");

            // This is just one of the paths. You can also use:
            // /me/hands/right
            // /me/head
            Interface lefthand = context.getInterface("/me/hands/left");

            TrackerCallbacks callbacks = new TrackerCallbacks();

            // The coordinate system is right-handed, withX to the right, Y up, and Z near.
            OSVR.ClientKit.PoseCallback poseCb = new PoseCallback(TrackerCallbacks.myTrackerCallback);
            lefthand.registerCallback(poseCb, IntPtr.Zero);

            // If you just want orientation
            OSVR.ClientKit.OrientationCallback oriCb = new OrientationCallback(TrackerCallbacks.myOrientationCallback);
            lefthand.registerCallback(oriCb, IntPtr.Zero);

            // or position
            OSVR.ClientKit.PositionCallback posCb = new PositionCallback(TrackerCallbacks.myPositionCallback);
            lefthand.registerCallback(posCb, IntPtr.Zero);

            // Pretend that this is your application's main loop
            for (int i = 0; i < 1000000; ++i)
            {
                context.update();
            }

            Console.WriteLine("Library shut down; exiting.");
        }
 public void RegisterCallback(PoseCallback callback)
 {
     Start(); // make sure the interface is initialized.
     if (null == poseCallbacks)
     {
         poseCallbacks   = callback;
         rawPoseCallback = new OSVR.ClientKit.PoseCallback(PoseCb);
         iface.registerCallback(rawPoseCallback, System.IntPtr.Zero);
     }
     else
     {
         poseCallbacks += callback;
     }
 }
示例#3
0
 /// @brief Register a callback for some report type.
 public void registerCallback(PoseCallback cb, IntPtr /*void*/ userdata)
 {
     osvrRegisterPoseCallback(m_interface, cb, userdata);
 }
示例#4
0
 public extern static Byte osvrRegisterPoseCallback(SafeClientInterfaceHandle iface, PoseCallback cb, IntPtr /*void**/ userdata);
示例#5
0
 protected override void Start()
 {
     cb = new PoseCallback(this.InterfaceCallback);
     Interface.osvrRegisterPoseCallback(iface.Handle, cb, IntPtr.Zero);
 }
示例#6
0
 public static extern Byte osvrRegisterPoseCallback(SafeClientInterfaceHandle iface, PoseCallback cb, IntPtr /*void**/ userdata);
示例#7
0
 /// @brief Register a callback for some report type.
 public void registerCallback(PoseCallback cb, IntPtr /*void*/ userdata)
 {
     osvrRegisterPoseCallback(m_interface, cb, userdata);
 }
示例#8
0
 public extern static Byte osvrRegisterPoseCallback(IntPtr /*OSVR_ClientInterface*/ iface, PoseCallback cb, IntPtr /*void**/ userdata);
 public void RegisterCallback(PoseCallback callback)
 {
     Start(); // make sure the interface is initialized.
     if (null == poseCallbacks)
     {
         poseCallbacks = callback;
         rawPoseCallback = new OSVR.ClientKit.PoseCallback(PoseCb);
         iface.registerCallback(rawPoseCallback, System.IntPtr.Zero);
     }
     else
     {
         poseCallbacks += callback;
     }
 }