12 #ifndef hifi_StencilMaskPass_h
13 #define hifi_StencilMaskPass_h
15 #include <render/Engine.h>
16 #include <gpu/Pipeline.h>
17 #include <graphics/Geometry.h>
18 #include <StencilMaskMode.h>
20 class PrepareStencilConfig :
public render::Job::Config {
22 Q_PROPERTY(StencilMaskMode maskMode MEMBER maskMode NOTIFY dirty)
25 PrepareStencilConfig(
bool enabled =
true) : JobConfig(enabled) {}
30 StencilMaskMode maskMode { StencilMaskMode::NONE };
36 class PrepareStencil {
38 using Config = PrepareStencilConfig;
40 using JobModel = render::Job::ModelI<PrepareStencil, gpu::FramebufferPointer, Config>;
42 void configure(
const Config& config);
44 void run(
const render::RenderContextPointer& renderContext,
const gpu::FramebufferPointer& dstFramebuffer);
47 static const gpu::int8 STENCIL_BACKGROUND = 0;
48 static const gpu::int8 STENCIL_MASK = 1 << 0;
49 static const gpu::int8 STENCIL_SHAPE = 1 << 1;
50 static const gpu::int8 STENCIL_NO_AA = 1 << 2;
52 static void drawMask(gpu::State& state);
53 static void drawBackground(gpu::State& state);
54 static void testMask(gpu::State& state);
55 static void testNoAA(gpu::State& state);
56 static void testBackground(gpu::State& state);
57 static void testShape(gpu::State& state);
58 static void testMaskDrawShape(gpu::State& state);
59 static void testMaskDrawShapeNoAA(gpu::State& state);
62 gpu::PipelinePointer _meshStencilPipeline;
63 gpu::PipelinePointer getMeshStencilPipeline();
65 gpu::PipelinePointer _paintStencilPipeline;
66 gpu::PipelinePointer getPaintStencilPipeline();
68 graphics::MeshPointer _mesh;
69 graphics::MeshPointer getMesh();
71 StencilMaskMode _maskMode { StencilMaskMode::NONE };