Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
ModelInstance.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 _MODELINSTANCE_H_
7#define _MODELINSTANCE_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
16namespace VMAP
17{
18 class WorldModel;
19 struct AreaInfo;
20 struct LocationInfo;
21
23 {
24 MOD_M2 = 1,
27 };
28
30 {
31 public:
32 //mapID, tileX, tileY, Flags, ID, Pos, Rot, Scale, Bound_lo, Bound_hi, name
36 G3D::Vector3 iPos;
37 G3D::Vector3 iRot;
38 float iScale;
39 G3D::AABox iBound;
40 std::string name;
41 bool operator==(const ModelSpawn &other) const { return ID == other.ID; }
42 //uint32 hashCode() const { return ID; }
43 // temp?
44 const G3D::AABox& getBounds() const { return iBound; }
45
46 static bool readFromFile(FILE* rf, ModelSpawn &spawn);
47 static bool writeToFile(FILE* rw, const ModelSpawn &spawn);
48 };
49
51 {
52 public:
53 ModelInstance() : iInvScale(0.0f), iModel(0) { }
54 ModelInstance(const ModelSpawn &spawn, WorldModel* model);
55 void setUnloaded() { iModel = 0; }
56 bool intersectRay(const G3D::Ray& pRay, float& pMaxDist, bool pStopAtFirstHit) const;
57 void intersectPoint(const G3D::Vector3& p, AreaInfo &info) const;
58 bool GetLocationInfo(const G3D::Vector3& p, LocationInfo &info) const;
59 bool GetLiquidLevel(const G3D::Vector3& p, LocationInfo &info, float &liqHeight) const;
60 protected:
61 G3D::Matrix3 iInvRot;
62 float iInvScale;
64 public:
66 };
67} // namespace VMAP
68
69#endif // _MODELINSTANCE
std::uint32_t uint32
Definition Define.h:77
std::uint16_t uint16
Definition Define.h:78
WorldModel * getWorldModel()
bool GetLocationInfo(const G3D::Vector3 &p, LocationInfo &info) const
void intersectPoint(const G3D::Vector3 &p, AreaInfo &info) const
G3D::Matrix3 iInvRot
WorldModel * iModel
bool GetLiquidLevel(const G3D::Vector3 &p, LocationInfo &info, float &liqHeight) const
bool intersectRay(const G3D::Ray &pRay, float &pMaxDist, bool pStopAtFirstHit) const
static bool readFromFile(FILE *rf, ModelSpawn &spawn)
std::string name
G3D::Vector3 iRot
bool operator==(const ModelSpawn &other) const
G3D::Vector3 iPos
G3D::AABox iBound
static bool writeToFile(FILE *rw, const ModelSpawn &spawn)
const G3D::AABox & getBounds() const
@ MOD_WORLDSPAWN
@ MOD_HAS_BOUND