private void updateInteractionModeAndGazeTriggerType() { if (this.OverrideSystemSettings) { if ((this.InteractionMode_User != this.CustomInputModule) || (this.preOverrideSystemSettings != this.OverrideSystemSettings)) { if (this.InteractionMode_User != this.CustomInputModule) { this.InteractionMode_User = this.CustomInputModule; PrintDebugLog("updateInteractionModeAndGazeTriggerType() Set interaction mode " + this.InteractionMode_User + " due to CustomInputModule changed."); } if (this.preOverrideSystemSettings != this.OverrideSystemSettings) { this.preOverrideSystemSettings = this.OverrideSystemSettings; PrintDebugLog("updateInteractionModeAndGazeTriggerType() Set interaction mode " + this.InteractionMode_User + " due to OverrideSystemSettings changed."); } if (!Application.isEditor) { WVR_InteractionMode _mode = (this.InteractionMode_User == WaveVR_EInputModule.Controller) ? WVR_InteractionMode.WVR_InteractionMode_Controller : WVR_InteractionMode.WVR_InteractionMode_Gaze; Interop.WVR_SetInteractionMode(_mode); } } updateGazeTriggerType_User(); if (this.gazeTriggerType_User_pre != this.gazeTriggerType_User) { this.gazeTriggerType_User_pre = this.gazeTriggerType_User; if (!Application.isEditor) { Interop.WVR_SetGazeTriggerType(this.gazeTriggerType_User); } PrintDebugLog("updateInteractionModeAndGazeTriggerType() Gaze Trigger - User: " + this.gazeTriggerType_User_pre); } updateInputModuleByCustomSettings(); } else { if (this.preOverrideSystemSettings != this.OverrideSystemSettings) { this.preOverrideSystemSettings = this.OverrideSystemSettings; // Restore runtime mirror system setting. if (!Application.isEditor) { Interop.WVR_SetInteractionMode(WVR_InteractionMode.WVR_InteractionMode_SystemDefault); } } if (!Application.isEditor) { this.InteractionMode_System = Interop.WVR_GetInteractionMode(); this.gazeTriggerType_System = Interop.WVR_GetGazeTriggerType(); } updateInputModuleBySystemSetting(); } }
private void updateGazeTriggerType_System(WVR_GazeTriggerType type) { if (gazeTriggerType_System != type) { if (gazeTriggerType_User != type) { gazeTriggerType_System = type; } } }
private void initInteractionModeAndGazeTriggerType() { this.preOverrideSystemSettings = this.OverrideSystemSettings; this.InteractionMode_User = this.CustomInputModule; updateGazeTriggerType_User(); // set gazeTriggerType_User if (this.OverrideSystemSettings) { if (!Application.isEditor) { // Get default system settings. this.InteractionMode_System = Interop.WVR_GetInteractionMode(); this.gazeTriggerType_System = Interop.WVR_GetGazeTriggerType(); WVR_InteractionMode _mode = (this.InteractionMode_User == WaveVR_EInputModule.Controller) ? WVR_InteractionMode.WVR_InteractionMode_Controller : WVR_InteractionMode.WVR_InteractionMode_Gaze; // Change system settings to user settings. Interop.WVR_SetInteractionMode(_mode); Interop.WVR_SetGazeTriggerType(this.gazeTriggerType_User); this.gazeTriggerType_User_pre = this.gazeTriggerType_User; } // Initialize by user settings. initializeInputModuleByCustomSettings(); } else { if (!Application.isEditor) { // Reset runtime settings to system default if no override. Interop.WVR_SetInteractionMode(WVR_InteractionMode.WVR_InteractionMode_SystemDefault); // Get default system settings. this.InteractionMode_System = Interop.WVR_GetInteractionMode(); this.gazeTriggerType_System = Interop.WVR_GetGazeTriggerType(); } // Initialize by system settings. initializeInputModuleBySystemSetting(); } this.InteractionMode_Current = GetInteractionMode(); PrintDebugLog("initInteractionModeAndGazeTriggerType() OverrideSystemSettings: " + OverrideSystemSettings); PrintDebugLog("initInteractionModeAndGazeTriggerType() Interaction Mode - System: " + this.InteractionMode_System + ", User: "******", Current: " + this.InteractionMode_Current); PrintDebugLog("initInteractionModeAndGazeTriggerType() Gaze Trigger - System: " + this.gazeTriggerType_System + ", User: " + this.gazeTriggerType_User); }
private void updateGazeTriggerType_User() { // Sync user settings of gaze trigger type if (Gaze.BtnControl) { if (Gaze.WithTimeGaze) { gazeTriggerType_User = WVR_GazeTriggerType.WVR_GazeTriggerType_TimeoutButton; // PrintDebugLog("[User Settings] Sync gaze trigger type to WVR_GazeTriggerType_TimeoutButton!"); } else { gazeTriggerType_User = WVR_GazeTriggerType.WVR_GazeTriggerType_Button; // PrintDebugLog("[User Settings] Sync gaze trigger type to WVR_GazeTriggerType_Button!"); } } else { gazeTriggerType_User = WVR_GazeTriggerType.WVR_GazeTriggerType_Timeout; // PrintDebugLog("[User Settings] Sync gaze trigger type to WVR_GazeTriggerType_Timeout!"); } }
private void updateGazeTriggerType_User() { // Sync user settings of gaze trigger type if (Gaze.ButtonControl) { if (Gaze.TimerControl) { gazeTriggerType_User = WVR_GazeTriggerType.WVR_GazeTriggerType_TimeoutButton; // DEBUG("[User Settings] Sync gaze trigger type to WVR_GazeTriggerType_TimeoutButton!"); } else { gazeTriggerType_User = WVR_GazeTriggerType.WVR_GazeTriggerType_Button; // DEBUG("[User Settings] Sync gaze trigger type to WVR_GazeTriggerType_Button!"); } } else { gazeTriggerType_User = WVR_GazeTriggerType.WVR_GazeTriggerType_Timeout; // DEBUG("[User Settings] Sync gaze trigger type to WVR_GazeTriggerType_Timeout!"); } }
public override bool SetGazeTriggerType(WVR_GazeTriggerType type) { return(WVR_SetGazeTriggerType_Android(type)); }
public static extern bool WVR_SetGazeTriggerType_Android(WVR_GazeTriggerType type);
public void UpdateEachFrame(WVR_PoseOriginModel origin, bool isSimulator) { if (!this.Initialized) { return; } if (Log.gpl.Print) { PrintDebugLog("UpdateEachFrame()"); } bool _focusCapturedBySystem = Interop.WVR_IsInputFocusCapturedBySystem(); if (this.FocusCapturedBySystem != _focusCapturedBySystem) { this.FocusCapturedBySystem = _focusCapturedBySystem; WaveVR_Utils.Event.Send(WaveVR_Utils.Event.SYSTEMFOCUS_CHANGED, this.FocusCapturedBySystem); // When getting system focus again, reset button events. if (!this.FocusCapturedBySystem) { PrintInfoLog("UpdateEachFrame() get system focus, update button events."); UpdateButtonEvents(); } else { PrintInfoLog("UpdateEachFrame() lost system focus."); } } InteractionMode = Interop.WVR_GetInteractionMode(); GazeTriggerType = Interop.WVR_GetGazeTriggerType(); Profiler.BeginSample("GetSyncPose"); #if UNITY_STANDALONE Interop.WVR_GetLastPoseIndex(origin, poses, (uint)poses.Length, ref frameInx); #else Interop.WVR_GetSyncPose(origin, poses, (uint)poses.Length); #endif Profiler.EndSample(); for (uint i = 0; i < DeviceTypes.Length; i++) { bool _hasType = false; for (uint j = 0; j < poses.Length; j++) { WVR_DevicePosePair_t _pose = poses[j]; if (_pose.type == DeviceTypes [i]) { _hasType = true; // Check connection first bool _valid_pose = GetConnectionStatus(DeviceTypes [i]); // Check whether pose is valid with connection. if (_valid_pose) { _valid_pose = _pose.pose.IsValidPose; } deviceIndexMap[i] = j; if (isValidPose [i] != _valid_pose) { isValidPose [i] = _valid_pose; PrintInfoLog(Log.CSB.Append("UpdateEachFrame() device ").Append(DeviceTypes [i].Name()).Append(" pose is ").Append(isValidPose [i] ? "valid." : "invalid.").ToString()); WaveVR_Utils.Event.Send(WaveVR_Utils.Event.DEVICE_CONNECTED, DeviceTypes [i], isValidPose [i]); } if (isValidPose [i]) { rtPoses[j].update(_pose.pose.PoseMatrix); } break; } } // no such type if (!_hasType) { if (isValidPose [i] == true) { isValidPose [i] = false; PrintInfoLog(Log.CSB.Append("UpdateEachFrame() device ").Append(DeviceTypes [i].Name()).Append(" pose is invalid.").ToString()); WaveVR_Utils.Event.Send(WaveVR_Utils.Event.DEVICE_CONNECTED, DeviceTypes [i], isValidPose [i]); } } } for (int i = 0; i < poses.Length; i++) { WVR_DeviceType _type = poses [i].type; bool _connected = GetConnectionStatus(_type); bool _poseValid = poses [i].pose.IsValidPose; if (Log.gpl.Print) { PrintDebugLog( Log.CSB .Append("UpdateEachFrame() device ").Append(_type.Name()).Append(" is ").Append(_connected ? "connected" : "disconnected") .Append(", pose is ").Append(_poseValid ? "valid" : "invalid") .Append(", pos: {").Append(rtPoses [i].pos.x).Append(", ").Append(rtPoses [i].pos.y).Append(", ").Append(rtPoses [i].pos.z).Append("}") .Append(", rot: {").Append(rtPoses [i].rot.x).Append(", ").Append(rtPoses [i].rot.y).Append(", ").Append(rtPoses [i].rot.z).Append(", ").Append(rtPoses [i].rot.w).Append("}") .ToString()); } } Profiler.BeginSample("SendNewPose"); try { WaveVR_Utils.Event.Send(WaveVR_Utils.Event.NEW_POSES, poses, rtPoses); } catch (Exception ex) { PrintErrorLog("Send NEW_POSES Event Exception : " + ex); } if (Log.gpl.Print) { PrintDebugLog("UpdateEachFrame() after new pose."); } try { WaveVR_Utils.Event.Send(WaveVR_Utils.Event.AFTER_NEW_POSES); } catch (Exception ex) { PrintErrorLog("Send AFTER_NEW_POSES Event Exception : " + ex); } Profiler.EndSample(); }
public bool SetGazeTriggerType(WVR_GazeTriggerType type) { gazeType = type; return(true); }
public static extern bool WVR_SetGazeTriggerType_HVR(WVR_GazeTriggerType type);
public override bool SetGazeTriggerType(WVR_GazeTriggerType type) { return(system.SetGazeTriggerType(type)); }
private void updateInteractionModeAndGazeTriggerType() { if (Log.gpl.Print) { DEBUG(this.OverrideSystemSettings ? "updateInteractionModeAndGazeTriggerType() OverrideSystemSettings is true." : "updateInteractionModeAndGazeTriggerType() OverrideSystemSettings is false."); DEBUG(InteractionMode_System == WVR_InteractionMode.WVR_InteractionMode_Gaze ? "updateInteractionModeAndGazeTriggerType() InteractionMode_System is gaze." : "updateInteractionModeAndGazeTriggerType() InteractionMode_System is controller."); DEBUG(InteractionMode_User == WaveVR_EInputModule.Controller ? "updateInteractionModeAndGazeTriggerType() InteractionMode_User is controller." : "updateInteractionModeAndGazeTriggerType() InteractionMode_User is gaze."); if (gazeTriggerType_System == WVR_GazeTriggerType.WVR_GazeTriggerType_Timeout) { DEBUG("updateInteractionModeAndGazeTriggerType() gazeTriggerType_System is timeout."); } if (gazeTriggerType_System == WVR_GazeTriggerType.WVR_GazeTriggerType_Button) { DEBUG("updateInteractionModeAndGazeTriggerType() gazeTriggerType_System is button."); } if (gazeTriggerType_System == WVR_GazeTriggerType.WVR_GazeTriggerType_TimeoutButton) { DEBUG("updateInteractionModeAndGazeTriggerType() gazeTriggerType_System is timeout & button."); } if (gazeTriggerType_User == WVR_GazeTriggerType.WVR_GazeTriggerType_Timeout) { DEBUG("updateInteractionModeAndGazeTriggerType() gazeTriggerType_User is timeout."); } if (gazeTriggerType_User == WVR_GazeTriggerType.WVR_GazeTriggerType_Button) { DEBUG("updateInteractionModeAndGazeTriggerType() gazeTriggerType_User is button."); } if (gazeTriggerType_User == WVR_GazeTriggerType.WVR_GazeTriggerType_TimeoutButton) { DEBUG("updateInteractionModeAndGazeTriggerType() gazeTriggerType_User is timeout & button."); } } if (this.OverrideSystemSettings) { if ((this.InteractionMode_User != this.CustomInputModule) || (this.preOverrideSystemSettings != this.OverrideSystemSettings)) { if (this.InteractionMode_User != this.CustomInputModule) { this.InteractionMode_User = this.CustomInputModule; DEBUG(this.InteractionMode_User == WaveVR_EInputModule.Controller ? "updateInteractionModeAndGazeTriggerType() InteractionMode_User is controller." : "updateInteractionModeAndGazeTriggerType() InteractionMode_User is gaze."); } if (this.preOverrideSystemSettings != this.OverrideSystemSettings) { this.preOverrideSystemSettings = this.OverrideSystemSettings; DEBUG(this.OverrideSystemSettings ? "updateInteractionModeAndGazeTriggerType() OverrideSystemSettings is true." : "updateInteractionModeAndGazeTriggerType() OverrideSystemSettings is false."); } WVR_InteractionMode _mode = (this.InteractionMode_User == WaveVR_EInputModule.Controller) ? WVR_InteractionMode.WVR_InteractionMode_Controller : WVR_InteractionMode.WVR_InteractionMode_Gaze; Interop.WVR_SetInteractionMode(_mode); } updateGazeTriggerType_User(); if (this.gazeTriggerType_User_pre != this.gazeTriggerType_User) { this.gazeTriggerType_User_pre = this.gazeTriggerType_User; Interop.WVR_SetGazeTriggerType(this.gazeTriggerType_User); if (gazeTriggerType_User == WVR_GazeTriggerType.WVR_GazeTriggerType_Timeout) { DEBUG("updateInteractionModeAndGazeTriggerType() gazeTriggerType_User is timeout."); } if (gazeTriggerType_User == WVR_GazeTriggerType.WVR_GazeTriggerType_Button) { DEBUG("updateInteractionModeAndGazeTriggerType() gazeTriggerType_User is button."); } if (gazeTriggerType_User == WVR_GazeTriggerType.WVR_GazeTriggerType_TimeoutButton) { DEBUG("updateInteractionModeAndGazeTriggerType() gazeTriggerType_User is timeout & button."); } } updateInputModuleByCustomSettings(); } else { if (this.preOverrideSystemSettings != this.OverrideSystemSettings) { this.preOverrideSystemSettings = this.OverrideSystemSettings; // Restore runtime mirror system setting. Interop.WVR_SetInteractionMode(WVR_InteractionMode.WVR_InteractionMode_SystemDefault); } this.InteractionMode_System = WaveVR.Instance.InteractionMode; this.gazeTriggerType_System = WaveVR.Instance.GazeTriggerType; updateInputModuleBySystemSetting(); } }