mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 14:55:47 +00:00
Bug 1305890 - Part 1: Oculus Touch button inputs support; r=kip
MozReview-Commit-ID: CJmSW00e8Ov --HG-- extra : rebase_source : f27abcda43cd3c02eb7f31cece07ef7ad26899d9
This commit is contained in:
parent
8d57237a09
commit
32f7b8390b
@ -192,7 +192,9 @@ VRManager::NotifyVsync(const TimeStamp& aVsyncTimestamp)
|
|||||||
TimeDuration duration = TimeStamp::Now() - mLastRefreshTime;
|
TimeDuration duration = TimeStamp::Now() - mLastRefreshTime;
|
||||||
if (duration.ToMilliseconds() > kVRDisplayRefreshMaxDuration) {
|
if (duration.ToMilliseconds() > kVRDisplayRefreshMaxDuration) {
|
||||||
RefreshVRDisplays();
|
RefreshVRDisplays();
|
||||||
RefreshVRControllers();
|
if (bHaveControllerListener) {
|
||||||
|
RefreshVRControllers();
|
||||||
|
}
|
||||||
mLastRefreshTime = TimeStamp::Now();
|
mLastRefreshTime = TimeStamp::Now();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,15 +122,15 @@ static pfn_ovr_GetMirrorTextureBufferGL ovr_GetMirrorTextureBufferGL = nullptr;
|
|||||||
#define OVR_MINOR_VERSION 10
|
#define OVR_MINOR_VERSION 10
|
||||||
|
|
||||||
static const ovrButton kOculusTouchLButton[] = {
|
static const ovrButton kOculusTouchLButton[] = {
|
||||||
|
ovrButton_LThumb,
|
||||||
ovrButton_X,
|
ovrButton_X,
|
||||||
ovrButton_Y,
|
ovrButton_Y
|
||||||
ovrButton_LThumb
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const ovrButton kOculusTouchRButton[] = {
|
static const ovrButton kOculusTouchRButton[] = {
|
||||||
|
ovrButton_RThumb,
|
||||||
ovrButton_A,
|
ovrButton_A,
|
||||||
ovrButton_B,
|
ovrButton_B,
|
||||||
ovrButton_RThumb
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint32_t kNumOculusButton = sizeof(kOculusTouchLButton) /
|
static const uint32_t kNumOculusButton = sizeof(kOculusTouchLButton) /
|
||||||
@ -939,7 +939,7 @@ VRSystemManagerOculus::GetHMDs(nsTArray<RefPtr<VRDisplayHost>>& aHMDResult)
|
|||||||
void
|
void
|
||||||
VRSystemManagerOculus::HandleInput()
|
VRSystemManagerOculus::HandleInput()
|
||||||
{
|
{
|
||||||
// mSession is available after VRDisplay is created
|
// mSession is available after VRDisplay is created
|
||||||
// at GetHMDs().
|
// at GetHMDs().
|
||||||
if (!mSession) {
|
if (!mSession) {
|
||||||
return;
|
return;
|
||||||
@ -964,7 +964,33 @@ void
|
|||||||
VRSystemManagerOculus::HandleButtonPress(uint32_t aControllerIdx,
|
VRSystemManagerOculus::HandleButtonPress(uint32_t aControllerIdx,
|
||||||
uint64_t aButtonPressed)
|
uint64_t aButtonPressed)
|
||||||
{
|
{
|
||||||
// TODO: Bug 1305890
|
MOZ_ASSERT(sizeof(kOculusTouchLButton) / sizeof(ovrButton) ==
|
||||||
|
sizeof(kOculusTouchRButton) / sizeof(ovrButton));
|
||||||
|
|
||||||
|
RefPtr<impl::VRControllerOculus> controller(mOculusController[aControllerIdx]);
|
||||||
|
MOZ_ASSERT(controller);
|
||||||
|
GamepadHand hand = controller->GetHand();
|
||||||
|
uint64_t diff = (controller->GetButtonPressed() ^ aButtonPressed);
|
||||||
|
uint32_t buttonMask = 0;
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < kNumOculusButton; ++i) {
|
||||||
|
switch (hand) {
|
||||||
|
case mozilla::dom::GamepadHand::Left:
|
||||||
|
buttonMask = kOculusTouchLButton[i];
|
||||||
|
break;
|
||||||
|
case mozilla::dom::GamepadHand::Right:
|
||||||
|
buttonMask = kOculusTouchRButton[i];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
MOZ_ASSERT(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (diff & buttonMask) {
|
||||||
|
NewButtonEvent(aControllerIdx, i, diff & aButtonPressed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
controller->SetButtonPressed(aButtonPressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user