Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
GameObjectModel.h
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#ifndef _GAMEOBJECT_MODEL_H
7#define _GAMEOBJECT_MODEL_H
8
9#include <G3D/Matrix3.h>
10#include <G3D/Vector3.h>
11#include <G3D/AABox.h>
12#include <G3D/Ray.h>
13
14#include "Define.h"
15
16#include <memory>
17namespace VMAP
18{
19 class WorldModel;
20}
21
22class GameObject;
24
26{
27public:
29 virtual bool isSpawned() const { return false; }
30 virtual uint32 GetDisplayId() const { return 0; }
31 virtual uint32 GetPhaseMask() const { return 0; }
32 virtual G3D::Vector3 GetPosition() const { return G3D::Vector3::zero(); }
33 virtual float GetOrientation() const { return 0.0f; }
34 virtual float GetScale() const { return 1.0f; }
35 virtual void DebugVisualizeCorner(G3D::Vector3 const& /*corner*/) const { }
36};
37
38class GameObjectModel /*, public Intersectable*/
39{
41private:
42 bool initialize(std::unique_ptr<GameObjectModelOwnerBase> modelOwner, std::string const& dataPath);
43
45 G3D::AABox iBound;
46 G3D::Matrix3 iInvRot;
47 G3D::Vector3 iPos;
48 float iInvScale;
49 float iScale;
51 std::unique_ptr<GameObjectModelOwnerBase> owner;
52
53public:
54 std::string name;
55
56 const G3D::AABox& getBounds() const { return iBound; }
57
59
60 const G3D::Vector3& getPosition() const { return iPos;}
61
63 void disable() { phasemask = 0;}
64 void enable(uint32 ph_mask) { phasemask = ph_mask;}
65
66 bool isEnabled() const {return phasemask != 0;}
67
68 bool intersectRay(const G3D::Ray& Ray, float& MaxDist, bool StopAtFirstHit, uint32 ph_mask) const;
69
70 static GameObjectModel* Create(std::unique_ptr<GameObjectModelOwnerBase> modelOwner, std::string const& dataPath);
71 bool Relocate();
72};
73
74#endif // _GAMEOBJECT_MODEL_H
std::uint32_t uint32
Definition Define.h:77
G3D::Vector3 iPos
bool isEnabled() const
const G3D::AABox & getBounds() const
const G3D::Vector3 & getPosition() const
G3D::Matrix3 iInvRot
VMAP::WorldModel * iModel
static GameObjectModel * Create(std::unique_ptr< GameObjectModelOwnerBase > modelOwner, std::string const &dataPath)
void enable(uint32 ph_mask)
std::unique_ptr< GameObjectModelOwnerBase > owner
bool intersectRay(const G3D::Ray &Ray, float &MaxDist, bool StopAtFirstHit, uint32 ph_mask) const
bool initialize(std::unique_ptr< GameObjectModelOwnerBase > modelOwner, std::string const &dataPath)
virtual void DebugVisualizeCorner(G3D::Vector3 const &) const
virtual uint32 GetDisplayId() const
virtual G3D::Vector3 GetPosition() const
virtual float GetOrientation() const
virtual float GetScale() const
virtual uint32 GetPhaseMask() const
virtual bool isSpawned() const