Skip to content

Commit e222c79

Browse files
author
di57mec
committed
add set / goto gome
1 parent 13530ee commit e222c79

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed

app/src/main/cpp/Other/MatricesManager.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,11 @@ void MatricesManager::calculateNewHeadPose360(gvr::GvrApi *gvr_api, const int pr
6767
worldMatrices.monoViewTracked360=toGLM(tmpHeadPose);
6868
}
6969

70-
glm::mat4x4 startToHeadRotation(gvr::GvrApi *gvr_api) {
71-
gvr::Mat4f mat = gvr_api->GetHeadSpaceFromStartSpaceRotation(gvr::GvrApi::GetTimePointNow()); //we only want rotation, screw the mirage solo
72-
glm::mat4x4 tmat=glm::make_mat4(reinterpret_cast<const float*>(&mat.m));
73-
return glm::toMat4(glm::quat_cast(tmat));
74-
}
75-
7670
void MatricesManager::setHomeOrientation360(gvr::GvrApi *gvr_api) {
7771
// Get the current start->head transformation
78-
worldMatrices.monoForward360=worldMatrices.monoForward360*startToHeadRotation(gvr_api);
79-
// Reset yaw back to start
80-
//gvr_api->RecenterTracking();
72+
gvr::Mat4f tmpHeadPose=gvr_api->GetHeadSpaceFromStartSpaceRotation(gvr::GvrApi::GetTimePointNow());
73+
gvr_api->ApplyNeckModel(tmpHeadPose,1);
74+
glm::mat4 headView=toGLM(tmpHeadPose);
75+
worldMatrices.monoForward360*=headView;
8176
}
8277

app/src/main/cpp/Other/MatrixHelper.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,12 @@
1515
#include <glm/gtx/matrix_decompose.hpp>
1616
#include <sstream>
1717

18-
//convert between gvr / glm
19-
//really messy !
20-
//TODO: Add tests usw
2118

22-
//gvr matrices are stored in row major order
19+
//1)gvr matrices are stored in row major order
2320
//See gvr_types.h:
2421
/// A floating point 4x4 matrix stored in row-major form. It needs to be
2522
/// transposed before being used with OpenGL.
26-
//glm matrices are stored in column major order (glm manual,section 4.11), as well as OpenGL matrices
23+
//2)glm matrices are stored in column major order (glm manual,section 4.11), as well as OpenGL matrices
2724

2825
static glm::mat4 toGLM(const gvr::Mat4f &gvrMatrix){
2926
glm::mat4x4 ret=glm::make_mat4(reinterpret_cast<const float*>(&gvrMatrix.m));

app/src/main/java/constantin/fpv_vr/APlay/AMono360.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ public class AMono360 extends AppCompatActivity {
2828
private GLSurfaceView mGLView;
2929
private GLRMono360 mGLRenderer;
3030
private TelemetryReceiver telemetryReceiver;
31-
//either create gvr api directly or use gvr layout as wrapper - first one introduces bug, e.g. "wrong 360° video orientation"
31+
//either create gvr api directly or use gvr layout as wrapper
32+
//First one caused bugs when not forwarding onResume/Pause to the DisplaySynchronizer, see https://github.com/googlevr/gvr-android-sdk/issues/556
3233
private static final boolean useGvrLayout=true;
3334
private GvrApi gvrApi;
3435
private GvrLayout gvrLayout;
@@ -52,6 +53,7 @@ protected void onCreate(Bundle savedInstanceState) {
5253
gvrLayout.setStereoModeEnabled(false);
5354
gvrLayout.setPresentationView(mGLView);
5455
}else{
56+
//gvrApi = new GvrApi(this, new DisplaySynchronizer(this,getWindowManager().getDefaultDisplay()));
5557
displaySynchronizer=new DisplaySynchronizer(this,getWindowManager().getDefaultDisplay());
5658
gvrApi = new GvrApi(this, displaySynchronizer);
5759
gvrApi.reconnectSensors();
@@ -132,6 +134,7 @@ protected void onDestroy() {
132134
gvrLayout.shutdown();
133135
}else{
134136
gvrApi.shutdown();
137+
displaySynchronizer.shutdown();
135138
}
136139
mGLView=null;
137140
mGLRenderer =null;

0 commit comments

Comments
 (0)