From c8056f6561ec0fed1389b4ac123523ed47d8a350 Mon Sep 17 00:00:00 2001 From: Petr Mikheev Date: Tue, 16 May 2023 10:24:56 +0200 Subject: [PATCH] Hide ESM4 LOD objects and markers --- apps/openmw/mwclass/esm4base.hpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/apps/openmw/mwclass/esm4base.hpp b/apps/openmw/mwclass/esm4base.hpp index a06ffa881a..9fd2f68249 100644 --- a/apps/openmw/mwclass/esm4base.hpp +++ b/apps/openmw/mwclass/esm4base.hpp @@ -2,6 +2,7 @@ #define GAME_MWCLASS_ESM4BASE_H #include +#include #include "../mwgui/tooltips.hpp" @@ -44,9 +45,6 @@ namespace MWClass void insertObjectRendering(const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const override { - const MWWorld::LiveCellRef* ref = ptr.get(); - if (ref->mBase->mFlags & ESM4::Rec_Marker) - return; ESM4Impl::insertObjectRendering(ptr, model, renderingInterface); } @@ -59,9 +57,6 @@ namespace MWClass void insertObjectPhysics(const MWWorld::Ptr& ptr, const std::string& model, const osg::Quat& rotation, MWPhysics::PhysicsSystem& physics) const override { - const MWWorld::LiveCellRef* ref = ptr.get(); - if (ref->mBase->mFlags & ESM4::Rec_Marker) - return; ESM4Impl::insertObjectPhysics(ptr, model, rotation, physics); } @@ -69,7 +64,19 @@ namespace MWClass std::string_view getName(const MWWorld::ConstPtr& ptr) const override { return ""; } - std::string getModel(const MWWorld::ConstPtr& ptr) const override { return getClassModel(ptr); } + std::string getModel(const MWWorld::ConstPtr& ptr) const override + { + std::string model = getClassModel(ptr); + + // Hide meshes meshes/marker/* and *LOD.nif in ESM4 cells. It is a temporarty hack. + // Needed because otherwise LOD meshes are rendered on top of normal meshes. + // TODO: Figure out a better way find markers and LOD meshes; show LOD only outside of active grid. + if (model.empty() || Misc::StringUtils::ciStartsWith(model, "meshes\\marker") + || Misc::StringUtils::ciEndsWith(model, "lod.nif")) + return ""; + + return model; + } }; class ESM4Static final : public MWWorld::RegisteredClass>