Overte C++ Documentation
DrawStatus.h
1 //
2 // DrawStatus.h
3 // render/src/render
4 //
5 // Created by Niraj Venkat on 6/29/15.
6 // Copyright 2015 High Fidelity, Inc.
7 // Copyright 2023 Overte e.V.
8 //
9 // Distributed under the Apache License, Version 2.0.
10 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
11 // SPDX-License-Identifier: Apache-2.0
12 //
13 
14 #ifndef hifi_render_DrawStatus_h
15 #define hifi_render_DrawStatus_h
16 
17 #include "DrawTask.h"
18 #include "gpu/Batch.h"
19 
20 namespace render {
21  class DrawStatusConfig : public Job::Config {
22  Q_OBJECT
23  Q_PROPERTY(bool showDisplay MEMBER showDisplay WRITE setShowDisplay)
24  Q_PROPERTY(bool showNetwork MEMBER showNetwork WRITE setShowNetwork)
25  public:
26  DrawStatusConfig() : Job::Config(false) {} // FIXME FOR debug
27 
28  void dirtyHelper();
29 
30  bool showDisplay{ false };
31  bool showNetwork{ false };
32  bool showFade{ false };
33 
34  public slots:
35  void setShowDisplay(bool enabled) { showDisplay = enabled; dirtyHelper(); }
36  void setShowNetwork(bool enabled) { showNetwork = enabled; dirtyHelper(); }
37  void setShowFade(bool enabled) { showFade = enabled; dirtyHelper(); }
38 
39  signals:
40  void dirty();
41  };
42 
43  class DrawStatus {
44  public:
45  using Config = DrawStatusConfig;
46  using Input = VaryingSet2<ItemBounds, glm::vec2>;
47  using JobModel = Job::ModelI<DrawStatus, Input, Config>;
48 
49  DrawStatus() {}
50  DrawStatus(const gpu::TexturePointer statusIconMap) { setStatusIconMap(statusIconMap); }
51 
52  void configure(const Config& config);
53  void run(const RenderContextPointer& renderContext, const Input& input);
54 
55  const gpu::PipelinePointer getDrawItemBoundsPipeline();
56  const gpu::PipelinePointer getDrawItemStatusPipeline();
57 
58  void setStatusIconMap(const gpu::TexturePointer& map);
59  const gpu::TexturePointer getStatusIconMap() const;
60 
61  protected:
62  bool _showDisplay { false }; // initialized by Config
63  bool _showNetwork { false }; // initialized by Config
64  bool _showFade { false }; // initialized by Config
65 
66  gpu::Stream::FormatPointer _drawItemFormat;
67  gpu::PipelinePointer _drawItemBoundsPipeline;
68  gpu::PipelinePointer _drawItemStatusPipeline;
69 
70  gpu::BufferPointer _boundsBuffer;
71  gpu::BufferPointer _instanceBuffer;
72  gpu::Stream::FormatPointer _vertexFormat;
73  gpu::TexturePointer _statusIconMap;
74  };
75 }
76 
77 #endif // hifi_render_DrawStatus_h