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  using Input = render::ItemBounds;
54  using Output = render::ItemBounds;
55  using Config = ZoneRendererConfig;
56  using JobModel = render::Task::ModelIO<ZoneRendererTask, Input, Output, Config>;
57 
58  ZoneRendererTask() {}
59 
60  void build(JobModel& task, const render::Varying& input, render::Varying& output);
61 
62  void configure(const Config& config) { _maxDrawn = config.maxDrawn; }
63 
64 protected:
65  int _maxDrawn; // initialized by Config
66 };
67 
68 class DebugZoneLighting {
69 public:
70  class Config : public render::JobConfig {
71  public:
72  Config(bool enabled = false) : JobConfig(enabled) {}
73  };
74 
75  using Inputs = render::VaryingSet3<DeferredFrameTransformPointer, LightStage::FramePointer, BackgroundStage::FramePointer>;
76  using JobModel = render::Job::ModelI<DebugZoneLighting, Inputs, Config>;
77 
78  DebugZoneLighting() {}
79 
80  void configure(const Config& configuration) {}
81  void run(const render::RenderContextPointer& context, const Inputs& inputs);
82 
83 protected:
84 
85  static gpu::PipelinePointer _keyLightPipeline;
86  static gpu::PipelinePointer _ambientPipeline;
87  static gpu::PipelinePointer _backgroundPipeline;
88 
89  static const gpu::PipelinePointer& getKeyLightPipeline();
90  static const gpu::PipelinePointer& getAmbientPipeline();
91  static const gpu::PipelinePointer& getBackgroundPipeline();
92 };
93 
94 
95 #endif