mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 07:43:35 +02:00
Remove uniforms from bloom debug effect
This commit is contained in:
parent
719ae25adb
commit
cafd981744
3 changed files with 14 additions and 4 deletions
|
@ -21,7 +21,13 @@
|
||||||
|
|
||||||
<$declareStandardTransform()$>
|
<$declareStandardTransform()$>
|
||||||
|
|
||||||
layout(location=GPU_UNIFORM_TEXCOORD_RECT) uniform vec4 texcoordRect;
|
struct TexCoordRectParams {
|
||||||
|
vec4 texcoordRect;
|
||||||
|
};
|
||||||
|
|
||||||
|
layout(binding=0) uniform texcoordRectBuffer {
|
||||||
|
TexCoordRectParams params;
|
||||||
|
};
|
||||||
|
|
||||||
layout(location=0) out vec2 varTexCoord0;
|
layout(location=0) out vec2 varTexCoord0;
|
||||||
|
|
||||||
|
@ -39,5 +45,5 @@ void main(void) {
|
||||||
TransformObject obj = getTransformObject();
|
TransformObject obj = getTransformObject();
|
||||||
<$transformModelToClipPos(cam, obj, pos, gl_Position)$>
|
<$transformModelToClipPos(cam, obj, pos, gl_Position)$>
|
||||||
|
|
||||||
varTexCoord0 = ((pos.xy + 1.0) * 0.5) * texcoordRect.zw + texcoordRect.xy;
|
varTexCoord0 = ((pos.xy + 1.0) * 0.5) * params.texcoordRect.zw + params.texcoordRect.xy;
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,6 +184,7 @@ void BloomDraw::run(const render::RenderContextPointer& renderContext, const Inp
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugBloom::DebugBloom() {
|
DebugBloom::DebugBloom() {
|
||||||
|
_params = std::make_shared<gpu::Buffer>(sizeof(glm::vec4), nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebugBloom::configure(const Config& config) {
|
void DebugBloom::configure(const Config& config) {
|
||||||
|
@ -227,7 +228,8 @@ void DebugBloom::run(const render::RenderContextPointer& renderContext, const In
|
||||||
|
|
||||||
Transform modelTransform;
|
Transform modelTransform;
|
||||||
if (_mode == DebugBloomConfig::MODE_ALL_LEVELS) {
|
if (_mode == DebugBloomConfig::MODE_ALL_LEVELS) {
|
||||||
batch._glUniform4f(gpu::slot::uniform::TexCoordRect, 0.0f, 0.0f, 1.f, 1.f);
|
_params->setSubData(0, vec4(0.0f, 0.0f, 1.f, 1.f));
|
||||||
|
batch.setUniformBuffer(0, _params);
|
||||||
|
|
||||||
modelTransform = gpu::Framebuffer::evalSubregionTexcoordTransform(framebufferSize, args->_viewport / 2);
|
modelTransform = gpu::Framebuffer::evalSubregionTexcoordTransform(framebufferSize, args->_viewport / 2);
|
||||||
modelTransform.postTranslate(glm::vec3(-1.0f, 1.0f, 0.0f));
|
modelTransform.postTranslate(glm::vec3(-1.0f, 1.0f, 0.0f));
|
||||||
|
@ -255,7 +257,8 @@ void DebugBloom::run(const render::RenderContextPointer& renderContext, const In
|
||||||
|
|
||||||
viewport.z /= 2;
|
viewport.z /= 2;
|
||||||
|
|
||||||
batch._glUniform4f(gpu::slot::uniform::TexCoordRect, 0.5f, 0.0f, 0.5f, 1.f);
|
_params->setSubData(0, vec4(0.5f, 0.0f, 0.5f, 1.f));
|
||||||
|
batch.setUniformBuffer(0, _params);
|
||||||
|
|
||||||
modelTransform = gpu::Framebuffer::evalSubregionTexcoordTransform(framebufferSize, viewport);
|
modelTransform = gpu::Framebuffer::evalSubregionTexcoordTransform(framebufferSize, viewport);
|
||||||
modelTransform.postTranslate(glm::vec3(-1.0f, 0.0f, 0.0f));
|
modelTransform.postTranslate(glm::vec3(-1.0f, 0.0f, 0.0f));
|
||||||
|
|
|
@ -121,6 +121,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
gpu::PipelinePointer _pipeline;
|
gpu::PipelinePointer _pipeline;
|
||||||
|
gpu::BufferPointer _params;
|
||||||
DebugBloomConfig::Mode _mode;
|
DebugBloomConfig::Mode _mode;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue