Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit 20b58b2

Browse files
authored
Set correct CapabilityFlags for Pico G2 (#2977)
1 parent 93eff89 commit 20b58b2

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

app/src/picovr/cpp/DeviceDelegatePicoVR.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static const int32_t kMaxControllerCount = 2;
3333
static const int32_t kNumButtons = 6;
3434
static const int32_t kNumG2Buttons = 2;
3535
static const int32_t kNumAxes = 2;
36-
static const int32_t kTypeNeo2 = 1;
36+
static const int32_t k6DofHeadSet = 1;
3737
static const int32_t kButtonApp = 1;
3838
static const int32_t kButtonTrigger = 1 << 1;
3939
static const int32_t kButtonTouchPad = 1 << 2;
@@ -179,7 +179,7 @@ struct DeviceDelegatePicoVR::State {
179179
touchPadPressed);
180180
controllerDelegate->SetButtonState(i, ControllerDelegate::BUTTON_TRIGGER, 1, triggerPressed,
181181
triggerPressed);
182-
if (type == kTypeNeo2) {
182+
if (type == k6DofHeadSet) {
183183
controllerDelegate->SetButtonState(i, ControllerDelegate::BUTTON_OTHERS, 2, gripPressed,
184184
gripPressed, gripPressed ? 20.0f : 0.0f);
185185
controllerDelegate->SetButtonState(i,
@@ -197,7 +197,7 @@ struct DeviceDelegatePicoVR::State {
197197
controllerDelegate->SetAxes(i, axes, kNumAxes);
198198

199199

200-
if (type == kTypeNeo2) {
200+
if (type == k6DofHeadSet) {
201201
if (!triggerPressed) {
202202
controllerDelegate->SetScrolledDelta(i, -controller.axisX, controller.axisY);
203203
}
@@ -211,7 +211,7 @@ struct DeviceDelegatePicoVR::State {
211211

212212
vrb::Matrix transform = controller.transform;
213213
if (renderMode == device::RenderMode::StandAlone) {
214-
if (type == kTypeNeo2) {
214+
if (type == k6DofHeadSet) {
215215
transform.TranslateInPlace(headOffset);
216216
} else {
217217
vrb::Matrix head = vrb::Matrix::Rotation(orientation);
@@ -264,7 +264,11 @@ DeviceDelegatePicoVR::RegisterImmersiveDisplay(ImmersiveDisplayPtr aDisplay) {
264264
}
265265

266266
m.immersiveDisplay->SetDeviceName("Pico");
267-
m.immersiveDisplay->SetCapabilityFlags(device::Position | device::Orientation | device::Present | device::ImmersiveVRSession | device::InlineSession);
267+
device::CapabilityFlags flags = device::Orientation | device::Present | device::ImmersiveVRSession | device::InlineSession;
268+
if (m.type == k6DofHeadSet) {
269+
flags |= device::Position;
270+
}
271+
m.immersiveDisplay->SetCapabilityFlags(flags);
268272
m.immersiveDisplay->SetEyeResolution(m.renderWidth / 2, m.renderHeight / 2);
269273
m.immersiveDisplay->CompleteEnumeration();
270274
}
@@ -288,7 +292,7 @@ DeviceDelegatePicoVR::GetReorientTransform() const {
288292

289293
void
290294
DeviceDelegatePicoVR::SetReorientTransform(const vrb::Matrix& aMatrix) {
291-
if (m.type == kTypeNeo2) {
295+
if (m.type == k6DofHeadSet) {
292296
m.reorientMatrix = aMatrix;
293297
}
294298
}
@@ -311,7 +315,7 @@ DeviceDelegatePicoVR::SetControllerDelegate(ControllerDelegatePtr& aController)
311315
for (State::Controller& controller: m.controllers) {
312316
const int32_t index = controller.index;
313317

314-
if (m.type == kTypeNeo2) {
318+
if (m.type == k6DofHeadSet) {
315319
vrb::Matrix beam = vrb::Matrix::Rotation(vrb::Vector(1.0f, 0.0f, 0.0f), -vrb::PI_FLOAT / 11.5f);
316320
beam.TranslateInPlace(vrb::Vector(0.0f, 0.012f, -0.06f));
317321
m.controllerDelegate->CreateController(index, int32_t(controller.hand), controller.IsRightHand() ? "Pico Neo 2 (Right)" : "Pico Neo 2 (LEFT)", beam);
@@ -335,12 +339,12 @@ DeviceDelegatePicoVR::ReleaseControllerDelegate() {
335339

336340
int32_t
337341
DeviceDelegatePicoVR::GetControllerModelCount() const {
338-
return m.type == kTypeNeo2 ? 2 : 1;
342+
return m.type == k6DofHeadSet ? 2 : 1;
339343
}
340344

341345
const std::string
342346
DeviceDelegatePicoVR::GetControllerModelName(const int32_t aModelIndex) const {
343-
if (m.type == kTypeNeo2) {
347+
if (m.type == k6DofHeadSet) {
344348
if (aModelIndex == 0) {
345349
return "left_controller.obj";
346350
} else if (aModelIndex == 1) {

app/src/picovr/java/org/mozilla/vrbrowser/PlatformActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ protected void onCreate(Bundle bundle) {
8282
if (ControllerClient.isControllerServiceExisted(this)) {
8383
mControllerManager = new CVControllerManager(this);
8484
mControllerManager.setListener(this);
85-
mType = 1; // Neo2
85+
mType = 1; // 6Dof Headset
8686
// Enable high res
8787
PicovrSDK.SetEyeBufferSize(1920, 1920);
8888
} else {

0 commit comments

Comments
 (0)