@@ -30,8 +30,9 @@ void MatricesManager::calculateProjectionAndDefaultView(float fov, float ratio)
30
30
31
31
void MatricesManager::calculateProjectionAndDefaultView360 (float fov360Video,float ratio) {
32
32
worldMatrices.projection360 =glm::perspective (glm::radians (fov360Video), ratio, 0 .1f , MAX_Z_DISTANCE+5 );
33
- worldMatrices.monoViewTracked360 =glm::mat4 ();
34
- worldMatrices.monoForward360 =glm::mat4 ();
33
+ worldMatrices.monoViewTracked360 =glm::mat4 (1 .0f );
34
+ worldMatrices.monoForward360 =glm::mat4 (1 .0f );
35
+ // worldMatrices.monoForward360 = glm::rotate(glm::mat4(1.0f),glm::radians(90.0f), glm::vec3(0,1,0));
35
36
}
36
37
37
38
void MatricesManager::calculateNewHeadPoseIfNeeded (gvr::GvrApi *gvr_api, const int predictMS) {
@@ -63,24 +64,23 @@ void MatricesManager::calculateNewHeadPose360(gvr::GvrApi *gvr_api, const int pr
63
64
gvr::ClockTimePoint target_time = gvr::GvrApi::GetTimePointNow ();
64
65
target_time.monotonic_system_time_nanos +=predictMS*NANO_TO_MS;
65
66
gvr::Mat4f tmpHeadPose = gvr_api->GetHeadSpaceFromStartSpaceRotation (target_time); // we only want rotation, screw the mirage solo
66
- tmpHeadPose = MatrixMul (worldMatrices. monoForward360 , tmpHeadPose);
67
- // gvr_api->ApplyNeckModel (tmpHeadPose,1 );
68
- worldMatrices.monoViewTracked360 =toGLM (tmpHeadPose);
67
+ gvr_api-> ApplyNeckModel ( tmpHeadPose, 1 );
68
+ const glm::mat4 tmpHeadPoseGLM= toGLM (tmpHeadPose);
69
+ worldMatrices.monoViewTracked360 =tmpHeadPoseGLM*worldMatrices. monoForward360 ; // multiplication order is important
69
70
}
70
71
71
72
void MatricesManager::setHomeOrientation360 (gvr::GvrApi *gvr_api) {
72
- // Get the current start->head transformation
73
73
gvr::Mat4f tmpHeadPose=gvr_api->GetHeadSpaceFromStartSpaceRotation (gvr::GvrApi::GetTimePointNow ());
74
- // gvr_api->ApplyNeckModel(tmpHeadPose,1); We do not want to apply the neck model here,else the world shifts
74
+ gvr_api->ApplyNeckModel (tmpHeadPose,1 );
75
75
glm::mat4 headView=toGLM (tmpHeadPose);
76
- headView=glm::toMat4 (glm::quat_cast (headView));
76
+ // headView=glm::toMat4(glm::quat_cast(headView));
77
77
worldMatrices.monoForward360 =worldMatrices.monoForward360 *headView;
78
+ // Reset tracking resets the rotation around the y axis, leaving everything else untouched
78
79
gvr_api->RecenterTracking ();
79
80
}
80
81
81
82
/* if(TEST()){
82
83
LOGD("SUCCESS");
83
84
}else{
84
85
LOGD("FAIL");
85
- }*/
86
- // Reset tracking resets the rotation around the y axis, leaving everything else untouched
86
+ }*/
0 commit comments