зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1305891 - Part 2: Accept GamepadHand as the parameter when VRControllerHost constructs; r=kip
MozReview-Commit-ID: IYscauVw8iE --HG-- extra : rebase_source : f11f9ec7d486f41917d687009ba1b47c933a68ba
This commit is contained in:
Родитель
06d6a52263
Коммит
4bcfff5f8b
|
@ -199,12 +199,6 @@ VRControllerHost::GetPose()
|
|||
return mPose;
|
||||
}
|
||||
|
||||
void
|
||||
VRControllerHost::SetHand(dom::GamepadHand aHand)
|
||||
{
|
||||
mControllerInfo.mHand = aHand;
|
||||
}
|
||||
|
||||
dom::GamepadHand
|
||||
VRControllerHost::GetHand()
|
||||
{
|
||||
|
|
|
@ -95,7 +95,6 @@ public:
|
|||
uint64_t GetButtonPressed();
|
||||
void SetPose(const dom::GamepadPoseState& aPose);
|
||||
const dom::GamepadPoseState& GetPose();
|
||||
virtual void SetHand(dom::GamepadHand aHand);
|
||||
dom::GamepadHand GetHand();
|
||||
|
||||
protected:
|
||||
|
|
|
@ -832,13 +832,16 @@ VRDisplayOculus::NotifyVSync()
|
|||
mDisplayInfo.mIsConnected = (ovr == ovrSuccess && sessionStatus.HmdPresent);
|
||||
}
|
||||
|
||||
VRControllerOculus::VRControllerOculus()
|
||||
VRControllerOculus::VRControllerOculus(dom::GamepadHand aHand)
|
||||
: VRControllerHost(VRDeviceType::Oculus)
|
||||
{
|
||||
MOZ_COUNT_CTOR_INHERITED(VRControllerOculus, VRControllerHost);
|
||||
mControllerInfo.mControllerName.AssignLiteral("Oculus Touch");
|
||||
mControllerInfo.mControllerName.AssignLiteral("Oculus Touch (");
|
||||
mControllerInfo.mControllerName.AppendPrintf("%s%s",
|
||||
GamepadHandValues::strings[uint32_t(aHand)].value,
|
||||
")");
|
||||
mControllerInfo.mMappingType = GamepadMappingType::_empty;
|
||||
mControllerInfo.mHand = GamepadHand::_empty;
|
||||
mControllerInfo.mHand = aHand;
|
||||
mControllerInfo.mNumButtons = kNumOculusButton;
|
||||
mControllerInfo.mNumAxes = static_cast<uint32_t>(
|
||||
OculusControllerAxisType::NumVRControllerAxisType);;
|
||||
|
@ -856,16 +859,6 @@ VRControllerOculus::SetAxisMove(uint32_t aAxis, float aValue)
|
|||
mAxisMove[aAxis] = aValue;
|
||||
}
|
||||
|
||||
void
|
||||
VRControllerOculus::SetHand(dom::GamepadHand aHand)
|
||||
{
|
||||
VRControllerHost::SetHand(aHand);
|
||||
mControllerInfo.mControllerName.AssignLiteral("Oculus Touch (");
|
||||
mControllerInfo.mControllerName.AppendPrintf("%s%s",
|
||||
GamepadHandValues::strings[uint32_t(aHand)].value,
|
||||
")");
|
||||
}
|
||||
|
||||
VRControllerOculus::~VRControllerOculus()
|
||||
{
|
||||
MOZ_COUNT_DTOR_INHERITED(VRControllerOculus, VRControllerHost);
|
||||
|
@ -1153,9 +1146,8 @@ VRSystemManagerOculus::ScanForControllers()
|
|||
hand = GamepadHand::Right;
|
||||
break;
|
||||
}
|
||||
RefPtr<VRControllerOculus> oculusController = new VRControllerOculus();
|
||||
RefPtr<VRControllerOculus> oculusController = new VRControllerOculus(hand);
|
||||
oculusController->SetIndex(mControllerCount);
|
||||
oculusController->SetHand(hand);
|
||||
mOculusController.AppendElement(oculusController);
|
||||
|
||||
// Not already present, add it.
|
||||
|
|
|
@ -97,10 +97,9 @@ protected:
|
|||
class VRControllerOculus : public VRControllerHost
|
||||
{
|
||||
public:
|
||||
explicit VRControllerOculus();
|
||||
explicit VRControllerOculus(dom::GamepadHand aHand);
|
||||
float GetAxisMove(uint32_t aAxis);
|
||||
void SetAxisMove(uint32_t aAxis, float aValue);
|
||||
virtual void SetHand(dom::GamepadHand aHand) override;
|
||||
|
||||
protected:
|
||||
virtual ~VRControllerOculus();
|
||||
|
|
|
@ -420,13 +420,13 @@ VRDisplayOpenVR::NotifyVSync()
|
|||
PollEvents();
|
||||
}
|
||||
|
||||
VRControllerOpenVR::VRControllerOpenVR()
|
||||
VRControllerOpenVR::VRControllerOpenVR(dom::GamepadHand aHand)
|
||||
: VRControllerHost(VRDeviceType::OpenVR)
|
||||
{
|
||||
MOZ_COUNT_CTOR_INHERITED(VRControllerOpenVR, VRControllerHost);
|
||||
mControllerInfo.mControllerName.AssignLiteral("OpenVR Gamepad");
|
||||
mControllerInfo.mMappingType = GamepadMappingType::_empty;
|
||||
mControllerInfo.mHand = GamepadHand::_empty;
|
||||
mControllerInfo.mHand = aHand;
|
||||
mControllerInfo.mNumButtons = gNumOpenVRButtonMask;
|
||||
mControllerInfo.mNumAxes = gNumOpenVRAxis;
|
||||
}
|
||||
|
@ -733,10 +733,9 @@ VRSystemManagerOpenVR::ScanForControllers()
|
|||
hand = GamepadHand::Right;
|
||||
break;
|
||||
}
|
||||
RefPtr<VRControllerOpenVR> openVRController = new VRControllerOpenVR();
|
||||
RefPtr<VRControllerOpenVR> openVRController = new VRControllerOpenVR(hand);
|
||||
openVRController->SetIndex(mControllerCount);
|
||||
openVRController->SetTrackedIndex(trackedDevice);
|
||||
openVRController->SetHand(hand);
|
||||
mOpenVRController.AppendElement(openVRController);
|
||||
|
||||
// Not already present, add it.
|
||||
|
|
|
@ -72,7 +72,7 @@ protected:
|
|||
class VRControllerOpenVR : public VRControllerHost
|
||||
{
|
||||
public:
|
||||
explicit VRControllerOpenVR();
|
||||
explicit VRControllerOpenVR(dom::GamepadHand aHand);
|
||||
void SetTrackedIndex(uint32_t aTrackedIndex);
|
||||
uint32_t GetTrackedIndex();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче