mirror of
https://github.com/lubosz/overte.git
synced 2025-08-28 09:16:30 +02:00
Removing the pseudo fix for lod culling that is not ready in this pr
This commit is contained in:
parent
60447bc521
commit
702f6229b8
6 changed files with 4 additions and 89 deletions
|
@ -127,11 +127,6 @@ void ModelOverlay::update(float deltatime) {
|
|||
_model->setGroupCulled(_isGroupCulled, scene);
|
||||
metaDirty = true;
|
||||
}
|
||||
if (_lodEnabledDirty) {
|
||||
_lodEnabledDirty = false;
|
||||
_model->setLODEnabled(_isLODEnabled, scene);
|
||||
metaDirty = true;
|
||||
}
|
||||
if (metaDirty) {
|
||||
transaction.updateItem<Overlay>(getRenderItemID(), [](Overlay& data) {});
|
||||
}
|
||||
|
@ -196,14 +191,6 @@ void ModelOverlay::setGroupCulled(bool groupCulled) {
|
|||
}
|
||||
}
|
||||
|
||||
void ModelOverlay::setLODEnabled(bool lodEnabled) {
|
||||
if (lodEnabled != _isLODEnabled) {
|
||||
_isLODEnabled = lodEnabled;
|
||||
_lodEnabledDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ModelOverlay::setProperties(const QVariantMap& properties) {
|
||||
auto origPosition = getWorldPosition();
|
||||
auto origRotation = getWorldOrientation();
|
||||
|
@ -261,12 +248,6 @@ void ModelOverlay::setProperties(const QVariantMap& properties) {
|
|||
setGroupCulled(groupCulledValue.toBool());
|
||||
}
|
||||
|
||||
auto lodEnabledValue = properties["isLODEnabled"];
|
||||
if (lodEnabledValue.isValid() && lodEnabledValue.canConvert(QVariant::Bool)) {
|
||||
setLODEnabled(lodEnabledValue.toBool());
|
||||
}
|
||||
|
||||
|
||||
// jointNames is read-only.
|
||||
// jointPositions is read-only.
|
||||
// jointOrientations is read-only.
|
||||
|
@ -571,24 +552,8 @@ void ModelOverlay::locationChanged(bool tellPhysics) {
|
|||
|
||||
// FIXME Start using the _renderTransform instead of calling for Transform and Dimensions from here, do the custom things needed in evalRenderTransform()
|
||||
if (_model && _model->isActive()) {
|
||||
if (!_isLODEnabled) {
|
||||
auto rot = _model->getRotation();
|
||||
auto tra = _model->getTranslation();
|
||||
|
||||
auto nrot = getWorldOrientation();
|
||||
auto ntra = getWorldPosition();
|
||||
if (glm::any(glm::notEqual(rot, nrot))) {
|
||||
rot = nrot;
|
||||
_model->setRotation(rot);
|
||||
}
|
||||
if (glm::any(glm::notEqual(tra, ntra))) {
|
||||
tra = ntra;
|
||||
_model->setTranslation(tra);
|
||||
}
|
||||
} else {
|
||||
_model->setRotation(getWorldOrientation());
|
||||
_model->setTranslation(getWorldPosition());
|
||||
}
|
||||
_model->setRotation(getWorldOrientation());
|
||||
_model->setTranslation(getWorldPosition());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -800,9 +765,5 @@ render::ItemKey ModelOverlay::getKey() {
|
|||
if (_isGroupCulled) {
|
||||
builder.withMetaCullGroup();
|
||||
}
|
||||
if (!_isLODEnabled) {
|
||||
builder.withLODDisabled();
|
||||
}
|
||||
|
||||
return builder.build();
|
||||
}
|
|
@ -69,7 +69,6 @@ public:
|
|||
void setDrawInFront(bool drawInFront) override;
|
||||
void setDrawHUDLayer(bool drawHUDLayer) override;
|
||||
void setGroupCulled(bool groupCulled);
|
||||
void setLODEnabled(bool lodEnabled);
|
||||
|
||||
void addMaterial(graphics::MaterialLayer material, const std::string& parentMaterialName) override;
|
||||
void removeMaterial(graphics::MaterialPointer material, const std::string& parentMaterialName) override;
|
||||
|
@ -131,8 +130,6 @@ private:
|
|||
bool _drawInHUDDirty { false };
|
||||
bool _isGroupCulled { false };
|
||||
bool _groupCulledDirty { false };
|
||||
bool _isLODEnabled{ true };
|
||||
bool _lodEnabledDirty{ true };
|
||||
|
||||
void processMaterials();
|
||||
|
||||
|
|
|
@ -226,10 +226,6 @@ void Model::updateRenderItems() {
|
|||
bool isWireframe = self->isWireframe();
|
||||
auto renderItemKeyGlobalFlags = self->getRenderItemKeyGlobalFlags();
|
||||
|
||||
if (renderItemKeyGlobalFlags.isLODDisabled()) {
|
||||
modelTransform.setScale(glm::vec3(1.0f));
|
||||
}
|
||||
|
||||
render::Transaction transaction;
|
||||
for (int i = 0; i < (int) self->_modelMeshRenderItemIDs.size(); i++) {
|
||||
|
||||
|
@ -249,8 +245,6 @@ void Model::updateRenderItems() {
|
|||
data.updateClusterBuffer(meshState.clusterMatrices);
|
||||
}
|
||||
|
||||
auto bound = data.getBound();
|
||||
|
||||
Transform renderTransform = modelTransform;
|
||||
|
||||
if (useDualQuaternionSkinning) {
|
||||
|
@ -268,15 +262,6 @@ void Model::updateRenderItems() {
|
|||
}
|
||||
data.updateTransformForSkinnedMesh(renderTransform, modelTransform);
|
||||
|
||||
if (renderItemKeyGlobalFlags.isLODDisabled()) {
|
||||
auto newBound = data.getBound();
|
||||
if (bound != newBound) {
|
||||
data.updateTransformForSkinnedMesh(renderTransform, modelTransform);
|
||||
} else {
|
||||
data.updateTransformForSkinnedMesh(renderTransform, modelTransform);
|
||||
}
|
||||
}
|
||||
|
||||
data.updateKey(renderItemKeyGlobalFlags);
|
||||
data.setShapeKey(invalidatePayloadShapeKey, isWireframe, useDualQuaternionSkinning);
|
||||
});
|
||||
|
@ -906,12 +891,7 @@ void Model::updateRenderItemsKey(const render::ScenePointer& scene) {
|
|||
_needsFixupInScene = true;
|
||||
return;
|
||||
}
|
||||
auto prevVal = _needsFixupInScene;
|
||||
auto renderItemsKey = _renderItemKeyGlobalFlags;
|
||||
if (renderItemsKey.isLODDisabled()) {
|
||||
_needsFixupInScene = true;
|
||||
_needsFixupInScene = prevVal;
|
||||
}
|
||||
render::Transaction transaction;
|
||||
foreach(auto item, _modelMeshRenderItemsMap.keys()) {
|
||||
transaction.updateItem<ModelMeshPartPayload>(item, [renderItemsKey](ModelMeshPartPayload& data) {
|
||||
|
@ -991,17 +971,6 @@ bool Model::isGroupCulled() const {
|
|||
return _renderItemKeyGlobalFlags.isSubMetaCulled();
|
||||
}
|
||||
|
||||
void Model::setLODEnabled(bool isLODEnabled, const render::ScenePointer& scene) {
|
||||
if (Model::isLODEnabled() != isLODEnabled) {
|
||||
auto keyBuilder = render::ItemKey::Builder(_renderItemKeyGlobalFlags);
|
||||
_renderItemKeyGlobalFlags = (isLODEnabled ? keyBuilder.withLODEnabled() : keyBuilder.withLODDisabled());
|
||||
updateRenderItemsKey(scene);
|
||||
}
|
||||
}
|
||||
bool Model::isLODEnabled() const {
|
||||
return _renderItemKeyGlobalFlags.isLODEnabled();
|
||||
}
|
||||
|
||||
const render::ItemKey Model::getRenderItemKeyGlobalFlags() const {
|
||||
return _renderItemKeyGlobalFlags;
|
||||
}
|
||||
|
|
|
@ -120,9 +120,6 @@ public:
|
|||
bool isGroupCulled() const;
|
||||
void setGroupCulled(bool isGroupCulled, const render::ScenePointer& scene = nullptr);
|
||||
|
||||
bool isLODEnabled() const;
|
||||
void setLODEnabled(bool isLODEnabled, const render::ScenePointer& scene = nullptr);
|
||||
|
||||
bool canCastShadow() const;
|
||||
void setCanCastShadow(bool canCastShadow, const render::ScenePointer& scene = nullptr);
|
||||
|
||||
|
|
|
@ -294,7 +294,7 @@ void CullSpatialSelection::run(const RenderContextPointer& renderContext,
|
|||
auto& item = scene->getItem(id);
|
||||
if (filter.test(item.getKey())) {
|
||||
ItemBound itemBound(id, item.getBound());
|
||||
if (item.getKey().isLODDisabled() || test.solidAngleTest(itemBound.bound)) {
|
||||
if (test.solidAngleTest(itemBound.bound)) {
|
||||
outItems.emplace_back(itemBound);
|
||||
if (item.getKey().isMetaCullGroup()) {
|
||||
item.fetchMetaSubItemBounds(outItems, (*scene));
|
||||
|
@ -329,7 +329,7 @@ void CullSpatialSelection::run(const RenderContextPointer& renderContext,
|
|||
if (filter.test(item.getKey())) {
|
||||
ItemBound itemBound(id, item.getBound());
|
||||
if (test.frustumTest(itemBound.bound)) {
|
||||
if (item.getKey().isLODDisabled() || test.solidAngleTest(itemBound.bound)) {
|
||||
if (test.solidAngleTest(itemBound.bound)) {
|
||||
outItems.emplace_back(itemBound);
|
||||
if (item.getKey().isMetaCullGroup()) {
|
||||
item.fetchMetaSubItemBounds(outItems, (*scene));
|
||||
|
|
|
@ -101,7 +101,6 @@ public:
|
|||
SHADOW_CASTER, // Item cast shadows
|
||||
META_CULL_GROUP, // As a meta item, the culling of my sub items is based solely on my bounding box and my visibility in the view
|
||||
SUB_META_CULLED, // As a sub item of a meta render item set as cull group, need to be set to my culling to the meta render it
|
||||
LOD_DISABLED, // Item LOD behavior is disabled, it won't be LODed because of lod behavior in the view
|
||||
|
||||
FIRST_TAG_BIT, // 8 Tags available to organize the items and filter them against
|
||||
LAST_TAG_BIT = FIRST_TAG_BIT + NUM_TAGS,
|
||||
|
@ -161,8 +160,6 @@ public:
|
|||
Builder& withoutMetaCullGroup() { _flags.reset(META_CULL_GROUP); return (*this); }
|
||||
Builder& withSubMetaCulled() { _flags.set(SUB_META_CULLED); return (*this); }
|
||||
Builder& withoutSubMetaCulled() { _flags.reset(SUB_META_CULLED); return (*this); }
|
||||
Builder& withLODDisabled() { _flags.set(LOD_DISABLED); return (*this); }
|
||||
Builder& withLODEnabled() { _flags.reset(LOD_DISABLED); 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
|
||||
|
@ -206,9 +203,6 @@ public:
|
|||
bool isSubMetaCulled() const { return _flags[SUB_META_CULLED]; }
|
||||
void setSubMetaCulled(bool metaCulled) { (metaCulled ? _flags.set(SUB_META_CULLED) : _flags.reset(SUB_META_CULLED)); }
|
||||
|
||||
bool isLODEnabled() const { return !_flags[LOD_DISABLED]; }
|
||||
bool isLODDisabled() const { return _flags[LOD_DISABLED]; }
|
||||
|
||||
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); }
|
||||
|
||||
|
@ -280,9 +274,6 @@ public:
|
|||
Builder& withoutSubMetaCulled() { _value.reset(ItemKey::SUB_META_CULLED); _mask.set(ItemKey::SUB_META_CULLED); return (*this); }
|
||||
Builder& withSubMetaCulled() { _value.set(ItemKey::SUB_META_CULLED); _mask.set(ItemKey::SUB_META_CULLED); return (*this); }
|
||||
|
||||
Builder& withLODEnabled() { _value.reset(ItemKey::LOD_DISABLED); _mask.set(ItemKey::LOD_DISABLED); return (*this); }
|
||||
Builder& withLODDisabled() { _value.set(ItemKey::LOD_DISABLED); _mask.set(ItemKey::LOD_DISABLED); 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
|
||||
|
|
Loading…
Reference in a new issue