From a029f97c8231f7be188663d63f95f34dd1b4f9e1 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 25 Jul 2015 15:37:35 +0200 Subject: Core/Collision: Removed direct GameObject references from collision project --- src/server/collision/Models/GameObjectModel.h | 41 ++++++++++++++++++--------- 1 file changed, 27 insertions(+), 14 deletions(-) (limited to 'src/server/collision/Models/GameObjectModel.h') diff --git a/src/server/collision/Models/GameObjectModel.h b/src/server/collision/Models/GameObjectModel.h index 43d299d6d8f..17669189af5 100644 --- a/src/server/collision/Models/GameObjectModel.h +++ b/src/server/collision/Models/GameObjectModel.h @@ -25,6 +25,7 @@ #include #include "Define.h" +#include namespace VMAP { @@ -34,21 +35,21 @@ namespace VMAP class GameObject; struct GameObjectDisplayInfoEntry; -class GameObjectModel /*, public Intersectable*/ +class GameObjectModelOwnerBase { - uint32 phasemask; - G3D::AABox iBound; - G3D::Matrix3 iInvRot; - G3D::Vector3 iPos; - //G3D::Vector3 iRot; - float iInvScale; - float iScale; - VMAP::WorldModel* iModel; - GameObject const* owner; - - GameObjectModel() : phasemask(0), iInvScale(0), iScale(0), iModel(NULL), owner(NULL) { } - bool initialize(const GameObject& go, const GameObjectDisplayInfoEntry& info); +public: + virtual bool IsSpawned() const { return false; } + virtual uint32 GetDisplayId() const { return 0; } + virtual uint32 GetPhaseMask() const { return 0; } + virtual G3D::Vector3 GetPosition() const { return G3D::Vector3::zero(); } + virtual float GetOrientation() const { return 0.0f; } + virtual float GetScale() const { return 1.0f; } + virtual void DebugVisualizeCorner(G3D::Vector3 const& /*corner*/) const { } +}; +class GameObjectModel /*, public Intersectable*/ +{ + GameObjectModel() : phasemask(0), iInvScale(0), iScale(0), iModel(NULL) { } public: std::string name; @@ -66,9 +67,21 @@ public: bool intersectRay(const G3D::Ray& Ray, float& MaxDist, bool StopAtFirstHit, uint32 ph_mask) const; - static GameObjectModel* Create(const GameObject& go); + static GameObjectModel* Create(std::unique_ptr modelOwner, std::string const& dataPath); bool UpdatePosition(); + +private: + bool initialize(std::unique_ptr modelOwner, std::string const& dataPath); + + uint32 phasemask; + G3D::AABox iBound; + G3D::Matrix3 iInvRot; + G3D::Vector3 iPos; + float iInvScale; + float iScale; + VMAP::WorldModel* iModel; + std::unique_ptr owner; }; #endif // _GAMEOBJECT_MODEL_H -- cgit v1.2.3