mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
more backwards logic, added withViewVisibilityMask call in ItemKey
This commit is contained in:
parent
7c32d3c536
commit
31c007d167
7 changed files with 26 additions and 20 deletions
|
@ -1078,7 +1078,7 @@ void MyAvatar::setEnableDebugDrawIKChains(bool isEnabled) {
|
|||
}
|
||||
|
||||
void MyAvatar::setEnableMeshVisible(bool isEnabled) {
|
||||
_skeletonModel->setVisibleInScene(isEnabled, qApp->getMain3DScene(), render::ItemKey::VISIBLE_MASK_ALL);
|
||||
_skeletonModel->setVisibleInScene(isEnabled, qApp->getMain3DScene(), render::ItemKey::VISIBLE_MASK_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_ALL);
|
||||
_skeletonModel->setVisibleInScene(true, qApp->getMain3DScene(), render::ItemKey::VISIBLE_MASK_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_ALL);
|
||||
model->setVisibleInScene(visible, scene, render::ItemKey::VISIBLE_MASK_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_ALL);
|
||||
render::ItemKey::VISIBLE_MASK_NONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1334,8 +1334,8 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
|
|||
entity->stopModelOverrideIfNoParent();
|
||||
|
||||
uint32_t viewVisiblityMask = _cauterized ?
|
||||
render::ItemKey::VISIBLE_MASK_0 : // draw in every view except the main one
|
||||
render::ItemKey::VISIBLE_MASK_ALL; // draw in all views
|
||||
render::ItemKey::VISIBLE_MASK_0 : // draw in every view except the main one (view zero)
|
||||
render::ItemKey::VISIBLE_MASK_NONE; // 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
|
||||
|
|
|
@ -625,7 +625,7 @@ protected:
|
|||
quint64 _lastUpdatedAccelerationTimestamp { 0 };
|
||||
quint64 _lastUpdatedQueryAACubeTimestamp { 0 };
|
||||
|
||||
bool _cauterized { false }; // it true, don't draw because it would obscure 1st-person camera
|
||||
bool _cauterized { false }; // if true, don't draw because it would obscure 1st-person camera
|
||||
};
|
||||
|
||||
#endif // hifi_EntityItem_h
|
||||
|
|
|
@ -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::VISIBLE_MASK_NONE);
|
||||
data.setLayer(isLayeredInFront, isLayeredInHUD);
|
||||
data.setShapeKey(invalidatePayloadShapeKey, isWireframe);
|
||||
});
|
||||
|
|
|
@ -396,18 +396,7 @@ void ModelMeshPartPayload::setKey(bool isVisible, bool isLayered, uint8_t viewVi
|
|||
if (!isVisible) {
|
||||
builder.withInvisible();
|
||||
} else {
|
||||
if (viewVisiblityMask & render::ItemKey::VISIBLE_MASK_0) {
|
||||
builder.withInvisible(render::ItemKey::INVISIBLE0 - render::ItemKey::INVISIBLE0);
|
||||
}
|
||||
if (viewVisiblityMask & render::ItemKey::VISIBLE_MASK_1) {
|
||||
builder.withInvisible(render::ItemKey::INVISIBLE1 - render::ItemKey::INVISIBLE0);
|
||||
}
|
||||
if (viewVisiblityMask & render::ItemKey::VISIBLE_MASK_2) {
|
||||
builder.withInvisible(render::ItemKey::INVISIBLE2 - render::ItemKey::INVISIBLE0);
|
||||
}
|
||||
if (viewVisiblityMask & render::ItemKey::VISIBLE_MASK_3) {
|
||||
builder.withInvisible(render::ItemKey::INVISIBLE3 - render::ItemKey::INVISIBLE0);
|
||||
}
|
||||
builder.withViewVisibilityMask(viewVisiblityMask);
|
||||
}
|
||||
|
||||
if (isLayered) {
|
||||
|
|
|
@ -36,6 +36,7 @@ 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 };
|
||||
|
|
|
@ -65,6 +65,7 @@ public:
|
|||
// 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;
|
||||
|
@ -96,6 +97,21 @@ public:
|
|||
Builder& withDynamic() { _flags.set(DYNAMIC); return (*this); }
|
||||
Builder& withDeformed() { _flags.set(DEFORMED); return (*this); }
|
||||
Builder& withInvisible(uint8_t maskIndex = 0) { _flags.set(INVISIBLE0 + maskIndex); return (*this); }
|
||||
Builder& withViewVisibilityMask(uint8_t mask) {
|
||||
if (mask & render::ItemKey::VISIBLE_MASK_0) {
|
||||
_flags.set(INVISIBLE0);
|
||||
}
|
||||
if (mask & render::ItemKey::VISIBLE_MASK_1) {
|
||||
_flags.set(INVISIBLE1);
|
||||
}
|
||||
if (mask & render::ItemKey::VISIBLE_MASK_2) {
|
||||
_flags.set(INVISIBLE2);
|
||||
}
|
||||
if (mask & render::ItemKey::VISIBLE_MASK_3) {
|
||||
_flags.set(INVISIBLE3);
|
||||
}
|
||||
return (*this);
|
||||
}
|
||||
Builder& withShadowCaster() { _flags.set(SHADOW_CASTER); return (*this); }
|
||||
Builder& withPickable() { _flags.set(PICKABLE); return (*this); }
|
||||
Builder& withLayered() { _flags.set(LAYERED); return (*this); }
|
||||
|
|
Loading…
Reference in a new issue