Exemplo n.º 1
0
        //device情報を取得する
        public bool GetPropertyUint64(uint idx, ETrackedDeviceProperty prop, out ulong result)
        {
            ETrackedPropertyError error = new ETrackedPropertyError();

            result = openvr.GetUint64TrackedDeviceProperty(idx, prop, ref error);
            return(error == ETrackedPropertyError.TrackedProp_Success);
        }
Exemplo n.º 2
0
        public bool Initialize()
        {
            if (!m_initialized)
            {
                EVRInitError l_initError = EVRInitError.None;
                m_vrSystem = OpenVR.Init(ref l_initError, EVRApplicationType.VRApplication_Overlay);
                if (l_initError == EVRInitError.None)
                {
                    OpenVR.Overlay.CreateOverlay("leap.control.notification", "Ultraleap Control", ref m_notificationOverlay);

                    // Find fake Leap Motion station device
                    for (uint i = 0; i < OpenVR.k_unMaxTrackedDeviceCount; i++)
                    {
                        ETrackedPropertyError l_propertyError = ETrackedPropertyError.TrackedProp_Success;
                        ulong l_property = m_vrSystem.GetUint64TrackedDeviceProperty(i, ETrackedDeviceProperty.Prop_VendorSpecific_Reserved_Start, ref l_propertyError);
                        if ((l_propertyError == ETrackedPropertyError.TrackedProp_Success) && (l_property == 0x4C4D6F74696F6E))
                        {
                            m_leapDevice = i;
                            break;
                        }
                    }

                    m_initialized = true;
                    m_active      = true;
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("Unable to initialize OpenVR: " + Valve.VR.OpenVR.GetStringForHmdError(l_initError), "Driver Leap Control");
                }
            }

            return(m_initialized);
        }