// set up the camera with the view and the shader of the rendering object
void HoloPlayContext::setupVirtualCameraForView(int currentViewIndex, glm::mat4 currentViewMatrix) {
// field of view is always 14 according to measurement
const float fov = glm::radians(14.0f);
// calculate the camera distance, which is actually static when camera size keeps the same
float cameraDistance = -cameraSize / tan(fov / 2.0f);
// start at -viewCone * 0.5 and go up to viewCone * 0.5
float offsetAngle = (currentViewIndex / (qs_totalViews - 1.0f) - 0.5f) * glm::radians(viewCone);
float offset = cameraDistance * tan(offsetAngle);
// calculate the offset that the camera should move
// move the camera by offset and camera distance at x and z direction
viewMatrix = glm::translate(currentViewMatrix, glm::vec3(offset, 0.0f, cameraDistance));
float aspectRatio = getWindowRatio();
// main projection is always the same
projectionMatrix = glm::perspective(fov, aspectRatio, 0.1f, 100.0f);
// changes the projection matrix to be parallel
projectionMatrix[2][0] += offset / (cameraSize * aspectRatio);