mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 14:47:41 +02:00
Introducing debug flags
This commit is contained in:
parent
0a3c1712eb
commit
f70702beb7
3 changed files with 27 additions and 9 deletions
|
@ -22,6 +22,11 @@
|
||||||
|
|
||||||
using namespace render;
|
using namespace render;
|
||||||
|
|
||||||
|
void PrepareStencil::configure(const Config& config) {
|
||||||
|
_maskMode = config.maskMode;
|
||||||
|
_forceDraw = config.forceDraw;
|
||||||
|
}
|
||||||
|
|
||||||
model::MeshPointer PrepareStencil::getMesh() {
|
model::MeshPointer PrepareStencil::getMesh() {
|
||||||
if (!_mesh) {
|
if (!_mesh) {
|
||||||
|
|
||||||
|
@ -72,8 +77,8 @@ gpu::PipelinePointer PrepareStencil::getPaintStencilPipeline() {
|
||||||
void PrepareStencil::run(const RenderContextPointer& renderContext, const gpu::FramebufferPointer& srcFramebuffer) {
|
void PrepareStencil::run(const RenderContextPointer& renderContext, const gpu::FramebufferPointer& srcFramebuffer) {
|
||||||
RenderArgs* args = renderContext->args;
|
RenderArgs* args = renderContext->args;
|
||||||
|
|
||||||
// Only draw the stencil mask if in HMD mode.
|
// Only draw the stencil mask if in HMD mode or not forced.
|
||||||
if (args->_displayMode != RenderArgs::STEREO_HMD) {
|
if (!_forceDraw && (args->_displayMode != RenderArgs::STEREO_HMD)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +87,7 @@ void PrepareStencil::run(const RenderContextPointer& renderContext, const gpu::F
|
||||||
|
|
||||||
batch.setViewportTransform(args->_viewport);
|
batch.setViewportTransform(args->_viewport);
|
||||||
|
|
||||||
if (false) {
|
if (_maskMode < 0) {
|
||||||
batch.setPipeline(getMeshStencilPipeline());
|
batch.setPipeline(getMeshStencilPipeline());
|
||||||
|
|
||||||
auto mesh = getMesh();
|
auto mesh = getMesh();
|
||||||
|
|
|
@ -16,16 +16,28 @@
|
||||||
#include <gpu/Pipeline.h>
|
#include <gpu/Pipeline.h>
|
||||||
#include <model/Geometry.h>
|
#include <model/Geometry.h>
|
||||||
|
|
||||||
|
class PrepareStencilConfig : public render::Job::Config {
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(int maskMode MEMBER maskMode NOTIFY dirty)
|
||||||
|
Q_PROPERTY(bool forceDraw MEMBER forceDraw NOTIFY dirty)
|
||||||
|
|
||||||
|
public:
|
||||||
|
PrepareStencilConfig(bool enabled = true) : JobConfig(enabled) {}
|
||||||
|
|
||||||
|
int maskMode { 0 };
|
||||||
|
bool forceDraw { false };
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void dirty();
|
||||||
|
};
|
||||||
|
|
||||||
class PrepareStencil {
|
class PrepareStencil {
|
||||||
public:
|
public:
|
||||||
class Config : public render::JobConfig {
|
using Config = PrepareStencilConfig;
|
||||||
public:
|
|
||||||
Config(bool enabled = true) : JobConfig(enabled) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
using JobModel = render::Job::ModelI<PrepareStencil, gpu::FramebufferPointer, Config>;
|
using JobModel = render::Job::ModelI<PrepareStencil, gpu::FramebufferPointer, Config>;
|
||||||
|
|
||||||
void configure(const Config& config) {}
|
void configure(const Config& config);
|
||||||
|
|
||||||
void run(const render::RenderContextPointer& renderContext, const gpu::FramebufferPointer& dstFramebuffer);
|
void run(const render::RenderContextPointer& renderContext, const gpu::FramebufferPointer& dstFramebuffer);
|
||||||
|
|
||||||
|
@ -51,6 +63,8 @@ private:
|
||||||
model::MeshPointer _mesh;
|
model::MeshPointer _mesh;
|
||||||
model::MeshPointer getMesh();
|
model::MeshPointer getMesh();
|
||||||
|
|
||||||
|
int _maskMode { 0 };
|
||||||
|
bool _forceDraw { false };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,6 @@ void ToneMappingEffect::init() {
|
||||||
slotBindings.insert(gpu::Shader::Binding(std::string("colorMap"), ToneMappingEffect_LightingMapSlot));
|
slotBindings.insert(gpu::Shader::Binding(std::string("colorMap"), ToneMappingEffect_LightingMapSlot));
|
||||||
gpu::Shader::makeProgram(*blitProgram, slotBindings);
|
gpu::Shader::makeProgram(*blitProgram, slotBindings);
|
||||||
auto blitState = std::make_shared<gpu::State>();
|
auto blitState = std::make_shared<gpu::State>();
|
||||||
PrepareStencil::testMask(*blitState);
|
|
||||||
blitState->setColorWriteMask(true, true, true, true);
|
blitState->setColorWriteMask(true, true, true, true);
|
||||||
_blitLightBuffer = gpu::PipelinePointer(gpu::Pipeline::create(blitProgram, blitState));
|
_blitLightBuffer = gpu::PipelinePointer(gpu::Pipeline::create(blitProgram, blitState));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue