diff --git a/GVRf/Framework/backend_oculus/src/main/java/org/gearvrf/OvrViewManager.java b/GVRf/Framework/backend_oculus/src/main/java/org/gearvrf/OvrViewManager.java index dd4078e78..c8a4ec89f 100644 --- a/GVRf/Framework/backend_oculus/src/main/java/org/gearvrf/OvrViewManager.java +++ b/GVRf/Framework/backend_oculus/src/main/java/org/gearvrf/OvrViewManager.java @@ -308,10 +308,13 @@ void createSwapChain(){ mRenderBundle.createRenderTargetChain(isMultiview); } - /* - * GVRF APIs - */ - private native long getRenderTextureInfo(long ptr, int index, int eye ); + private native long getRenderTextureInfo(long ptr, int index, int eye); private native void drawEyes(long ptr); + private native void recenterPose(long ptr); + + @Override + public void recenterPose() { + recenterPose(mApplication.getActivityNative().getNative()); + } } diff --git a/GVRf/Framework/backend_oculus/src/main/jni/ovr_activity.cpp b/GVRf/Framework/backend_oculus/src/main/jni/ovr_activity.cpp index b6921214f..cd2beffbf 100644 --- a/GVRf/Framework/backend_oculus/src/main/jni/ovr_activity.cpp +++ b/GVRf/Framework/backend_oculus/src/main/jni/ovr_activity.cpp @@ -401,4 +401,9 @@ void GVRActivity::onDrawFrame(jobject jViewManager) { LOGD("Activity: usingMultview = %d", use_multiview); return use_multiview; } + + void GVRActivity::recenterPose() const { + vrapi_RecenterPose(oculusMobile_); + } + } diff --git a/GVRf/Framework/backend_oculus/src/main/jni/ovr_activity.h b/GVRf/Framework/backend_oculus/src/main/jni/ovr_activity.h index 434746d2b..387e2e091 100644 --- a/GVRf/Framework/backend_oculus/src/main/jni/ovr_activity.h +++ b/GVRf/Framework/backend_oculus/src/main/jni/ovr_activity.h @@ -94,6 +94,8 @@ namespace gvr { void setGearController(GearController *controller){ gearController = controller; } + + void recenterPose() const; }; } diff --git a/GVRf/Framework/backend_oculus/src/main/jni/ovr_activity_jni.cpp b/GVRf/Framework/backend_oculus/src/main/jni/ovr_activity_jni.cpp index 36d4d3156..b6312ce1d 100644 --- a/GVRf/Framework/backend_oculus/src/main/jni/ovr_activity_jni.cpp +++ b/GVRf/Framework/backend_oculus/src/main/jni/ovr_activity_jni.cpp @@ -27,7 +27,7 @@ namespace gvr { return reinterpret_cast(gvrActivity); } - JNIEXPORT long JNICALL Java_org_gearvrf_OvrViewManager_getRenderTextureInfo(JNIEnv* jni, jclass clazz, jlong jactivity , jint index, jint eye){ + JNIEXPORT long JNICALL Java_org_gearvrf_OvrViewManager_getRenderTextureInfo(JNIEnv*, jobject, jlong jactivity, jint index, jint eye) { GVRActivity* gvrActivity = reinterpret_cast(jactivity); return reinterpret_cast(gvrActivity->getRenderTextureInfo(eye, index)); } @@ -94,7 +94,14 @@ namespace gvr { const GVRActivity *activity = reinterpret_cast(appPtr); return activity->usingMultiview(); } - + + + JNIEXPORT void JNICALL + Java_org_gearvrf_OvrViewManager_recenterPose__J(JNIEnv*, jobject, jlong ptr) { + const GVRActivity *activity = reinterpret_cast(ptr); + activity->recenterPose(); + } + } //extern "C" { } //namespace gvr diff --git a/GVRf/Framework/build.gradle b/GVRf/Framework/build.gradle index d4eafac69..ce2d731a9 100755 --- a/GVRf/Framework/build.gradle +++ b/GVRf/Framework/build.gradle @@ -5,8 +5,8 @@ if(file("../../../extra_properties.gradle").exists()) { // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { - jcenter() google() + jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.1.0' @@ -15,11 +15,11 @@ buildscript { allprojects { repositories { + google() maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } jcenter() - google() } } subprojects { diff --git a/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRContext.java b/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRContext.java index 5da246444..fdefba791 100755 --- a/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRContext.java +++ b/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRContext.java @@ -876,4 +876,11 @@ final GVRReference findReference(long nativePointer) { return null; } + /** + * Recenter the head and the controller pose orientation on the yaw axis + */ + public void recenterPose() { + getMainScene().getMainCameraRig().resetYaw(); + } + }