12 #ifndef hifi_render_DrawSceneOctree_h
13 #define hifi_render_DrawSceneOctree_h
15 #include <ViewFrustum.h>
16 #include <gpu/Batch.h>
21 class DrawSceneOctreeConfig :
public Job::Config {
23 Q_PROPERTY(
bool showVisibleCells READ getShowVisibleCells WRITE setShowVisibleCells NOTIFY dirty())
24 Q_PROPERTY(
bool showEmptyCells READ getShowEmptyCells WRITE setShowEmptyCells NOTIFY dirty())
25 Q_PROPERTY(
int numAllocatedCells READ getNumAllocatedCells)
26 Q_PROPERTY(
int numFreeCells READ getNumFreeCells)
30 DrawSceneOctreeConfig() : Job::Config(false) {}
32 int numAllocatedCells{ 0 };
33 int numFreeCells{ 0 };
35 int getNumAllocatedCells()
const {
return numAllocatedCells; }
36 int getNumFreeCells()
const {
return numFreeCells; }
38 bool showVisibleCells{
true };
39 bool showEmptyCells{
false };
41 bool getShowVisibleCells() {
return showVisibleCells; }
42 bool getShowEmptyCells() {
return showEmptyCells; }
45 void setShowVisibleCells(
bool show) { showVisibleCells = show; emit dirty(); }
46 void setShowEmptyCells(
bool show) { showEmptyCells = show; emit dirty(); }
52 class DrawSceneOctree {
53 gpu::PipelinePointer _drawCellBoundsPipeline;
54 gpu::PipelinePointer _drawLODReticlePipeline;
55 gpu::PipelinePointer _drawItemBoundPipeline;
56 gpu::BufferPointer _cellBoundsBuffer;
57 gpu::Stream::FormatPointer _cellBoundsFormat;
59 bool _showVisibleCells;
63 using Config = DrawSceneOctreeConfig;
64 using JobModel = Job::ModelI<DrawSceneOctree, ItemSpatialTree::ItemSelection, Config>;
68 void configure(
const Config& config);
69 void run(
const RenderContextPointer& renderContext,
const ItemSpatialTree::ItemSelection& selection);
71 const gpu::PipelinePointer getDrawCellBoundsPipeline();
72 const gpu::PipelinePointer getDrawLODReticlePipeline();
73 const gpu::PipelinePointer getDrawItemBoundPipeline();
77 class DrawItemSelectionConfig :
public Job::Config {
79 Q_PROPERTY(
bool showInsideItems READ getShowInsideItems WRITE setShowInsideItems NOTIFY dirty())
80 Q_PROPERTY(
bool showInsideSubcellItems READ getShowInsideSubcellItems WRITE setShowInsideSubcellItems NOTIFY dirty())
81 Q_PROPERTY(
bool showPartialItems READ getShowPartialItems WRITE setShowPartialItems NOTIFY dirty())
82 Q_PROPERTY(
bool showPartialSubcellItems READ getShowPartialSubcellItems WRITE setShowPartialSubcellItems NOTIFY dirty())
85 DrawItemSelectionConfig() : Job::Config(false) {}
87 bool showInsideItems{
true };
88 bool showInsideSubcellItems{
true };
89 bool showPartialItems{
true };
90 bool showPartialSubcellItems{
true };
92 bool getShowInsideItems()
const {
return showInsideItems; };
93 bool getShowInsideSubcellItems()
const {
return showInsideSubcellItems; };
94 bool getShowPartialItems()
const {
return showPartialItems; };
95 bool getShowPartialSubcellItems()
const {
return showPartialSubcellItems; };
98 void setShowInsideItems(
bool show) { showInsideItems = show; emit dirty(); }
99 void setShowInsideSubcellItems(
bool show) { showInsideSubcellItems = show; emit dirty(); }
100 void setShowPartialItems(
bool show) { showPartialItems = show; emit dirty(); }
101 void setShowPartialSubcellItems(
bool show) { showPartialSubcellItems = show; emit dirty(); }
107 class DrawItemSelection {
108 gpu::PipelinePointer _drawItemBoundPipeline;
109 gpu::BufferPointer _boundsBufferInside;
110 gpu::BufferPointer _boundsBufferInsideSubcell;
111 gpu::BufferPointer _boundsBufferPartial;
112 gpu::BufferPointer _boundsBufferPartialSubcell;
114 bool _showInsideItems;
115 bool _showInsideSubcellItems;
116 bool _showPartialItems;
117 bool _showPartialSubcellItems;
120 using Config = DrawItemSelectionConfig;
121 using JobModel = Job::ModelI<DrawItemSelection, ItemSpatialTree::ItemSelection, Config>;
123 DrawItemSelection() {}
125 void configure(
const Config& config);
126 void run(
const RenderContextPointer& renderContext,
const ItemSpatialTree::ItemSelection& selection);
128 const gpu::PipelinePointer getDrawItemBoundPipeline();