feat(Core/Common): delete lib game-interface inherited (#5333)

Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
This commit is contained in:
Kargatum
2021-05-07 02:16:44 +07:00
committed by GitHub
parent 6947789622
commit db7d754f3f
45 changed files with 428 additions and 475 deletions

View File

@@ -7,13 +7,12 @@
#ifndef _GAMEOBJECT_MODEL_H
#define _GAMEOBJECT_MODEL_H
#include "Define.h"
#include <G3D/Matrix3.h>
#include <G3D/Vector3.h>
#include <G3D/AABox.h>
#include <G3D/Ray.h>
#include "Define.h"
namespace VMAP
{
class WorldModel;
@@ -22,20 +21,23 @@ namespace VMAP
class GameObject;
struct GameObjectDisplayInfoEntry;
class GameObjectModel /*, public Intersectable*/
class GameObjectModelOwnerBase
{
uint32 phasemask{0};
G3D::AABox iBound;
G3D::Matrix3 iInvRot;
G3D::Vector3 iPos;
//G3D::Vector3 iRot;
float iInvScale{0};
float iScale{0};
VMAP::WorldModel* iModel;
GameObject const* owner;
public:
virtual ~GameObjectModelOwnerBase() = default;
GameObjectModel() : iModel(nullptr), owner(nullptr) { }
bool initialize(const GameObject& go, const GameObjectDisplayInfoEntry& info);
virtual bool IsSpawned() const = 0;
virtual uint32 GetDisplayId() const = 0;
virtual uint32 GetPhaseMask() const = 0;
virtual G3D::Vector3 GetPosition() const = 0;
virtual float GetOrientation() const = 0;
virtual float GetScale() const = 0;
virtual void DebugVisualizeCorner(G3D::Vector3 const& /*corner*/) const = 0;
};
class GameObjectModel
{
GameObjectModel() : phasemask(0), iInvScale(0), iScale(0), iModel(nullptr) { }
public:
std::string name;
@@ -44,19 +46,33 @@ public:
~GameObjectModel();
[[nodiscard]] const G3D::Vector3& getPosition() const { return iPos;}
[[nodiscard]] const G3D::Vector3& getPosition() const { return iPos; }
/** Enables\disables collision. */
void disable() { phasemask = 0;}
void enable(uint32 ph_mask) { phasemask = ph_mask;}
/** Enables\disables collision. */
void disable() { phasemask = 0; }
void enable(uint32 ph_mask) { phasemask = ph_mask; }
[[nodiscard]] bool isEnabled() const {return phasemask != 0;}
[[nodiscard]] bool isEnabled() const { return phasemask != 0; }
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
void LoadGameObjectModelList(std::string const& dataPath);
#endif // _GAMEOBJECT_MODEL_H