template <class PredictionTrait> OVR::Matrix4f GVRActivity<PredictionTrait>::DrawEyeView(const int eye, const float fovDegrees) { const OVR::Matrix4f view = GetEyeView(eye, fovDegrees); // Transpose view matrix from oculus to mvp_matrix to rendering correctly with gvrf renderer. mvp_matrix = glm::mat4(view.M[0][0], view.M[1][0], view.M[2][0], view.M[3][0], view.M[0][1], view.M[1][1], view.M[2][1], view.M[3][1], view.M[0][2], view.M[1][2], view.M[2][2], view.M[3][2], view.M[0][3], view.M[1][3], view.M[2][3], view.M[3][3]); SetMVPMatrix(mvp_matrix); glm::quat headRotation = PredictionTrait::getPrediction(this, (1 == eye ? 4.0f : 3.5f) / 60.0f); cameraRig->setRotation(headRotation); JNIEnv* jni = app->GetVrJni(); jni->CallVoidMethod(javaObject, drawEyeViewMethodId, eye, fovDegrees); if (eye == 1) { jni->CallVoidMethod(javaObject, afterDrawEyesMethodId); } glm::mat4 view_matrix = camera->getViewMatrix(); glm::mat4 projection_matrix = camera->getProjectionMatrix(); //gun glm::mat4 vp_matrix = glm::mat4(projection_matrix * view_matrix); OVR::Matrix4f view2 = OVR::Matrix4f(vp_matrix[0][0], vp_matrix[1][0], vp_matrix[2][0], vp_matrix[3][0], vp_matrix[0][1], vp_matrix[1][1], vp_matrix[2][1], vp_matrix[3][1], vp_matrix[0][2], vp_matrix[1][2], vp_matrix[2][2], vp_matrix[3][2], vp_matrix[0][3], vp_matrix[1][3], vp_matrix[2][3], vp_matrix[3][3]); return view2; }
OVR::Matrix4f GVRActivity::DrawEyeView( const int eye, const float fovDegrees ) { const OVR::Matrix4f view = GetEyeView( eye, fovDegrees ); // Transpose view matrix from oculus to mvp_matrix to rendering correctly with gvrf renderer. mvp_matrix = glm::mat4( view.M[0][0], view.M[1][0], view.M[2][0], view.M[3][0], view.M[0][1], view.M[1][1], view.M[2][1], view.M[3][1], view.M[0][2], view.M[1][2], view.M[2][2], view.M[3][2], view.M[0][3], view.M[1][3], view.M[2][3], view.M[3][3]); SetMVPMatrix(mvp_matrix); JNIEnv* jni = app->GetVrJni(); jni->CallVoidMethod( javaObject, drawEyeViewMethodId, eye, fovDegrees ); if(eye == 1) { jni->CallVoidMethod( javaObject, afterDrawEyesMethodId ); } glm::mat4 view_matrix = camera->getViewMatrix(); glm::mat4 projection_matrix = camera->getProjectionMatrix(); //gun glm::mat4 vp_matrix = glm::mat4(projection_matrix * view_matrix); OVR::Matrix4f view2 = OVR::Matrix4f( vp_matrix[0][0], vp_matrix[1][0], vp_matrix[2][0], vp_matrix[3][0], vp_matrix[0][1], vp_matrix[1][1], vp_matrix[2][1], vp_matrix[3][1], vp_matrix[0][2], vp_matrix[1][2], vp_matrix[2][2], vp_matrix[3][2], vp_matrix[0][3], vp_matrix[1][3], vp_matrix[2][3], vp_matrix[3][3]); return view2; }
template <class R> OVR::Matrix4f GVRActivityT<R>::DrawEyeView(const int eye, const float fovDegrees) { const OVR::Matrix4f view = GetEyeView(eye, fovDegrees); // Transpose view matrix from oculus to mvp_matrix to rendering correctly with gvrf renderer. mvp_matrix = glm::mat4(view.M[0][0], view.M[1][0], view.M[2][0], view.M[3][0], view.M[0][1], view.M[1][1], view.M[2][1], view.M[3][1], view.M[0][2], view.M[1][2], view.M[2][2], view.M[3][2], view.M[0][3], view.M[1][3], view.M[2][3], view.M[3][3]); SetMVPMatrix(mvp_matrix); if (!sensoredSceneUpdated_ && headRotationProvider_.receivingUpdates()) { sensoredSceneUpdated_ = updateSensoredScene(); } glm::quat headRotation = headRotationProvider_.getPrediction(*this, (1 == eye ? 4.0f : 3.5f) / 60.0f); cameraRig_->getHeadTransform()->set_rotation(headRotation); JNIEnv* jni = app->GetVrJni(); jni->CallVoidMethod(javaObject, drawEyeViewMethodId, eye, fovDegrees); if (eye == 1) { jni->CallVoidMethod(javaObject, afterDrawEyesMethodId); } glm::mat4 view_matrix = camera->getViewMatrix(); glm::mat4 projection_matrix = camera->getProjectionMatrix(); //gun glm::mat4 vp_matrix = glm::mat4(projection_matrix * view_matrix); OVR::Matrix4f view2 = OVR::Matrix4f(vp_matrix[0][0], vp_matrix[1][0], vp_matrix[2][0], vp_matrix[3][0], vp_matrix[0][1], vp_matrix[1][1], vp_matrix[2][1], vp_matrix[3][1], vp_matrix[0][2], vp_matrix[1][2], vp_matrix[2][2], vp_matrix[3][2], vp_matrix[0][3], vp_matrix[1][3], vp_matrix[2][3], vp_matrix[3][3]); return view2; }