diff --git a/src/GameObjects/GameObject.h b/src/GameObjects/GameObject.h index 31a355c8..4d15e5d8 100644 --- a/src/GameObjects/GameObject.h +++ b/src/GameObjects/GameObject.h @@ -31,7 +31,7 @@ class GameObject { virtual uint32_t getWorldObjectID() const = 0; virtual ~GameObject() = default; - void addTag(const std::string& text) { + virtual void addTag(const std::string& text) { HashUtil::HashedString tag(text); bool found = false; for (const HashUtil::HashedString& hashedString:tags) { @@ -63,7 +63,7 @@ class GameObject { return tags; } - void removeTag(const std::string& text) { + virtual void removeTag(const std::string& text) { HashUtil::HashedString tag(text); bool found = false; for (std::list::const_iterator it = tags.begin(); it != tags.end(); ++it) { diff --git a/src/GameObjects/Model.h b/src/GameObjects/Model.h index b6be8bd2..c39bffad 100644 --- a/src/GameObjects/Model.h +++ b/src/GameObjects/Model.h @@ -281,6 +281,17 @@ class Model : public PhysicalRenderable, public GameObject { return materials; } + void addTag(const std::string& text) override { + this->dirtyForFrustum = true; + GameObject::addTag(text); + } + + void removeTag(const std::string& text) override { + this->dirtyForFrustum = true; + GameObject::removeTag(text); + } + + }; #endif //LIMONENGINE_MODEL_H diff --git a/src/World.cpp b/src/World.cpp index 9f7ecef5..23fd2bb6 100755 --- a/src/World.cpp +++ b/src/World.cpp @@ -510,6 +510,12 @@ void World::setPlayerAttachmentsForChangedBoneTransforms(Model *playerAttachment visibilityEntry.second.removeMeshMaterial(meshMeta->material, meshMeta->mesh, currentModel->getWorldObjectID()); } } + } else { + //what if we are not matching a tag, but we at some point did? + const std::vector &meshMetas =currentModel->getMeshMetaData(); + for (auto meshMeta:meshMetas) { + visibilityEntry.second.removeMeshMaterial(meshMeta->material, meshMeta->mesh, currentModel->getWorldObjectID()); + } } } }