Closed Wavesonics closed 3 years ago
We need to be able to query the device type: The ovrDeviceType value, VRAPI_DEVICE_TYPE_OCULUSQUEST2, has been added to the API.
The ovrDeviceType value, VRAPI_DEVICE_TYPE_OCULUSQUEST2, has been added to the API.
The upstream oculus_mobile plugin does it as such:
inline int get_device_type() { return ovrmobile::get_device_type(OvrMobileSession::get_singleton_instance()); } inline bool is_oculus_quest_1_device() { return ovrmobile::is_oculus_quest_1_device(OvrMobileSession::get_singleton_instance()); } inline bool is_oculus_quest_2_device() { return ovrmobile::is_oculus_quest_2_device(OvrMobileSession::get_singleton_instance()); }
ovrDeviceType get_device_type(OvrMobileSession *session) { return check_session_initialized<ovrDeviceType>( session, [&]() { auto device_type = static_cast<ovrDeviceType>(vrapi_GetSystemPropertyInt( session->get_ovr_java(), VRAPI_SYS_PROP_DEVICE_TYPE)); return device_type; }, []() { return VRAPI_DEVICE_TYPE_UNKNOWN; }); } bool is_oculus_quest_1_device(OvrMobileSession *session) { ovrDeviceType device_type = get_device_type(session); return device_type >= VRAPI_DEVICE_TYPE_OCULUSQUEST_START && device_type <= VRAPI_DEVICE_TYPE_OCULUSQUEST_END; } bool is_oculus_quest_2_device(OvrMobileSession *session) { ovrDeviceType device_type = get_device_type(session); return device_type >= VRAPI_DEVICE_TYPE_OCULUSQUEST2_START && device_type <= VRAPI_DEVICE_TYPE_OCULUSQUEST2_END; }
We need to be able to query the device type:
The ovrDeviceType value, VRAPI_DEVICE_TYPE_OCULUSQUEST2, has been added to the API.
The upstream oculus_mobile plugin does it as such: