mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 06:58:56 +02:00
Integrating the tag flags to the render item key and adding configration of the render pipelien with the Tag information
This commit is contained in:
parent
04efaa0f92
commit
1fd4c5c1a4
7 changed files with 16 additions and 12 deletions
|
@ -20,7 +20,7 @@ using RenderArgsPointer = std::shared_ptr<RenderArgs>;
|
||||||
|
|
||||||
void MainRenderTask::build(JobModel& task, const render::Varying& inputs, render::Varying& outputs, render::CullFunctor cullFunctor, bool isDeferred) {
|
void MainRenderTask::build(JobModel& task, const render::Varying& inputs, render::Varying& outputs, render::CullFunctor cullFunctor, bool isDeferred) {
|
||||||
|
|
||||||
task.addJob<RenderShadowTask>("RenderShadowTask", cullFunctor);
|
task.addJob<RenderShadowTask>("RenderShadowTask", cullFunctor, render::ItemKey::TAG_BITS_1, render::ItemKey::TAG_BITS_1);
|
||||||
const auto items = task.addJob<RenderFetchCullSortTask>("FetchCullSort", cullFunctor, render::ItemKey::TAG_BITS_1, render::ItemKey::TAG_BITS_1);
|
const auto items = task.addJob<RenderFetchCullSortTask>("FetchCullSort", cullFunctor, render::ItemKey::TAG_BITS_1, render::ItemKey::TAG_BITS_1);
|
||||||
assert(items.canCast<RenderFetchCullSortTask::Output>());
|
assert(items.canCast<RenderFetchCullSortTask::Output>());
|
||||||
if (!isDeferred) {
|
if (!isDeferred) {
|
||||||
|
|
|
@ -216,7 +216,7 @@ void RenderShadowTask::build(JobModel& task, const render::Varying& input, rende
|
||||||
task.addJob<RenderShadowSetup>("ShadowSetup");
|
task.addJob<RenderShadowSetup>("ShadowSetup");
|
||||||
|
|
||||||
for (auto i = 0; i < SHADOW_CASCADE_MAX_COUNT; i++) {
|
for (auto i = 0; i < SHADOW_CASCADE_MAX_COUNT; i++) {
|
||||||
const auto setupOutput = task.addJob<RenderShadowCascadeSetup>("ShadowCascadeSetup", i);
|
const auto setupOutput = task.addJob<RenderShadowCascadeSetup>("ShadowCascadeSetup", i, tagBits, tagMask);
|
||||||
const auto shadowFilter = setupOutput.getN<RenderShadowCascadeSetup::Outputs>(1);
|
const auto shadowFilter = setupOutput.getN<RenderShadowCascadeSetup::Outputs>(1);
|
||||||
|
|
||||||
// CPU jobs:
|
// CPU jobs:
|
||||||
|
@ -259,14 +259,12 @@ void RenderShadowCascadeSetup::run(const render::RenderContextPointer& renderCon
|
||||||
// Cache old render args
|
// Cache old render args
|
||||||
RenderArgs* args = renderContext->args;
|
RenderArgs* args = renderContext->args;
|
||||||
|
|
||||||
// const auto& filterMask = inputs;
|
|
||||||
|
|
||||||
output.edit0() = args->_renderMode;
|
output.edit0() = args->_renderMode;
|
||||||
output.edit2() = args->_sizeScale;
|
output.edit2() = args->_sizeScale;
|
||||||
|
|
||||||
const auto globalShadow = lightStage->getCurrentKeyShadow();
|
const auto globalShadow = lightStage->getCurrentKeyShadow();
|
||||||
if (globalShadow && _cascadeIndex<globalShadow->getCascadeCount()) {
|
if (globalShadow && _cascadeIndex<globalShadow->getCascadeCount()) {
|
||||||
output.edit1() = ItemFilter::Builder::visibleWorldItems().withTypeShape().withOpaque().withoutLayered();
|
output.edit1() = ItemFilter::Builder::visibleWorldItems().withTypeShape().withOpaque().withoutLayered().withTagBits(_tagBits, _tagMask);
|
||||||
|
|
||||||
globalShadow->setKeylightCascadeFrustum(_cascadeIndex, args->getViewFrustum(), SHADOW_FRUSTUM_NEAR, SHADOW_FRUSTUM_FAR);
|
globalShadow->setKeylightCascadeFrustum(_cascadeIndex, args->getViewFrustum(), SHADOW_FRUSTUM_NEAR, SHADOW_FRUSTUM_FAR);
|
||||||
|
|
||||||
|
|
|
@ -67,12 +67,14 @@ public:
|
||||||
using Outputs = render::VaryingSet3<RenderArgs::RenderMode, render::ItemFilter, float>;
|
using Outputs = render::VaryingSet3<RenderArgs::RenderMode, render::ItemFilter, float>;
|
||||||
using JobModel = render::Job::ModelO<RenderShadowCascadeSetup, Outputs>;
|
using JobModel = render::Job::ModelO<RenderShadowCascadeSetup, Outputs>;
|
||||||
|
|
||||||
RenderShadowCascadeSetup(unsigned int cascadeIndex) : _cascadeIndex{ cascadeIndex } {}
|
RenderShadowCascadeSetup(unsigned int cascadeIndex, uint8_t tagBits = 0x00, uint8_t tagMask = 0x00) : _cascadeIndex{ cascadeIndex }, _tagBits(tagBits), _tagMask(tagMask) {}
|
||||||
void run(const render::RenderContextPointer& renderContext, Outputs& output);
|
void run(const render::RenderContextPointer& renderContext, Outputs& output);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
unsigned int _cascadeIndex;
|
unsigned int _cascadeIndex;
|
||||||
|
uint8_t _tagBits{ 0x00 };
|
||||||
|
uint8_t _tagMask{ 0x00 };
|
||||||
};
|
};
|
||||||
|
|
||||||
class RenderShadowCascadeTeardown {
|
class RenderShadowCascadeTeardown {
|
||||||
|
|
|
@ -28,7 +28,7 @@ void RenderViewTask::build(JobModel& task, const render::Varying& input, render:
|
||||||
const auto threshold = 1e-3f;
|
const auto threshold = 1e-3f;
|
||||||
return relativeBoundRadius > threshold;
|
return relativeBoundRadius > threshold;
|
||||||
return true;
|
return true;
|
||||||
});
|
}, tagBits, tagMask);
|
||||||
|
|
||||||
const auto items = task.addJob<RenderFetchCullSortTask>("FetchCullSort", cullFunctor, tagBits, tagMask);
|
const auto items = task.addJob<RenderFetchCullSortTask>("FetchCullSort", cullFunctor, tagBits, tagMask);
|
||||||
assert(items.canCast<RenderFetchCullSortTask::Output>());
|
assert(items.canCast<RenderFetchCullSortTask::Output>());
|
||||||
|
|
|
@ -61,7 +61,7 @@ void render::cullItems(const RenderContextPointer& renderContext, const CullFunc
|
||||||
details._rendered += (int)outItems.size();
|
details._rendered += (int)outItems.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FetchNonspatialItems::run(const RenderContextPointer& renderContext, ItemBounds& outItems) {
|
void FetchNonspatialItems::run(const RenderContextPointer& renderContext, const ItemFilter& filter, ItemBounds& outItems) {
|
||||||
assert(renderContext->args);
|
assert(renderContext->args);
|
||||||
assert(renderContext->args->hasViewFrustum());
|
assert(renderContext->args->hasViewFrustum());
|
||||||
auto& scene = renderContext->_scene;
|
auto& scene = renderContext->_scene;
|
||||||
|
@ -72,7 +72,9 @@ void FetchNonspatialItems::run(const RenderContextPointer& renderContext, ItemBo
|
||||||
outItems.reserve(items.size());
|
outItems.reserve(items.size());
|
||||||
for (auto& id : items) {
|
for (auto& id : items) {
|
||||||
auto& item = scene->getItem(id);
|
auto& item = scene->getItem(id);
|
||||||
outItems.emplace_back(ItemBound(id, item.getBound()));
|
if (filter.test(item.getKey())) {
|
||||||
|
outItems.emplace_back(ItemBound(id, item.getBound()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,8 @@ namespace render {
|
||||||
|
|
||||||
class FetchNonspatialItems {
|
class FetchNonspatialItems {
|
||||||
public:
|
public:
|
||||||
using JobModel = Job::ModelO<FetchNonspatialItems, ItemBounds>;
|
using JobModel = Job::ModelIO<FetchNonspatialItems, ItemFilter, ItemBounds>;
|
||||||
void run(const RenderContextPointer& renderContext, ItemBounds& outItems);
|
void run(const RenderContextPointer& renderContext, const ItemFilter& filter, ItemBounds& outItems);
|
||||||
};
|
};
|
||||||
|
|
||||||
class FetchSpatialTreeConfig : public Job::Config {
|
class FetchSpatialTreeConfig : public Job::Config {
|
||||||
|
|
|
@ -29,7 +29,9 @@ void RenderFetchCullSortTask::build(JobModel& task, const Varying& input, Varyin
|
||||||
const auto culledSpatialSelection = task.addJob<CullSpatialSelection>("CullSceneSelection", cullInputs, cullFunctor, RenderDetails::ITEM);
|
const auto culledSpatialSelection = task.addJob<CullSpatialSelection>("CullSceneSelection", cullInputs, cullFunctor, RenderDetails::ITEM);
|
||||||
|
|
||||||
// Overlays are not culled
|
// Overlays are not culled
|
||||||
const auto nonspatialSelection = task.addJob<FetchNonspatialItems>("FetchOverlaySelection");
|
const ItemFilter overlayfilter = ItemFilter::Builder().withVisible().withTagBits(tagBits, tagMask);
|
||||||
|
const auto nonspatialFilter = render::Varying(overlayfilter);
|
||||||
|
const auto nonspatialSelection = task.addJob<FetchNonspatialItems>("FetchOverlaySelection", nonspatialFilter);
|
||||||
|
|
||||||
// Multi filter visible items into different buckets
|
// Multi filter visible items into different buckets
|
||||||
const int NUM_SPATIAL_FILTERS = 4;
|
const int NUM_SPATIAL_FILTERS = 4;
|
||||||
|
|
Loading…
Reference in a new issue