Overte C++ Documentation
ZoneRenderer.h
1 //
2 // ZoneRenderer.h
3 // render/src/render-utils
4 //
5 // Created by Sam Gateau on 4/4/2017.
6 // Copyright 2017 High Fidelity, Inc.
7 //
8 // Distributed under the Apache License, Version 2.0.
9 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10 //
11 
12 #ifndef hifi_ZoneRenderer_h
13 #define hifi_ZoneRenderer_h
14 
15 #include "render/Engine.h"
16 
17 #include "DeferredFrameTransform.h"
18 
19 #include "LightStage.h"
20 #include "BackgroundStage.h"
21 
22 class SetupZones {
23 public:
24  using Input = render::ItemBounds;
25  using JobModel = render::Job::ModelI<SetupZones, Input>;
26 
27  SetupZones() {}
28 
29  void run(const render::RenderContextPointer& context, const Input& input);
30 };
31 
32 class ZoneRendererConfig : public render::Task::Config {
33  Q_OBJECT
34  Q_PROPERTY(int maxDrawn MEMBER maxDrawn NOTIFY dirty)
35 public:
36 
37  ZoneRendererConfig() : render::Task::Config(
38  ) {}
39 
40  int maxDrawn { -1 };
41 
42 signals:
43  void dirty();
44 
45 protected:
46 };
47 
48 class ZoneRendererTask {
49 public:
50 
51  static const render::Selection::Name ZONES_SELECTION;
52 
53 
54  using Input = render::ItemBounds;
55  using Output = render::ItemBounds;
56  using Config = ZoneRendererConfig;
57  using JobModel = render::Task::ModelIO<ZoneRendererTask, Input, Output, Config>;
58 
59  ZoneRendererTask() {}
60 
61  void build(JobModel& task, const render::Varying& input, render::Varying& output);
62 
63  void configure(const Config& config) { _maxDrawn = config.maxDrawn; }
64 
65 protected:
66  int _maxDrawn; // initialized by Config
67 };
68 
69 class DebugZoneLighting {
70 public:
71  class Config : public render::JobConfig {
72  public:
73  Config(bool enabled = false) : JobConfig(enabled) {}
74  };
75 
76  using Inputs = render::VaryingSet3<DeferredFrameTransformPointer, LightStage::FramePointer, BackgroundStage::FramePointer>;
77  using JobModel = render::Job::ModelI<DebugZoneLighting, Inputs, Config>;
78 
79  DebugZoneLighting() {}
80 
81  void configure(const Config& configuration) {}
82  void run(const render::RenderContextPointer& context, const Inputs& inputs);
83 
84 protected:
85 
86  gpu::PipelinePointer _keyLightPipeline;
87  gpu::PipelinePointer _ambientPipeline;
88  gpu::PipelinePointer _backgroundPipeline;
89 
90  const gpu::PipelinePointer& getKeyLightPipeline();
91  const gpu::PipelinePointer& getAmbientPipeline();
92  const gpu::PipelinePointer& getBackgroundPipeline();
93 };
94 
95 
96 #endif