mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-27 07:18:57 -06:00
Pass window size as uniform instead of shader program constant. Fixes #143
This commit is contained in:
@@ -205,6 +205,7 @@ void RenderableStars::render(const RenderData& data) {
|
||||
_program->setUniform("alphaValue", _alphaValue);
|
||||
_program->setUniform("scaleFactor", _scaleFactor);
|
||||
_program->setUniform("minBillboardSize", _minBillboardSize);
|
||||
_program->setUniform("screenSize", glm::vec2(OsEng.renderEngine().renderingResolution()));
|
||||
|
||||
setPscUniforms(*_program.get(), data.camera, data.position);
|
||||
_program->setUniform("scaling", scaling);
|
||||
|
||||
@@ -53,6 +53,7 @@ uniform mat4 projection;
|
||||
|
||||
uniform float scaleFactor;
|
||||
uniform float minBillboardSize;
|
||||
uniform vec2 screenSize;
|
||||
|
||||
void main() {
|
||||
if ((psc_position[0].x == 0.0) && (psc_position[0].y == 0.0) && (psc_position[0].z == 0.0))
|
||||
@@ -75,7 +76,6 @@ void main() {
|
||||
|
||||
// Calculate the positions of the lower left and upper right corners of the
|
||||
// billboard in screen-space
|
||||
const vec2 screenSize = vec2(#{rendererData.windowWidth}, #{rendererData.windowHeight});
|
||||
vec2 ll = (((projPos[1].xy / projPos[1].w) + 1) / 2) * screenSize;
|
||||
vec2 ur = (((projPos[2].xy / projPos[2].w) + 1) / 2) * screenSize;
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ uniform sampler2DMS mainDepthTexture;
|
||||
|
||||
uniform bool insideRaycaster;
|
||||
uniform vec3 cameraPosInRaycaster;
|
||||
|
||||
uniform vec2 windowSize;
|
||||
|
||||
#include "blending.glsl"
|
||||
#include "rand.glsl"
|
||||
@@ -56,8 +56,7 @@ uniform int nAaSamples;
|
||||
|
||||
void main() {
|
||||
|
||||
vec2 texCoord = vec2(gl_FragCoord.x / #{rendererData.windowWidth},
|
||||
gl_FragCoord.y / #{rendererData.windowHeight});
|
||||
vec2 texCoord = vec2(gl_FragCoord.xy / windowSize);
|
||||
|
||||
|
||||
vec4 exitColorTexture = texture(exitColorTexture, texCoord);
|
||||
|
||||
@@ -561,8 +561,6 @@ void ABufferRenderer::updateRendererData() {
|
||||
PerfMeasure("ABufferRenderer::updateRendererData");
|
||||
|
||||
ghoul::Dictionary dict;
|
||||
dict.setValue("windowWidth", _resolution.x);
|
||||
dict.setValue("windowHeight", _resolution.y);
|
||||
dict.setValue("fragmentRendererPath", std::string(RenderFragmentShaderPath));
|
||||
dict.setValue("postFragmentRendererPath", std::string(PostRenderFragmentShaderPath));
|
||||
dict.setValue("maxLayers", MaxLayers);
|
||||
|
||||
@@ -401,6 +401,7 @@ void FramebufferRenderer::render(float blackoutFactor, bool doPerformanceMeasure
|
||||
raycastProgram->setUniform("mainDepthTexture", mainDepthTextureUnit);
|
||||
|
||||
raycastProgram->setUniform("nAaSamples", _nAaSamples);
|
||||
raycastProgram->setUniform("windowSize", glm::vec2(_resolution));
|
||||
|
||||
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
@@ -472,8 +473,6 @@ void FramebufferRenderer::updateRendererData() {
|
||||
ghoul::Dictionary dict;
|
||||
dict.setValue("fragmentRendererPath", std::string(RenderFragmentShaderPath));
|
||||
dict.setValue("postFragmentRendererPath", std::string(PostRenderFragmentShaderPath));
|
||||
dict.setValue("windowWidth", _resolution.x);
|
||||
dict.setValue("windowHeight", _resolution.y);
|
||||
|
||||
_rendererData = dict;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user