mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-15 17:46:47 +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()$>
|
||||
|
||||
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;
|
||||
|
||||
|
@ -39,5 +45,5 @@ void main(void) {
|
|||
TransformObject obj = getTransformObject();
|
||||
<$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() {
|
||||
_params = std::make_shared<gpu::Buffer>(sizeof(glm::vec4), nullptr);
|
||||
}
|
||||
|
||||
void DebugBloom::configure(const Config& config) {
|
||||
|
@ -227,7 +228,8 @@ void DebugBloom::run(const render::RenderContextPointer& renderContext, const In
|
|||
|
||||
Transform modelTransform;
|
||||
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.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;
|
||||
|
||||
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.postTranslate(glm::vec3(-1.0f, 0.0f, 0.0f));
|
||||
|
|
|
@ -121,6 +121,7 @@ public:
|
|||
|
||||
private:
|
||||
gpu::PipelinePointer _pipeline;
|
||||
gpu::BufferPointer _params;
|
||||
DebugBloomConfig::Mode _mode;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue