From 35a2d49971984bcab96ac64fc52b30a9a4e06ce3 Mon Sep 17 00:00:00 2001 From: Shauren Date: Fri, 5 Jul 2024 21:20:25 +0200 Subject: Core/Vmaps: Optimize loading vmaps * Changed spawn id to BIH tree index mapping from generated on load to baked in tile files * Remove map holding model load counts and moved that to ModelInstance instead --- src/common/Collision/Models/ModelInstance.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/common/Collision/Models/ModelInstance.h') diff --git a/src/common/Collision/Models/ModelInstance.h b/src/common/Collision/Models/ModelInstance.h index 78b07f11f4b..1621e1d052e 100644 --- a/src/common/Collision/Models/ModelInstance.h +++ b/src/common/Collision/Models/ModelInstance.h @@ -69,7 +69,7 @@ namespace VMAP class TC_COMMON_API ModelInstance : public ModelMinimalData { public: - ModelInstance() : iInvScale(0.0f), iModel(nullptr) { } + ModelInstance() : iInvScale(0.0f), iModel(nullptr), referencingTiles(0) { } ModelInstance(ModelSpawn const& spawn, std::shared_ptr model); void setUnloaded() { iModel = nullptr; } bool intersectRay(G3D::Ray const& pRay, float& pMaxDist, bool pStopAtFirstHit, ModelIgnoreFlags ignoreFlags) const; @@ -77,10 +77,13 @@ namespace VMAP bool GetLiquidLevel(G3D::Vector3 const& p, LocationInfo& info, float& liqHeight) const; G3D::Matrix3 const& GetInvRot() const { return iInvRot; } WorldModel const* getWorldModel() const { return iModel.get(); } + void AddTileReference() { ++referencingTiles; } + uint32 RemoveTileReference() { return --referencingTiles; } protected: G3D::Matrix3 iInvRot; float iInvScale; std::shared_ptr iModel; + uint32 referencingTiles; }; } // namespace VMAP -- cgit v1.2.3