From 7b6033f7bc5f141b28cfbce713653cd1f3b3c1df Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Tue, 13 Jun 2017 11:37:27 -0700 Subject: [PATCH] Getting closer to a solution --- interface/src/SecondaryCamera.cpp | 1 + libraries/render-utils/src/DeferredLightingEffect.cpp | 3 +-- scripts/system/spectatorCamera.js | 6 +----- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/interface/src/SecondaryCamera.cpp b/interface/src/SecondaryCamera.cpp index 3f3d02af42..479c97c7f8 100644 --- a/interface/src/SecondaryCamera.cpp +++ b/interface/src/SecondaryCamera.cpp @@ -78,6 +78,7 @@ public: auto srcViewFrustum = args->getViewFrustum(); srcViewFrustum.setPosition(_position); srcViewFrustum.setOrientation(_orientation); + srcViewFrustum.setProjection(glm::perspective(45.0f, ((float)args->_viewport.z / (float)args->_viewport.w), 0.1f, 100.0f)); // Without calculating the bound planes, the secondary camera will use the same culling frustum as the main camera, // which is not what we want here. srcViewFrustum.calculate(); diff --git a/libraries/render-utils/src/DeferredLightingEffect.cpp b/libraries/render-utils/src/DeferredLightingEffect.cpp index 4b3ee9fec7..2ab13aecd6 100644 --- a/libraries/render-utils/src/DeferredLightingEffect.cpp +++ b/libraries/render-utils/src/DeferredLightingEffect.cpp @@ -420,8 +420,7 @@ model::MeshPointer DeferredLightingEffect::getSpotLightMesh() { void PreparePrimaryFramebuffer::run(const RenderContextPointer& renderContext, gpu::FramebufferPointer& primaryFramebuffer) { auto framebufferCache = DependencyManager::get(); - auto framebufferSize = framebufferCache->getFrameBufferSize(); - glm::uvec2 frameSize(framebufferSize.width(), framebufferSize.height()); + glm::uvec2 frameSize(renderContext->args->_viewport.z, renderContext->args->_viewport.w); // Resizing framebuffers instead of re-building them seems to cause issues with threaded // rendering diff --git a/scripts/system/spectatorCamera.js b/scripts/system/spectatorCamera.js index 9e83be1a0e..88f9e86ae5 100644 --- a/scripts/system/spectatorCamera.js +++ b/scripts/system/spectatorCamera.js @@ -133,12 +133,8 @@ parentID: camera, alpha: 1, position: { x: 0.007, y: 0.15, z: -0.005 }, - dimensions: { x: 0.16, y: -0.16 * windowAspectRatio / previewAspectRatio, z: 0 } + dimensions: { x: 0.16, y: 0.16 * windowAspectRatio / previewAspectRatio, z: 0 } // FIXME: This stretches the preview. - // FIXME: We shouldn't need the negative dimension. - // e.g., This isn't necessary using an ordinary .jpg with lettering, above. - // Must be something about the view frustum projection matrix? - // But don't go changing that in (c++ code) without getting all the way to a desktop display! }); Entities.editEntity(camera, { position: cameraPosition, rotation: cameraRotation }); setDisplay(monitorShowsCameraView);