Skip to content

Commit

Permalink
work on 360 video
Browse files Browse the repository at this point in the history
  • Loading branch information
di57mec committed Sep 28, 2019
1 parent 113ca9c commit f9aa905
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
5 changes: 5 additions & 0 deletions app/src/main/cpp/GLRenderer/SceneStereoscopic.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//
// Created by Consti10 on 28/09/2019.
//

#include "SceneStereoscopic.h"
15 changes: 15 additions & 0 deletions app/src/main/cpp/GLRenderer/SceneStereoscopic.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// Created by Consti10 on 28/09/2019.
//

#ifndef FPV_VR_2018_SCENESTEREOSCOPIC_H
#define FPV_VR_2018_SCENESTEREOSCOPIC_H

//TODO merge code for StereoNormal / StereoSupersync even more

class SceneStereoscopic {

};


#endif //FPV_VR_2018_SCENESTEREOSCOPIC_H
3 changes: 2 additions & 1 deletion app/src/main/cpp/Other/MatricesManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ void MatricesManager::calculateProjectionAndDefaultView360(float fov360Video,flo
worldMatrices.projection360=glm::perspective(glm::radians(fov360Video), ratio, MIN_Z_DISTANCE, MAX_Z_DISTANCE);
worldMatrices.monoViewTracked360=glm::mat4(1.0f);
worldMatrices.monoForward360=glm::mat4(1.0f);
worldMatrices.monoForward360 = glm::rotate(glm::mat4(1.0f),glm::radians(90.0f), glm::vec3(0,1,0)); //Default- rotate 90 around y axis
//worldMatrices.monoForward360 = glm::rotate(glm::mat4(1.0f),glm::radians(90.0f), glm::vec3(0,0,-1)); //Default view direction, the gvr sphere is slightly different -
//For 'normal'video its layout is fine, but for insta360 video the default view direction is wrong
}

void MatricesManager::calculateNewHeadPoseIfNeeded(gvr::GvrApi *gvr_api, const int predictMS) {
Expand Down
6 changes: 5 additions & 1 deletion app/src/main/cpp/Scene/Video/VideoRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,12 @@ void VideoRenderer::drawVideoCanvas360(glm::mat4x4 ViewM, glm::mat4x4 ProjM) {
if(mMode!=VIDEO_RENDERING_MODE::RM_Degree360){
throw "mMode!=VIDEO_RENDERING_MODE::Degree360";
}
//Default view direction, the gvr sphere is slightly different -
//For 'normal'video its layout is fine, but for insta360 video the default view direction is wrong
glm::mat4x4 modelMatrix=glm::rotate(glm::mat4(1.0F),glm::radians(90.0F), glm::vec3(0,0,-1));

mGLProgramSpherical->beforeDraw(mGLBuffSphereVertices);
mGLProgramSpherical->draw(ViewM,ProjM,mSphere.getVertexCount());
mGLProgramSpherical->draw(ViewM*modelMatrix,ProjM,mSphere.getVertexCount());
mGLProgramSpherical->afterDraw();
GLHelper::checkGlError("VideoRenderer::drawVideoCanvas360");
}
Expand Down

0 comments on commit f9aa905

Please sign in to comment.