mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 13:53:26 +02:00
Introducing the tag in lieu of the vsisiblity mask
This commit is contained in:
parent
23b99f04cd
commit
51dac04374
14 changed files with 102 additions and 114 deletions
interface/src
libraries
entities-renderer/src
render-utils/src
render/src/render
|
@ -2274,7 +2274,7 @@ void Application::initializeGL() {
|
|||
#ifndef Q_OS_ANDROID
|
||||
_renderEngine->addJob<SecondaryCameraRenderTask>("SecondaryCameraJob", cullFunctor, !DISABLE_DEFERRED);
|
||||
#endif
|
||||
_renderEngine->addJob<RenderViewTask>("RenderMainView", cullFunctor, !DISABLE_DEFERRED, render::ItemKey::VISIBLE_MASK_0, render::ItemKey::VISIBLE_MASK_0);
|
||||
_renderEngine->addJob<RenderViewTask>("RenderMainView", cullFunctor, !DISABLE_DEFERRED, render::ItemKey::TAG_BITS_0, render::ItemKey::TAG_BITS_0);
|
||||
_renderEngine->load();
|
||||
_renderEngine->registerScene(_main3DScene);
|
||||
|
||||
|
|
|
@ -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) {
|
||||
task.addJob<RenderShadowTask>("RenderShadowTask", cullFunctor);
|
||||
const auto items = task.addJob<RenderFetchCullSortTask>("FetchCullSort", cullFunctor, render::ItemKey::VISIBLE_MASK_1, render::ItemKey::VISIBLE_MASK_1);
|
||||
const auto items = task.addJob<RenderFetchCullSortTask>("FetchCullSort", cullFunctor, render::ItemKey::TAG_BITS_1, render::ItemKey::TAG_BITS_1);
|
||||
assert(items.canCast<RenderFetchCullSortTask::Output>());
|
||||
if (!isDeferred) {
|
||||
task.addJob<RenderForwardTask>("Forward", items);
|
||||
|
@ -205,7 +205,7 @@ public:
|
|||
|
||||
void SecondaryCameraRenderTask::build(JobModel& task, const render::Varying& inputs, render::Varying& outputs, render::CullFunctor cullFunctor, bool isDeferred) {
|
||||
const auto cachedArg = task.addJob<SecondaryCameraJob>("SecondaryCamera");
|
||||
const auto items = task.addJob<RenderFetchCullSortTask>("FetchCullSort", cullFunctor, render::ItemKey::VISIBLE_MASK_1, render::ItemKey::VISIBLE_MASK_1);
|
||||
const auto items = task.addJob<RenderFetchCullSortTask>("FetchCullSort", cullFunctor, render::ItemKey::TAG_BITS_1, render::ItemKey::TAG_BITS_1);
|
||||
assert(items.canCast<RenderFetchCullSortTask::Output>());
|
||||
if (!isDeferred) {
|
||||
task.addJob<RenderForwardTask>("Forward", items);
|
||||
|
|
|
@ -1078,7 +1078,7 @@ void MyAvatar::setEnableDebugDrawIKChains(bool isEnabled) {
|
|||
}
|
||||
|
||||
void MyAvatar::setEnableMeshVisible(bool isEnabled) {
|
||||
_skeletonModel->setVisibleInScene(isEnabled, qApp->getMain3DScene(), render::ItemKey::VISIBLE_MASK_NONE);
|
||||
_skeletonModel->setVisibleInScene(isEnabled, qApp->getMain3DScene(), render::ItemKey::TAG_BITS_NONE);
|
||||
}
|
||||
|
||||
void MyAvatar::setEnableInverseKinematics(bool isEnabled) {
|
||||
|
@ -1428,7 +1428,7 @@ void MyAvatar::clearJointsData() {
|
|||
|
||||
void MyAvatar::setSkeletonModelURL(const QUrl& skeletonModelURL) {
|
||||
Avatar::setSkeletonModelURL(skeletonModelURL);
|
||||
_skeletonModel->setVisibleInScene(true, qApp->getMain3DScene(), render::ItemKey::VISIBLE_MASK_NONE);
|
||||
_skeletonModel->setVisibleInScene(true, qApp->getMain3DScene(), render::ItemKey::TAG_BITS_NONE);
|
||||
_headBoneSet.clear();
|
||||
emit skeletonChanged();
|
||||
|
||||
|
@ -1742,7 +1742,7 @@ void MyAvatar::attach(const QString& modelURL, const QString& jointName,
|
|||
|
||||
void MyAvatar::setVisibleInSceneIfReady(Model* model, const render::ScenePointer& scene, bool visible) {
|
||||
if (model->isActive() && model->isRenderable()) {
|
||||
model->setVisibleInScene(visible, scene, render::ItemKey::VISIBLE_MASK_NONE);
|
||||
model->setVisibleInScene(visible, scene, render::ItemKey::TAG_BITS_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1938,7 +1938,7 @@ void MyAvatar::preDisplaySide(RenderArgs* renderArgs) {
|
|||
_attachmentData[i].jointName.compare("HeadTop_End", Qt::CaseInsensitive) == 0 ||
|
||||
_attachmentData[i].jointName.compare("Face", Qt::CaseInsensitive) == 0) {
|
||||
_attachmentModels[i]->setVisibleInScene(shouldDrawHead, qApp->getMain3DScene(),
|
||||
render::ItemKey::VISIBLE_MASK_NONE);
|
||||
render::ItemKey::TAG_BITS_NONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ void ModelOverlay::update(float deltatime) {
|
|||
if (_visibleDirty) {
|
||||
_visibleDirty = false;
|
||||
// don't show overlays in mirrors
|
||||
_model->setVisibleInScene(getVisible(), scene, render::ItemKey::VISIBLE_MASK_0);
|
||||
_model->setVisibleInScene(getVisible(), scene, render::ItemKey::TAG_BITS_0);
|
||||
}
|
||||
if (_drawInFrontDirty) {
|
||||
_drawInFrontDirty = false;
|
||||
|
|
|
@ -45,12 +45,12 @@ namespace render {
|
|||
builder.withViewSpace();
|
||||
}
|
||||
|
||||
if (overlay->getVisible()) {
|
||||
builder.withVisibilityMask(render::ItemKey::VISIBLE_MASK_0); // don't draw overlays in mirror
|
||||
} else {
|
||||
builder.withVisibilityMask(render::ItemKey::VISIBLE_MASK_NONE);
|
||||
if (!overlay->getVisible()) {
|
||||
builder.withInvisible();
|
||||
}
|
||||
|
||||
builder.withTagBits(render::ItemKey::TAG_BITS_0); // Only draw overlays in main view
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
template <> const Item::Bound payloadGetBound(const Overlay::Pointer& overlay) {
|
||||
|
|
|
@ -1334,8 +1334,8 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
|
|||
entity->stopModelOverrideIfNoParent();
|
||||
|
||||
uint32_t viewVisiblityMask = _cauterized ?
|
||||
render::ItemKey::VISIBLE_MASK_1 : // draw in every view except the main one (view zero)
|
||||
render::ItemKey::VISIBLE_MASK_ALL; // draw in all views
|
||||
render::ItemKey::TAG_BITS_1 : // draw in every view except the main one (view zero)
|
||||
render::ItemKey::TAG_BITS_ALL; // draw in all views
|
||||
|
||||
if (model->isVisible() != _visible || model->getViewVisibilityMask() != viewVisiblityMask) {
|
||||
// FIXME: this seems like it could be optimized if we tracked our last known visible state in
|
||||
|
|
|
@ -247,7 +247,7 @@ void CauterizedModel::updateRenderItems() {
|
|||
data.updateTransformForCauterizedMesh(renderTransform);
|
||||
|
||||
data.setEnableCauterization(enableCauterization);
|
||||
data.setKey(isVisible, isLayeredInFront || isLayeredInHUD, render::ItemKey::VISIBLE_MASK_ALL);
|
||||
data.setKey(isVisible, isLayeredInFront || isLayeredInHUD, render::ItemKey::TAG_BITS_ALL);
|
||||
data.setLayer(isLayeredInFront, isLayeredInHUD);
|
||||
data.setShapeKey(invalidatePayloadShapeKey, isWireframe);
|
||||
});
|
||||
|
|
|
@ -395,10 +395,10 @@ void ModelMeshPartPayload::setKey(bool isVisible, bool isLayered, uint8_t viewVi
|
|||
|
||||
if (!isVisible) {
|
||||
builder.withInvisible();
|
||||
} else {
|
||||
builder.withVisibilityMask(viewVisiblityMask);
|
||||
}
|
||||
|
||||
builder.withTagBits(render::ItemKey::TAG_BITS_ALL); // Draw models in all tags
|
||||
|
||||
if (isLayered) {
|
||||
builder.withLayered();
|
||||
}
|
||||
|
|
|
@ -389,7 +389,7 @@ protected:
|
|||
|
||||
QUrl _url;
|
||||
bool _isVisible;
|
||||
uint8_t _viewVisibilityMask { render::ItemKey::VISIBLE_MASK_ALL };
|
||||
uint8_t _viewVisibilityMask { render::ItemKey::TAG_BITS_ALL };
|
||||
|
||||
gpu::Buffers _blendedVertexBuffers;
|
||||
|
||||
|
|
|
@ -264,7 +264,7 @@ void RenderShadowCascadeSetup::run(const render::RenderContextPointer& renderCon
|
|||
|
||||
const auto globalShadow = lightStage->getCurrentKeyShadow();
|
||||
if (globalShadow && _cascadeIndex<globalShadow->getCascadeCount()) {
|
||||
output.edit1() = ItemFilter::Builder::visibleWorldItems(0x00, 0x00).withTypeShape().withOpaque().withoutLayered();
|
||||
output.edit1() = ItemFilter::Builder::visibleWorldItems().withTypeShape().withOpaque().withoutLayered();
|
||||
|
||||
globalShadow->setKeylightCascadeFrustum(_cascadeIndex, args->getViewFrustum(), SHADOW_FRUSTUM_NEAR, SHADOW_FRUSTUM_FAR);
|
||||
|
||||
|
|
|
@ -34,13 +34,19 @@ const int Item::LAYER_3D = 1;
|
|||
const int Item::LAYER_3D_FRONT = 2;
|
||||
const int Item::LAYER_3D_HUD = 3;
|
||||
|
||||
const uint8_t ItemKey::NUM_VISIBLE_MASK_INDICES { 4 };
|
||||
const uint8_t ItemKey::VISIBLE_MASK_ALL { 0x0F };
|
||||
const uint8_t ItemKey::VISIBLE_MASK_NONE { 0x00 };
|
||||
const uint8_t ItemKey::VISIBLE_MASK_0 { 0x01 };
|
||||
const uint8_t ItemKey::VISIBLE_MASK_1 { 0x02 };
|
||||
const uint8_t ItemKey::VISIBLE_MASK_2 { 0x04 };
|
||||
const uint8_t ItemKey::VISIBLE_MASK_3 { 0x08 };
|
||||
const uint8_t ItemKey::TAG_BITS_ALL{ 0xFF };
|
||||
const uint8_t ItemKey::TAG_BITS_NONE{ 0x00 };
|
||||
const uint8_t ItemKey::TAG_BITS_0{ 0x01 };
|
||||
const uint8_t ItemKey::TAG_BITS_1{ 0x02 };
|
||||
const uint8_t ItemKey::TAG_BITS_2{ 0x04 };
|
||||
const uint8_t ItemKey::TAG_BITS_3{ 0x08 };
|
||||
const uint8_t ItemKey::TAG_BITS_4 { 0x10 };
|
||||
const uint8_t ItemKey::TAG_BITS_5{ 0x20 };
|
||||
const uint8_t ItemKey::TAG_BITS_6{ 0x40 };
|
||||
const uint8_t ItemKey::TAG_BITS_7 { 0x80 };
|
||||
|
||||
const uint32_t ItemKey::KEY_TAG_BITS_MASK = ((uint32_t) ItemKey::TAG_BITS_ALL) << FIRST_TAG_BIT;
|
||||
|
||||
|
||||
|
||||
void Item::Status::Value::setScale(float scale) {
|
||||
|
|
|
@ -38,38 +38,61 @@ class Context;
|
|||
// Key is the KEY to filter Items and create specialized lists
|
||||
class ItemKey {
|
||||
public:
|
||||
enum FlagBit {
|
||||
// 8 tags are available to organize the items and filter them against as fields of the ItemKey.
|
||||
// TAG & TAG_BITS are defined from several bits in the Key.
|
||||
// An Item can be tagged and filtering can rely on the tags to keep or exclude items
|
||||
// ItemKey are not taged by default
|
||||
enum Tag : uint8_t {
|
||||
TAG_0 = 0, // 8 Tags
|
||||
TAG_1,
|
||||
TAG_2,
|
||||
TAG_3,
|
||||
TAG_4,
|
||||
TAG_5,
|
||||
TAG_6,
|
||||
TAG_7,
|
||||
|
||||
NUM_TAGS,
|
||||
};
|
||||
// Tag bits are derived from the Tag enum
|
||||
const static uint8_t TAG_BITS_ALL;
|
||||
const static uint8_t TAG_BITS_NONE;
|
||||
const static uint8_t TAG_BITS_0;
|
||||
const static uint8_t TAG_BITS_1;
|
||||
const static uint8_t TAG_BITS_2;
|
||||
const static uint8_t TAG_BITS_3;
|
||||
const static uint8_t TAG_BITS_4;
|
||||
const static uint8_t TAG_BITS_5;
|
||||
const static uint8_t TAG_BITS_6;
|
||||
const static uint8_t TAG_BITS_7;
|
||||
|
||||
enum FlagBit : uint32_t {
|
||||
TYPE_SHAPE = 0, // Item is a Shape
|
||||
TYPE_LIGHT, // Item is a Light
|
||||
TYPE_META, // Item is a Meta: meanning it s used to represent a higher level object, potentially represented by other render items
|
||||
|
||||
TRANSLUCENT, // Transparent and not opaque, for some odd reason TRANSPARENCY doesn't work...
|
||||
VIEW_SPACE, // Transformed in view space, and not in world space
|
||||
DYNAMIC, // Dynamic and bound will change unlike static item
|
||||
DEFORMED, // Deformed within bound, not solid
|
||||
INVISIBLE0, // Visible or not in this mask index?
|
||||
INVISIBLE1, // Visible or not in this mask index?
|
||||
INVISIBLE2, // Visible or not in this mask index?
|
||||
INVISIBLE3, // Visible or not in this mask index?
|
||||
INVISIBLE, // Visible or not in the scene?
|
||||
SHADOW_CASTER, // Item cast shadows
|
||||
PICKABLE, // Item can be picked/selected
|
||||
LAYERED, // Item belongs to one of the layers different from the default layer
|
||||
|
||||
SMALLER,
|
||||
FIRST_TAG_BIT, // 8 Tags available to organize the items and filter them against
|
||||
LAST_TAG_BIT = FIRST_TAG_BIT + NUM_TAGS,
|
||||
|
||||
__SMALLER, // Reserved bit for spatialized item to indicate that it is smaller than expected in the cell in which it belongs (probably because it overlaps over several smaller cells)
|
||||
|
||||
NUM_FLAGS, // Not a valid flag
|
||||
};
|
||||
typedef std::bitset<NUM_FLAGS> Flags;
|
||||
|
||||
// VISIBLE MASK is defined from several bits in the Key.
|
||||
// An Item can be visible in some mask bits and not other allowing for per view rendering
|
||||
// Beware that the visibility mask is the oposite of what stored in the key vals.
|
||||
const static uint8_t NUM_VISIBLE_MASK_INDICES;
|
||||
const static uint8_t VISIBLE_MASK_ALL;
|
||||
const static uint8_t VISIBLE_MASK_NONE;
|
||||
const static uint8_t VISIBLE_MASK_0;
|
||||
const static uint8_t VISIBLE_MASK_1;
|
||||
const static uint8_t VISIBLE_MASK_2;
|
||||
const static uint8_t VISIBLE_MASK_3;
|
||||
// All the bits touching tag bits sets to true
|
||||
const static uint32_t KEY_TAG_BITS_MASK;
|
||||
static uint32_t evalTagBitsWithKeyBits(uint8_t tagBits, const uint32_t keyBits) {
|
||||
return (keyBits & ~KEY_TAG_BITS_MASK) | (((uint32_t)tagBits) << FIRST_TAG_BIT);
|
||||
}
|
||||
|
||||
// The key is the Flags
|
||||
Flags _flags;
|
||||
|
@ -96,44 +119,14 @@ public:
|
|||
Builder& withViewSpace() { _flags.set(VIEW_SPACE); return (*this); }
|
||||
Builder& withDynamic() { _flags.set(DYNAMIC); return (*this); }
|
||||
Builder& withDeformed() { _flags.set(DEFORMED); return (*this); }
|
||||
Builder& withVisible(uint8_t maskIndex = NUM_VISIBLE_MASK_INDICES) {
|
||||
if (maskIndex == NUM_VISIBLE_MASK_INDICES) {
|
||||
_flags.reset(INVISIBLE0);
|
||||
_flags.reset(INVISIBLE1);
|
||||
_flags.reset(INVISIBLE2);
|
||||
_flags.reset(INVISIBLE3);
|
||||
}
|
||||
else {
|
||||
_flags.reset(INVISIBLE0 + maskIndex);
|
||||
}
|
||||
return (*this);
|
||||
}
|
||||
Builder& withInvisible(uint8_t maskIndex = NUM_VISIBLE_MASK_INDICES) {
|
||||
if (maskIndex == NUM_VISIBLE_MASK_INDICES) {
|
||||
_flags.set(INVISIBLE0);
|
||||
_flags.set(INVISIBLE1);
|
||||
_flags.set(INVISIBLE2);
|
||||
_flags.set(INVISIBLE3);
|
||||
} else {
|
||||
_flags.set(INVISIBLE0 + maskIndex);
|
||||
}
|
||||
return (*this);
|
||||
}
|
||||
Builder& withVisibilityMask(uint8_t mask) {
|
||||
for (int i = 0; i < ItemKey::NUM_VISIBLE_MASK_INDICES; i++) {
|
||||
if ((1 << i) & mask) {
|
||||
withVisible(i);
|
||||
}
|
||||
else {
|
||||
withInvisible(i);
|
||||
}
|
||||
}
|
||||
return (*this);
|
||||
}
|
||||
Builder& withInvisible() { _flags.set(INVISIBLE); return (*this); }
|
||||
Builder& withShadowCaster() { _flags.set(SHADOW_CASTER); return (*this); }
|
||||
Builder& withPickable() { _flags.set(PICKABLE); return (*this); }
|
||||
Builder& withLayered() { _flags.set(LAYERED); return (*this); }
|
||||
|
||||
Builder& withTag(Tag tag) { _flags.set(FIRST_TAG_BIT + tag); return (*this); }
|
||||
// Set ALL the tags in one call using the Tag bits
|
||||
Builder& withTagBits(uint8_t tagBits) { _flags = evalTagBitsWithKeyBits(tagBits, _flags.to_ulong()); return (*this); }
|
||||
|
||||
// Convenient standard keys that we will keep on using all over the place
|
||||
static Builder opaqueShape() { return Builder().withTypeShape(); }
|
||||
static Builder transparentShape() { return Builder().withTypeShape().withTransparent(); }
|
||||
|
@ -158,21 +151,20 @@ public:
|
|||
bool isRigid() const { return !_flags[DEFORMED]; }
|
||||
bool isDeformed() const { return _flags[DEFORMED]; }
|
||||
|
||||
bool isVisible(uint8_t maskIndex) const { return !_flags[INVISIBLE0 + maskIndex]; }
|
||||
bool isInvisible(uint8_t maskIndex) const { return _flags[INVISIBLE0 + maskIndex]; }
|
||||
uint8_t getVisibleMask() const { return (~(_flags.to_ulong() >> INVISIBLE0) & VISIBLE_MASK_ALL);}
|
||||
bool isVisibleMask(uint8_t mask) const { return getVisibleMask() & mask; }
|
||||
bool isVisible() const { return !_flags[INVISIBLE]; }
|
||||
bool isInvisible() const { return _flags[INVISIBLE]; }
|
||||
|
||||
bool isShadowCaster() const { return _flags[SHADOW_CASTER]; }
|
||||
|
||||
bool isPickable() const { return _flags[PICKABLE]; }
|
||||
|
||||
bool isLayered() const { return _flags[LAYERED]; }
|
||||
bool isSpatial() const { return !isLayered(); }
|
||||
|
||||
bool isTag(Tag tag) const { return _flags[FIRST_TAG_BIT + tag]; }
|
||||
uint8_t getTagBits() const { return ((_flags.to_ulong() & KEY_TAG_BITS_MASK) >> FIRST_TAG_BIT); }
|
||||
|
||||
// Probably not public, flags used by the scene
|
||||
bool isSmall() const { return _flags[SMALLER]; }
|
||||
void setSmaller(bool smaller) { (smaller ? _flags.set(SMALLER) : _flags.reset(SMALLER)); }
|
||||
bool isSmall() const { return _flags[__SMALLER]; }
|
||||
void setSmaller(bool smaller) { (smaller ? _flags.set(__SMALLER) : _flags.reset(__SMALLER)); }
|
||||
|
||||
bool operator==(const ItemKey& key) { return (_flags == key._flags); }
|
||||
bool operator!=(const ItemKey& key) { return (_flags != key._flags); }
|
||||
|
@ -220,34 +212,24 @@ public:
|
|||
Builder& withRigid() { _value.reset(ItemKey::DEFORMED); _mask.set(ItemKey::DEFORMED); return (*this); }
|
||||
Builder& withDeformed() { _value.set(ItemKey::DEFORMED); _mask.set(ItemKey::DEFORMED); return (*this); }
|
||||
|
||||
Builder& withVisible(uint8_t maskIndex) { _value.reset(ItemKey::INVISIBLE0 + maskIndex); _mask.set(ItemKey::INVISIBLE0 + maskIndex); return (*this); }
|
||||
Builder& withInvisible(uint8_t maskIndex) { _value.set(ItemKey::INVISIBLE0 + maskIndex); _mask.set(ItemKey::INVISIBLE0 + maskIndex); return (*this); }
|
||||
Builder& withVisibilityMask(uint8_t mask, uint8_t touchBits) {
|
||||
for (int i = 0; i < ItemKey::NUM_VISIBLE_MASK_INDICES; i++) {
|
||||
if ((1 << i) & touchBits) {
|
||||
if ((1 << i) & mask) {
|
||||
withVisible(i);
|
||||
}
|
||||
else {
|
||||
withInvisible(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
return (*this);
|
||||
}
|
||||
Builder& withVisible() { _value.reset(ItemKey::INVISIBLE); _mask.set(ItemKey::INVISIBLE); return (*this); }
|
||||
Builder& withInvisible() { _value.set(ItemKey::INVISIBLE); _mask.set(ItemKey::INVISIBLE); return (*this); }
|
||||
|
||||
Builder& withNoShadowCaster() { _value.reset(ItemKey::SHADOW_CASTER); _mask.set(ItemKey::SHADOW_CASTER); return (*this); }
|
||||
Builder& withShadowCaster() { _value.set(ItemKey::SHADOW_CASTER); _mask.set(ItemKey::SHADOW_CASTER); return (*this); }
|
||||
|
||||
Builder& withPickable() { _value.set(ItemKey::PICKABLE); _mask.set(ItemKey::PICKABLE); return (*this); }
|
||||
|
||||
Builder& withoutLayered() { _value.reset(ItemKey::LAYERED); _mask.set(ItemKey::LAYERED); return (*this); }
|
||||
Builder& withLayered() { _value.set(ItemKey::LAYERED); _mask.set(ItemKey::LAYERED); return (*this); }
|
||||
|
||||
Builder& withoutTag(ItemKey::Tag tagIndex) { _value.reset(ItemKey::FIRST_TAG_BIT + tagIndex); _mask.set(ItemKey::FIRST_TAG_BIT + tagIndex); return (*this); }
|
||||
Builder& withTag(ItemKey::Tag tagIndex) { _value.set(ItemKey::FIRST_TAG_BIT + tagIndex); _mask.set(ItemKey::FIRST_TAG_BIT + tagIndex); return (*this); }
|
||||
// Set ALL the tags in one call using the Tag bits and the Tag bits touched
|
||||
Builder& withTagBits(uint8_t tagBits, uint8_t tagMask) { _value = ItemKey::evalTagBitsWithKeyBits(tagBits, _value.to_ulong()); _mask = ItemKey::evalTagBitsWithKeyBits(tagMask, _mask.to_ulong()); return (*this); }
|
||||
|
||||
Builder& withNothing() { _value.reset(); _mask.reset(); return (*this); }
|
||||
|
||||
// Convenient standard keys that we will keep on using all over the place
|
||||
static Builder visibleWorldItems(uint8_t visibilityMask, uint8_t visibilityMaskTouched) { return Builder().withVisibilityMask(visibilityMask, visibilityMaskTouched).withWorldSpace(); }
|
||||
static Builder visibleWorldItems() { return Builder().withVisible().withWorldSpace(); }
|
||||
static Builder opaqueShape() { return Builder().withTypeShape().withOpaque().withWorldSpace(); }
|
||||
static Builder transparentShape() { return Builder().withTypeShape().withTransparent().withWorldSpace(); }
|
||||
static Builder light() { return Builder().withTypeLight(); }
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
|
||||
using namespace render;
|
||||
|
||||
void RenderFetchCullSortTask::build(JobModel& task, const Varying& input, Varying& output, CullFunctor cullFunctor, uint8_t visibilityMask, uint8_t visibilityMaskTouched) {
|
||||
void RenderFetchCullSortTask::build(JobModel& task, const Varying& input, Varying& output, CullFunctor cullFunctor, uint8_t tagBits, uint8_t tagMask) {
|
||||
cullFunctor = cullFunctor ? cullFunctor : [](const RenderArgs*, const AABox&){ return true; };
|
||||
|
||||
// CPU jobs:
|
||||
// Fetch and cull the items from the scene
|
||||
const ItemFilter filter = ItemFilter::Builder::visibleWorldItems(visibilityMask, visibilityMaskTouched).withoutLayered();
|
||||
const ItemFilter filter = ItemFilter::Builder::visibleWorldItems().withoutLayered().withTagBits(tagBits, tagMask);
|
||||
const auto spatialFilter = render::Varying(filter);
|
||||
const auto spatialSelection = task.addJob<FetchSpatialTree>("FetchSceneSelection", spatialFilter);
|
||||
const auto cullInputs = CullSpatialSelection::Inputs(spatialSelection, spatialFilter).asVarying();
|
||||
|
@ -40,15 +40,15 @@ void RenderFetchCullSortTask::build(JobModel& task, const Varying& input, Varyin
|
|||
const int META_BUCKET = 3;
|
||||
const int BACKGROUND_BUCKET = 2;
|
||||
MultiFilterItems<NUM_SPATIAL_FILTERS>::ItemFilterArray spatialFilters = { {
|
||||
ItemFilter::Builder::opaqueShape().withVisibilityMask(visibilityMask, visibilityMaskTouched),
|
||||
ItemFilter::Builder::transparentShape().withVisibilityMask(visibilityMask, visibilityMaskTouched),
|
||||
ItemFilter::Builder::light().withVisibilityMask(visibilityMask, visibilityMaskTouched),
|
||||
ItemFilter::Builder::meta().withVisibilityMask(visibilityMask, visibilityMaskTouched)
|
||||
ItemFilter::Builder::opaqueShape().withVisible().withTagBits(tagBits, tagMask),
|
||||
ItemFilter::Builder::transparentShape().withVisible().withTagBits(tagBits, tagMask),
|
||||
ItemFilter::Builder::light().withVisible().withTagBits(tagBits, tagMask),
|
||||
ItemFilter::Builder::meta().withVisible().withTagBits(tagBits, tagMask)
|
||||
} };
|
||||
MultiFilterItems<NUM_NON_SPATIAL_FILTERS>::ItemFilterArray nonspatialFilters = { {
|
||||
ItemFilter::Builder::opaqueShape().withVisibilityMask(visibilityMask, visibilityMaskTouched),
|
||||
ItemFilter::Builder::transparentShape().withVisibilityMask(visibilityMask, visibilityMaskTouched),
|
||||
ItemFilter::Builder::background().withVisibilityMask(visibilityMask, visibilityMaskTouched)
|
||||
ItemFilter::Builder::opaqueShape().withVisible().withTagBits(tagBits, tagMask),
|
||||
ItemFilter::Builder::transparentShape().withVisible().withTagBits(tagBits, tagMask),
|
||||
ItemFilter::Builder::background().withVisible().withTagBits(tagBits, tagMask)
|
||||
} };
|
||||
const auto filteredSpatialBuckets =
|
||||
task.addJob<MultiFilterItems<NUM_SPATIAL_FILTERS>>("FilterSceneSelection", culledSpatialSelection, spatialFilters)
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
|
||||
RenderFetchCullSortTask() {}
|
||||
|
||||
void build(JobModel& task, const render::Varying& inputs, render::Varying& outputs, render::CullFunctor cullFunctor, uint8_t visibilityMask = 0xFF, uint8_t visibilityMaskTouched = 0x00);
|
||||
void build(JobModel& task, const render::Varying& inputs, render::Varying& outputs, render::CullFunctor cullFunctor, uint8_t tagBits = 0x00, uint8_t tagMask = 0x00);
|
||||
};
|
||||
|
||||
#endif // hifi_RenderFetchCullSortTask_h
|
||||
|
|
Loading…
Reference in a new issue