Skip to content

Commit

Permalink
Fix tag changes don't get reflected immediately
Browse files Browse the repository at this point in the history
  • Loading branch information
enginmanap committed Dec 30, 2024
1 parent dba18c2 commit e8fde20
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/GameObjects/GameObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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<HashUtil::HashedString>::const_iterator it = tags.begin(); it != tags.end(); ++it) {
Expand Down
11 changes: 11 additions & 0 deletions src/GameObjects/Model.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 6 additions & 0 deletions src/World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Model::MeshMeta *> &meshMetas =currentModel->getMeshMetaData();
for (auto meshMeta:meshMetas) {
visibilityEntry.second.removeMeshMaterial(meshMeta->material, meshMeta->mesh, currentModel->getWorldObjectID());
}
}
}
}
Expand Down

0 comments on commit e8fde20

Please sign in to comment.