Skip to content

Commit

Permalink
Update SDK and enable high resolution in Pico Neo 2 (#2931)
Browse files Browse the repository at this point in the history
* Update SDK and enable high resolution in Pico Neo 2

* Fix Neo2 contollers

Co-authored-by: Randall E. Barker <simstorm@mac.com>
  • Loading branch information
MortimerGoro and bluemarvin committed Mar 9, 2020
1 parent 8d47bf1 commit fcec46e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 20 deletions.
8 changes: 3 additions & 5 deletions app/src/picovr/cpp/DeviceDelegatePicoVR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,23 +180,21 @@ struct DeviceDelegatePicoVR::State {
controllerDelegate->SetButtonState(i, ControllerDelegate::BUTTON_OTHERS, 5, false, false);
}

// float axes[kNumAxes] = { controller.axisX , -controller.axisY };
float axes[kNumAxes] = { 0.0f, 0.0f };
float axes[kNumAxes] = { controller.axisX , -controller.axisY };
controllerDelegate->SetAxes(i, axes, kNumAxes);

/*

if (type == kTypeNeo2) {
if (!triggerPressed) {
controllerDelegate->SetScrolledDelta(i, -controller.axisX, controller.axisY);
}
} else {
*/
if (controller.touched) {
controllerDelegate->SetTouchPosition(i, controller.axisX, controller.axisY);
} else {
controllerDelegate->EndTouch(i);
}
//}
}

vrb::Matrix transform = controller.transform;
if (renderMode == device::RenderMode::StandAlone) {
Expand Down
25 changes: 11 additions & 14 deletions app/src/picovr/java/org/mozilla/vrbrowser/PlatformActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ protected void onCreate(Bundle bundle) {
if (ControllerClient.isControllerServiceExisted(this)) {
mControllerManager = new CVControllerManager(this);
mControllerManager.setListener(this);
mType = 1;
mType = 1; // Neo2
// Enable high res
PicovrSDK.SetEyeBufferSize(1920, 1920);
} else {
mHbManager = new HbManager(this);
mHbManager.InitServices();
Expand Down Expand Up @@ -148,11 +150,11 @@ private void updateControllers() {
}
CVController main = mControllerManager.getMainController();
if (main != null) {
updateController(hand, main);
updateController(1, main);
}
CVController sub = mControllerManager.getSubController();
if (sub != null) {
updateController(1 - hand, sub);
updateController(0, sub);
}
} else if (mHbManager != null) {
update3DofController();
Expand Down Expand Up @@ -202,7 +204,7 @@ private void update3DofController() {
}

private void updateController(int aIndex, @NonNull CVController aController) {
final float kMax = 25500.0f;
final float kMax = 255.0f;
final float kHalfMax = kMax / 2.0f;
boolean connected = aController.getConnectState() > 0;
if (!connected) {
Expand All @@ -213,15 +215,11 @@ private void updateController(int aIndex, @NonNull CVController aController) {
float axisY = 0.0f;
int[] stick = aController.getTouchPad();
if (stick.length >= 2) {
//Log.e(LOGTAG, "stick[" + aIndex + "] " + stick[0] + " " + stick[1]);
/*
axisY = ((float)stick[0] - kHalfMax) / kHalfMax;
axisX = ((float)stick[1] - kHalfMax) / kHalfMax;
if (axisX < 0.1f && axisX > -0.1f) { axisX = 0.0f; }
if (axisY < 0.1f && axisY > -0.1f) { axisY = 0.0f; }
*/
axisY = (float)stick[0] / kMax;
axisX = (float)stick[1] / kMax;

} else {
stick = new int[2];
}
Expand Down Expand Up @@ -289,12 +287,10 @@ public void surfaceChangedCallBack(int width, int height) {
}

// CVControllerListener
/*
@Override
public void onBindSuccess() {

}
*/

@Override
public void onBindFail() {
Expand All @@ -313,11 +309,12 @@ public void onConnectStateChanged(int serialNum, int state) {
@Override
public void onMainControllerChanged(int serialNum) {
}
/*

@Override
public void onChannelChanged(int var1, int var2) {
public void onChannelChanged(int i, int i1) {

}
*/

protected native void nativeOnCreate();
protected native void nativeInitialize(int width, int height, Object aAssetManager, int type, int focusIndex);
protected native void nativeShutdown();
Expand Down
2 changes: 1 addition & 1 deletion third_party_hash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9430d0b729ccd09ed1641798090552769942b351
5f3f613fa1ec0991a4e49753cb0546f4ddb95dbe

0 comments on commit fcec46e

Please sign in to comment.