AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
VMAP Namespace Reference

Classes

struct  AreaAndLiquidData
 
struct  AreaInfo
 
class  AreaInfoCallback
 
struct  GModelRayCallback
 
class  GroupModel
 
struct  GroupModel_Raw
 
class  IntersectionCallBack
 
class  IVMapMgr
 
struct  LocationInfo
 
class  LocationInfoCallback
 
class  ManagedModel
 
class  MapRayCallback
 
struct  MapSpawns
 
class  MeshTriangle
 
class  ModelInstance
 
class  ModelPosition
 
class  ModelSpawn
 
class  MyCollisionDetection
 
class  StaticMapTree
 
class  TileAssembler
 
class  TriBoundFunc
 
class  VMapFactory
 
class  VMapMgr2
 
class  WModelAreaCallback
 
struct  WModelRayCallBack
 
class  WmoLiquid
 
struct  WMOLiquidHeader
 
class  WorldModel
 
struct  WorldModel_Raw
 

Typedefs

typedef std::unordered_map< uint32, StaticMapTree * > InstanceTreeMap
 
typedef std::unordered_map< std::string, ManagedModelModelFileMap
 
typedef std::map< uint32, ModelSpawnUniqueEntryMap
 
typedef std::multimap< uint32, uint32TileMap
 
typedef std::map< uint32, MapSpawns * > MapData
 

Enumerations

enum  VMAP_LOAD_RESULT {
  VMAP_LOAD_RESULT_ERROR ,
  VMAP_LOAD_RESULT_OK ,
  VMAP_LOAD_RESULT_IGNORED
}
 
enum class  LoadResult : uint8 {
  Success ,
  FileNotFound ,
  VersionMismatch
}
 
enum  DisableTypes {
  VMAP_DISABLE_AREAFLAG = 0x1 ,
  VMAP_DISABLE_HEIGHT = 0x2 ,
  VMAP_DISABLE_LOS = 0x4 ,
  VMAP_DISABLE_LIQUIDSTATUS = 0x8
}
 
enum class  ModelIgnoreFlags : uint32 {
  Nothing = 0x00 ,
  M2 = 0x01
}
 
enum  ModelFlags {
  MOD_M2 = 1 ,
  MOD_WORLDSPAWN = 1 << 1 ,
  MOD_HAS_BOUND = 1 << 2
}
 

Functions

bool readChunk (FILE *rf, char *dest, const char *compare, uint32 len)
 
ModelIgnoreFlags operator& (ModelIgnoreFlags left, ModelIgnoreFlags right)
 
bool IntersectTriangle (const MeshTriangle &tri, std::vector< Vector3 >::const_iterator points, const G3D::Ray &ray, float &distance)
 

Variables

VMapMgr2gVMapMgr = nullptr
 
const char VMAP_MAGIC [] = "VMAP_4.7"
 
const char RAW_VMAP_MAGIC [] = "VMAP047"
 
const char GAMEOBJECT_MODELS [] = "GameObjectModels.dtree"
 

Detailed Description

This is the minimum interface to the VMapMamager.

The Class is mainly taken from G3D/AABSPTree.h but modified to be able to use our internal data structure. This is an iterator that helps us analysing the BSP-Trees. The collision detection is modified to return true, if we are inside an object.

Typedef Documentation

◆ InstanceTreeMap

typedef std::unordered_map<uint32, StaticMapTree*> VMAP::InstanceTreeMap

◆ MapData

typedef std::map<uint32, MapSpawns*> VMAP::MapData

◆ ModelFileMap

typedef std::unordered_map<std::string, ManagedModel> VMAP::ModelFileMap

◆ TileMap

typedef std::multimap<uint32, uint32> VMAP::TileMap

◆ UniqueEntryMap

Enumeration Type Documentation

◆ DisableTypes

Enumerator
VMAP_DISABLE_AREAFLAG 
VMAP_DISABLE_HEIGHT 
VMAP_DISABLE_LOS 
VMAP_DISABLE_LIQUIDSTATUS 
68 {
71 VMAP_DISABLE_LOS = 0x4,
73 };
@ VMAP_DISABLE_LIQUIDSTATUS
Definition: VMapMgr2.h:72
@ VMAP_DISABLE_LOS
Definition: VMapMgr2.h:71
@ VMAP_DISABLE_HEIGHT
Definition: VMapMgr2.h:70
@ VMAP_DISABLE_AREAFLAG
Definition: VMapMgr2.h:69

◆ LoadResult

enum class VMAP::LoadResult : uint8
strong
Enumerator
Success 
FileNotFound 
VersionMismatch 

◆ ModelFlags

Enumerator
MOD_M2 
MOD_WORLDSPAWN 
MOD_HAS_BOUND 
35 {
36 MOD_M2 = 1,
37 MOD_WORLDSPAWN = 1 << 1,
38 MOD_HAS_BOUND = 1 << 2
39 };
@ MOD_M2
Definition: vmapexport.h:33
@ MOD_WORLDSPAWN
Definition: vmapexport.h:34
@ MOD_HAS_BOUND
Definition: vmapexport.h:35

◆ ModelIgnoreFlags

enum class VMAP::ModelIgnoreFlags : uint32
strong
Enumerator
Nothing 
M2 
26 {
27 Nothing = 0x00,
28 M2 = 0x01
29 };

◆ VMAP_LOAD_RESULT

Enumerator
VMAP_LOAD_RESULT_ERROR 
VMAP_LOAD_RESULT_OK 
VMAP_LOAD_RESULT_IGNORED 
35 {
39 };
@ VMAP_LOAD_RESULT_ERROR
Definition: IVMapMgr.h:36
@ VMAP_LOAD_RESULT_OK
Definition: IVMapMgr.h:37
@ VMAP_LOAD_RESULT_IGNORED
Definition: IVMapMgr.h:38

Function Documentation

◆ IntersectTriangle()

bool VMAP::IntersectTriangle ( const MeshTriangle tri,
std::vector< Vector3 >::const_iterator  points,
const G3D::Ray &  ray,
float &  distance 
)
35 {
36 static const float EPS = 1e-5f;
37
38 // See RTR2 ch. 13.7 for the algorithm.
39
40 const Vector3 e1 = points[tri.idx1] - points[tri.idx0];
41 const Vector3 e2 = points[tri.idx2] - points[tri.idx0];
42 const Vector3 p(ray.direction().cross(e2));
43 const float a = e1.dot(p);
44
45 if (std::fabs(a) < EPS)
46 {
47 // Determinant is ill-conditioned; abort early
48 return false;
49 }
50
51 const float f = 1.0f / a;
52 const Vector3 s(ray.origin() - points[tri.idx0]);
53 const float u = f * s.dot(p);
54
55 if ((u < 0.0f) || (u > 1.0f))
56 {
57 // We hit the plane of the m_geometry, but outside the m_geometry
58 return false;
59 }
60
61 const Vector3 q(s.cross(e1));
62 const float v = f * ray.direction().dot(q);
63
64 if ((v < 0.0f) || ((u + v) > 1.0f))
65 {
66 // We hit the plane of the triangle, but outside the triangle
67 return false;
68 }
69
70 const float t = f * e2.dot(q);
71
72 if ((t > 0.0f) && (t < distance))
73 {
74 // This is a new hit, closer than the previous one
75 distance = t;
76
77 /* baryCoord[0] = 1.0 - u - v;
78 baryCoord[1] = u;
79 baryCoord[2] = v; */
80
81 return true;
82 }
83 // This hit is after the previous hit, so ignore it
84 return false;
85 }
uint32 idx1
Definition: WorldModel.h:41
uint32 idx2
Definition: WorldModel.h:42
uint32 idx0
Definition: WorldModel.h:40

References VMAP::MeshTriangle::idx0, VMAP::MeshTriangle::idx1, and VMAP::MeshTriangle::idx2.

Referenced by VMAP::GModelRayCallback::operator()().

◆ operator&()

ModelIgnoreFlags VMAP::operator& ( ModelIgnoreFlags  left,
ModelIgnoreFlags  right 
)
inline
32 {
33 return ModelIgnoreFlags(uint32(left) & uint32(right));
34 }
std::uint32_t uint32
Definition: Define.h:107
ModelIgnoreFlags
Definition: ModelIgnoreFlags.h:26

◆ readChunk()

bool VMAP::readChunk ( FILE *  rf,
char *  dest,
const char *  compare,
uint32  len 
)
41 {
42 if (fread(dest, sizeof(char), len, rf) != len) { return false; }
43 return memcmp(dest, compare, len) == 0;
44 }

Referenced by VMAP::StaticMapTree::CanLoadMap(), VMAP::StaticMapTree::InitMap(), VMAP::StaticMapTree::LoadMapTile(), VMAP::WorldModel::readFile(), VMAP::GroupModel::readFromFile(), and VMAP::StaticMapTree::UnloadMapTile().

Variable Documentation

◆ GAMEOBJECT_MODELS

const char VMAP::GAMEOBJECT_MODELS[] = "GameObjectModels.dtree"

◆ gVMapMgr

VMapMgr2* VMAP::gVMapMgr = nullptr

◆ RAW_VMAP_MAGIC

◆ VMAP_MAGIC