13 #ifndef hifi_render_DrawSceneOctree_h
14 #define hifi_render_DrawSceneOctree_h
16 #include <ViewFrustum.h>
17 #include <gpu/Batch.h>
22 class DrawSceneOctreeConfig :
public Job::Config {
24 Q_PROPERTY(
bool showVisibleCells READ getShowVisibleCells WRITE setShowVisibleCells NOTIFY dirty())
25 Q_PROPERTY(
bool showEmptyCells READ getShowEmptyCells WRITE setShowEmptyCells NOTIFY dirty())
26 Q_PROPERTY(
bool showLODReticle READ getShowLODReticle WRITE setShowLODReticle NOTIFY dirty())
27 Q_PROPERTY(
int numAllocatedCells READ getNumAllocatedCells)
28 Q_PROPERTY(
int numFreeCells READ getNumFreeCells)
32 DrawSceneOctreeConfig() : Job::Config(false) {}
34 int numAllocatedCells{ 0 };
35 int numFreeCells{ 0 };
37 int getNumAllocatedCells()
const {
return numAllocatedCells; }
38 int getNumFreeCells()
const {
return numFreeCells; }
40 bool showVisibleCells {
false };
41 bool showEmptyCells {
false };
42 bool showLODReticle {
false };
44 bool getShowVisibleCells() {
return showVisibleCells; }
45 bool getShowEmptyCells() {
return showEmptyCells; }
46 bool getShowLODReticle() {
return showLODReticle; }
49 void setShowVisibleCells(
bool show) { showVisibleCells = show; emit dirty(); }
50 void setShowEmptyCells(
bool show) { showEmptyCells = show; emit dirty(); }
51 void setShowLODReticle(
bool show) { showLODReticle = show; emit dirty(); }
57 class DrawSceneOctree {
58 static gpu::PipelinePointer _drawCellBoundsPipeline;
59 static gpu::PipelinePointer _drawLODReticlePipeline;
60 static gpu::PipelinePointer _drawItemBoundPipeline;
61 static gpu::Stream::FormatPointer _cellBoundsFormat;
62 gpu::BufferPointer _cellBoundsBuffer { std::make_shared<gpu::Buffer>(gpu::Buffer::VertexBuffer) };
65 bool _showVisibleCells;
70 using Config = DrawSceneOctreeConfig;
71 using JobModel = Job::ModelI<DrawSceneOctree, ItemSpatialTree::ItemSelection, Config>;
73 DrawSceneOctree(uint transformSlot);
75 void configure(
const Config& config);
76 void run(
const RenderContextPointer& renderContext,
const ItemSpatialTree::ItemSelection& selection);
81 static const gpu::PipelinePointer getDrawCellBoundsPipeline();
82 static const gpu::PipelinePointer getDrawLODReticlePipeline();
83 static const gpu::PipelinePointer getDrawItemBoundPipeline();
87 class DrawItemSelectionConfig :
public Job::Config {
89 Q_PROPERTY(
bool showInsideItems READ getShowInsideItems WRITE setShowInsideItems NOTIFY dirty())
90 Q_PROPERTY(
bool showInsideSubcellItems READ getShowInsideSubcellItems WRITE setShowInsideSubcellItems NOTIFY dirty())
91 Q_PROPERTY(
bool showPartialItems READ getShowPartialItems WRITE setShowPartialItems NOTIFY dirty())
92 Q_PROPERTY(
bool showPartialSubcellItems READ getShowPartialSubcellItems WRITE setShowPartialSubcellItems NOTIFY dirty())
95 DrawItemSelectionConfig() : Job::Config(false) {}
97 bool showInsideItems{
true };
98 bool showInsideSubcellItems{
true };
99 bool showPartialItems{
true };
100 bool showPartialSubcellItems{
true };
102 bool getShowInsideItems()
const {
return showInsideItems; };
103 bool getShowInsideSubcellItems()
const {
return showInsideSubcellItems; };
104 bool getShowPartialItems()
const {
return showPartialItems; };
105 bool getShowPartialSubcellItems()
const {
return showPartialSubcellItems; };
108 void setShowInsideItems(
bool show) { showInsideItems = show; emit dirty(); }
109 void setShowInsideSubcellItems(
bool show) { showInsideSubcellItems = show; emit dirty(); }
110 void setShowPartialItems(
bool show) { showPartialItems = show; emit dirty(); }
111 void setShowPartialSubcellItems(
bool show) { showPartialSubcellItems = show; emit dirty(); }
117 class DrawItemSelection {
118 static gpu::PipelinePointer _drawItemBoundPipeline;
119 gpu::BufferPointer _boundsBufferInside;
120 gpu::BufferPointer _boundsBufferInsideSubcell;
121 gpu::BufferPointer _boundsBufferPartial;
122 gpu::BufferPointer _boundsBufferPartialSubcell;
124 bool _showInsideItems;
125 bool _showInsideSubcellItems;
126 bool _showPartialItems;
127 bool _showPartialSubcellItems;
130 using Config = DrawItemSelectionConfig;
131 using JobModel = Job::ModelI<DrawItemSelection, ItemSpatialTree::ItemSelection, Config>;
133 DrawItemSelection(uint transformSlot) : _transformSlot(transformSlot) {}
135 void configure(
const Config& config);
136 void run(
const RenderContextPointer& renderContext,
const ItemSpatialTree::ItemSelection& selection);
141 static const gpu::PipelinePointer getDrawItemBoundPipeline();