Core/GameObjects: Skip gameobjects with M2 models when searching for area info (perf...
authorShauren <shauren.trinity@gmail.com>
Sat, 7 Apr 2018 22:04:20 +0000 (00:04 +0200)
committerShauren <shauren.trinity@gmail.com>
Sat, 7 Apr 2018 22:04:20 +0000 (00:04 +0200)
src/common/Collision/Models/GameObjectModel.cpp
src/common/Collision/Models/GameObjectModel.h

index 22de17e1ad0fe5b89c89fb1c36b6706f44f938dd..07c1ffe548cb75edcfab81708429c1427c9e9853 100644 (file)
@@ -145,6 +145,7 @@ bool GameObjectModel::initialize(std::unique_ptr<GameObjectModelOwnerBase> model
 #endif
 
     owner = std::move(modelOwner);
+    isWmo = it->second.isWmo;
     return true;
 }
 
@@ -187,7 +188,7 @@ bool GameObjectModel::intersectRay(G3D::Ray const& ray, float& maxDist, bool sto
 
 void GameObjectModel::intersectPoint(G3D::Vector3 const& point, VMAP::AreaInfo& info, PhaseShift const& phaseShift) const
 {
-    if (!isCollisionEnabled() || !owner->IsSpawned())
+    if (!isCollisionEnabled() || !owner->IsSpawned() || !isMapObject())
         return;
 
     if (!owner->IsInPhase(phaseShift))
index e6211cd0243be103027389bbd888fb5927ad1f0e..287f93f87cadc8fea39372896e62d6a5e8500423 100644 (file)
@@ -54,7 +54,7 @@ public:
 
 class TC_COMMON_API GameObjectModel /*, public Intersectable*/
 {
-    GameObjectModel() : _collisionEnabled(false), iInvScale(0), iScale(0), iModel(nullptr) { }
+    GameObjectModel() : _collisionEnabled(false), iInvScale(0), iScale(0), iModel(nullptr), isWmo(false) { }
 public:
     std::string name;
 
@@ -67,6 +67,7 @@ public:
     /* Enables/disables collision */
     void enableCollision(bool enable) { _collisionEnabled = enable; }
     bool isCollisionEnabled() const { return _collisionEnabled; }
+    bool isMapObject() const { return isWmo; }
 
     bool intersectRay(G3D::Ray const& ray, float& maxDist, bool stopAtFirstHit, PhaseShift const& phaseShift) const;
     void intersectPoint(G3D::Vector3 const& point, VMAP::AreaInfo& info, PhaseShift const& phaseShift) const;
@@ -86,6 +87,7 @@ private:
     float iScale;
     VMAP::WorldModel* iModel;
     std::unique_ptr<GameObjectModelOwnerBase> owner;
+    bool isWmo;
 };
 
 TC_COMMON_API void LoadGameObjectModelList(std::string const& dataPath);