mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-10 11:41:59 +02:00
fix layered simulate items
This commit is contained in:
parent
0538284492
commit
968fa4af51
3 changed files with 34 additions and 9 deletions
|
@ -148,3 +148,11 @@ void IDsToBounds::run(const RenderContextPointer& renderContext, const ItemIDs&
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MergeItems::run(const RenderContextPointer& renderContext, const Inputs& inputs, Outputs& outputs) {
|
||||
const auto& array1 = inputs.get0();
|
||||
const auto& array2 = inputs.get1();
|
||||
|
||||
outputs = array1;
|
||||
outputs.insert(outputs.end(), array2.begin(), array2.end());
|
||||
}
|
||||
|
|
|
@ -158,6 +158,18 @@ namespace render {
|
|||
bool _disableAABBs{ false };
|
||||
};
|
||||
|
||||
// Concatenate two arrays of items
|
||||
class MergeItems {
|
||||
public:
|
||||
using Inputs = VaryingSet2<ItemBounds, ItemBounds>;
|
||||
using Outputs = ItemBounds;
|
||||
using JobModel = Job::ModelIO<MergeItems, Inputs, Outputs>;
|
||||
|
||||
MergeItems() {}
|
||||
|
||||
void run(const RenderContextPointer& renderContext, const Inputs& inputs, Outputs& outputs);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // hifi_render_FilterTask_h;
|
|
@ -36,25 +36,26 @@ void RenderFetchCullSortTask::build(JobModel& task, const Varying& input, Varyin
|
|||
|
||||
// Multi filter visible items into different buckets
|
||||
const int NUM_SPATIAL_FILTERS = 6;
|
||||
const int NUM_NON_SPATIAL_FILTERS = 3;
|
||||
const int NUM_NON_SPATIAL_FILTERS = 4;
|
||||
const int OPAQUE_SHAPE_BUCKET = 0;
|
||||
const int TRANSPARENT_SHAPE_BUCKET = 1;
|
||||
const int LIGHT_BUCKET = 2;
|
||||
const int META_BUCKET = 3;
|
||||
const int MIRROR_BUCKET = 4;
|
||||
const int SIMULATE_BUCKET = 5;
|
||||
const int BACKGROUND_BUCKET = 2;
|
||||
const int SIMULATE_BUCKET = 2;
|
||||
const int LIGHT_BUCKET = 3;
|
||||
const int META_BUCKET = 4;
|
||||
const int MIRROR_BUCKET = 5;
|
||||
const int BACKGROUND_BUCKET = 3;
|
||||
MultiFilterItems<NUM_SPATIAL_FILTERS>::ItemFilterArray spatialFilters = { {
|
||||
ItemFilter::Builder::opaqueShape().withoutMirror(),
|
||||
ItemFilter::Builder::transparentShape(),
|
||||
ItemFilter::Builder().withSimulate(),
|
||||
ItemFilter::Builder::light(),
|
||||
ItemFilter::Builder::meta().withoutMirror(),
|
||||
ItemFilter::Builder::mirror(),
|
||||
ItemFilter::Builder().withSimulate()
|
||||
ItemFilter::Builder::mirror()
|
||||
} };
|
||||
MultiFilterItems<NUM_NON_SPATIAL_FILTERS>::ItemFilterArray nonspatialFilters = { {
|
||||
ItemFilter::Builder::opaqueShape(),
|
||||
ItemFilter::Builder::transparentShape(),
|
||||
ItemFilter::Builder().withSimulate(),
|
||||
ItemFilter::Builder::background()
|
||||
} };
|
||||
const auto filteredSpatialBuckets =
|
||||
|
@ -79,9 +80,13 @@ void RenderFetchCullSortTask::build(JobModel& task, const Varying& input, Varyin
|
|||
const auto filteredLayeredOpaque = task.addJob<FilterLayeredItems>("FilterLayeredOpaque", layeredOpaques, ItemKey::Layer::LAYER_1);
|
||||
const auto filteredLayeredTransparent = task.addJob<FilterLayeredItems>("FilterLayeredTransparent", layeredTransparents, ItemKey::Layer::LAYER_1);
|
||||
|
||||
// collect our simulate objects from both buckets
|
||||
const auto mergeInputs = MergeItems::Inputs(filteredSpatialBuckets[SIMULATE_BUCKET], filteredNonspatialBuckets[SIMULATE_BUCKET]).asVarying();
|
||||
const auto simulate = task.addJob<MergeItems>("MergeSimulateItems", mergeInputs);
|
||||
|
||||
task.addJob<ClearContainingZones>("ClearContainingZones");
|
||||
|
||||
output = Output(BucketList{ opaques, transparents, lights, metas, mirrors, filteredSpatialBuckets[SIMULATE_BUCKET],
|
||||
output = Output(BucketList{ opaques, transparents, lights, metas, mirrors, simulate,
|
||||
filteredLayeredOpaque.getN<FilterLayeredItems::Outputs>(0), filteredLayeredTransparent.getN<FilterLayeredItems::Outputs>(0),
|
||||
filteredLayeredOpaque.getN<FilterLayeredItems::Outputs>(1), filteredLayeredTransparent.getN<FilterLayeredItems::Outputs>(1),
|
||||
background }, spatialSelection);
|
||||
|
|
Loading…
Reference in a new issue