mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
Use the drawing resolution in the case of non-linear projections correctly (closes #2745)
This commit is contained in:
Submodule apps/OpenSpace/ext/sgct updated: 95f3de3858...2a4e0fa3fc
@@ -97,6 +97,7 @@ const BaseViewport* currentViewport = nullptr;
|
||||
Frustum::Mode currentFrustumMode;
|
||||
glm::mat4 currentModelViewProjectionMatrix;
|
||||
glm::mat4 currentModelMatrix;
|
||||
glm::ivec2 currentDrawResolution;
|
||||
|
||||
#ifdef OPENVR_SUPPORT
|
||||
Window* FirstOpenVRWindow = nullptr;
|
||||
@@ -449,6 +450,7 @@ void mainRenderFunc(const sgct::RenderData& data) {
|
||||
currentWindow = &data.window;
|
||||
currentViewport = &data.viewport;
|
||||
currentFrustumMode = data.frustumMode;
|
||||
currentDrawResolution = glm::ivec2(data.bufferSize.x, data.bufferSize.y);
|
||||
|
||||
glm::vec3 pos;
|
||||
std::memcpy(
|
||||
@@ -533,6 +535,7 @@ void mainDraw2DFunc(const sgct::RenderData& data) {
|
||||
currentWindow = &data.window;
|
||||
currentViewport = &data.viewport;
|
||||
currentFrustumMode = data.frustumMode;
|
||||
currentDrawResolution = glm::ivec2(data.bufferSize.x, data.bufferSize.y);
|
||||
|
||||
try {
|
||||
global::openSpaceEngine->drawOverlays();
|
||||
@@ -766,7 +769,7 @@ void setSgctDelegateFunctions() {
|
||||
ZoneScoped;
|
||||
|
||||
const Viewport* viewport = dynamic_cast<const Viewport*>(currentViewport);
|
||||
if (viewport != nullptr) {
|
||||
if (viewport) {
|
||||
if (viewport->hasSubViewports() && viewport->nonLinearProjection()) {
|
||||
ivec2 dim = viewport->nonLinearProjection()->cubemapResolution();
|
||||
return glm::ivec2(dim.x, dim.y);
|
||||
@@ -776,7 +779,9 @@ void setSgctDelegateFunctions() {
|
||||
return glm::ivec2(dim.x, dim.y);
|
||||
}
|
||||
}
|
||||
return glm::ivec2(-1, -1);
|
||||
else {
|
||||
return currentDrawResolution;
|
||||
}
|
||||
};
|
||||
sgctDelegate.currentViewportSize = []() {
|
||||
ZoneScoped;
|
||||
|
||||
@@ -231,6 +231,15 @@ void ShadowComponent::deinitializeGL() {
|
||||
}
|
||||
|
||||
RenderData ShadowComponent::begin(const RenderData& data) {
|
||||
glm::ivec2 renderingResolution = global::renderEngine->renderingResolution();
|
||||
if (_dynamicDepthTextureRes && ((_shadowDepthTextureWidth != renderingResolution.x) ||
|
||||
(_shadowDepthTextureHeight != renderingResolution.y)))
|
||||
{
|
||||
_shadowDepthTextureWidth = renderingResolution.x * 2;
|
||||
_shadowDepthTextureHeight = renderingResolution.y * 2;
|
||||
updateDepthTexture();
|
||||
}
|
||||
|
||||
// ===========================================
|
||||
// Builds light's ModelViewProjectionMatrix:
|
||||
// ===========================================
|
||||
@@ -375,15 +384,6 @@ void ShadowComponent::update(const UpdateData&) {
|
||||
else {
|
||||
_sunPosition = glm::dvec3(0.0);
|
||||
}
|
||||
|
||||
glm::ivec2 renderingResolution = global::renderEngine->renderingResolution();
|
||||
if (_dynamicDepthTextureRes && ((_shadowDepthTextureWidth != renderingResolution.x) ||
|
||||
(_shadowDepthTextureHeight != renderingResolution.y)))
|
||||
{
|
||||
_shadowDepthTextureWidth = renderingResolution.x * 2;
|
||||
_shadowDepthTextureHeight = renderingResolution.y * 2;
|
||||
updateDepthTexture();
|
||||
}
|
||||
}
|
||||
|
||||
void ShadowComponent::createDepthTexture() {
|
||||
|
||||
Reference in New Issue
Block a user