diff options
author | Shauren <shauren.trinity@gmail.com> | 2015-07-25 15:37:35 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2015-07-25 15:37:35 +0200 |
commit | a029f97c8231f7be188663d63f95f34dd1b4f9e1 (patch) | |
tree | 74b0c8728c8d783944ce3e3d2689a0a709287640 /src/server/collision/Models/GameObjectModel.h | |
parent | ddcc0352d00b7fa3e77d2c7d4cbf6bc92edf9995 (diff) |
Core/Collision: Removed direct GameObject references from collision project
Diffstat (limited to 'src/server/collision/Models/GameObjectModel.h')
-rw-r--r-- | src/server/collision/Models/GameObjectModel.h | 41 |
1 files changed, 27 insertions, 14 deletions
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 <G3D/Ray.h> #include "Define.h" +#include <memory> 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<GameObjectModelOwnerBase> modelOwner, std::string const& dataPath); bool UpdatePosition(); + +private: + bool initialize(std::unique_ptr<GameObjectModelOwnerBase> 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<GameObjectModelOwnerBase> owner; }; #endif // _GAMEOBJECT_MODEL_H |