TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
VMAP Namespace Reference

Classes

struct  AreaInfo
 
class  AreaInfoCallback
 
struct  GModelRayCallback
 
class  GroupModel
 
struct  GroupModel_Raw
 
class  IntersectionCallBack
 
class  IVMapManager
 
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  VMapManager2
 
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, ManagedModel
ModelFileMap
 
typedef std::map< uint32,
ModelSpawn
UniqueEntryMap
 
typedef std::multimap< uint32,
uint32
TileMap
 
typedef std::map< uint32,
MapSpawns * > 
MapData
 

Enumerations

enum  VMAP_LOAD_RESULT { VMAP_LOAD_RESULT_ERROR, VMAP_LOAD_RESULT_OK, VMAP_LOAD_RESULT_IGNORED }
 
enum  DisableTypes { VMAP_DISABLE_AREAFLAG = 0x1, VMAP_DISABLE_HEIGHT = 0x2, VMAP_DISABLE_LOS = 0x4, VMAP_DISABLE_LIQUIDSTATUS = 0x8 }
 
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)
 
bool IntersectTriangle (const MeshTriangle &tri, std::vector< Vector3 >::const_iterator points, const G3D::Ray &ray, float &distance)
 

Variables

IVMapManagergVMapManager = NULL
 
const char VMAP_MAGIC [] = "VMAP_4.3"
 
const char RAW_VMAP_MAGIC [] = "VMAP043"
 
const char GAMEOBJECT_MODELS [] = "GameObjectModels.dtree"
 

Detailed Description

This is the minimum interface to the VMapMamager.

This is the access point to the VMapManager.

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

typedef std::unordered_map<uint32, StaticMapTree*> VMAP::InstanceTreeMap
typedef std::map<uint32, MapSpawns*> VMAP::MapData
typedef std::unordered_map<std::string, ManagedModel> VMAP::ModelFileMap
typedef std::multimap<uint32, uint32> VMAP::TileMap

Enumeration Type Documentation

Enumerator
VMAP_DISABLE_AREAFLAG 
VMAP_DISABLE_HEIGHT 
VMAP_DISABLE_LOS 
VMAP_DISABLE_LIQUIDSTATUS 
71  {
73  VMAP_DISABLE_HEIGHT = 0x2,
74  VMAP_DISABLE_LOS = 0x4,
76  };
Definition: VMapManager2.h:73
Definition: VMapManager2.h:75
Definition: VMapManager2.h:74
Definition: VMapManager2.h:72
Enumerator
MOD_M2 
MOD_WORLDSPAWN 
MOD_HAS_BOUND 
36  {
37  MOD_M2 = 1,
38  MOD_WORLDSPAWN = 1<<1,
39  MOD_HAS_BOUND = 1<<2
40  };
Definition: vmapexport.h:26
Definition: vmapexport.h:28
Definition: vmapexport.h:27
Enumerator
VMAP_LOAD_RESULT_ERROR 
VMAP_LOAD_RESULT_OK 
VMAP_LOAD_RESULT_IGNORED 
35  {
39  };
Definition: IVMapManager.h:38
Definition: IVMapManager.h:36
Definition: IVMapManager.h:37

Function Documentation

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  // Determinant is ill-conditioned; abort early
47  return false;
48  }
49 
50  const float f = 1.0f / a;
51  const Vector3 s(ray.origin() - points[tri.idx0]);
52  const float u = f * s.dot(p);
53 
54  if ((u < 0.0f) || (u > 1.0f)) {
55  // We hit the plane of the m_geometry, but outside the m_geometry
56  return false;
57  }
58 
59  const Vector3 q(s.cross(e1));
60  const float v = f * ray.direction().dot(q);
61 
62  if ((v < 0.0f) || ((u + v) > 1.0f)) {
63  // We hit the plane of the triangle, but outside the triangle
64  return false;
65  }
66 
67  const float t = f * e2.dot(q);
68 
69  if ((t > 0.0f) && (t < distance))
70  {
71  // This is a new hit, closer than the previous one
72  distance = t;
73 
74  /* baryCoord[0] = 1.0 - u - v;
75  baryCoord[1] = u;
76  baryCoord[2] = v; */
77 
78  return true;
79  }
80  // This hit is after the previous hit, so ignore it
81  return false;
82  }
float __fastcall dot(const Vector3 &rkVector) const
Definition: Vector3.h:771
double distance(double x, double y)
Definition: g3dmath.h:731
Definition: Vector3.h:58
Vector3 __fastcall cross(const Vector3 &rkVector) const
Definition: Vector3.h:776
const Point3 & origin() const
Definition: Ray.h:56
const Vector3 & direction() const
Definition: Ray.h:61

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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  }

+ Here is the caller graph for this function:

Variable Documentation

const char VMAP::GAMEOBJECT_MODELS[] = "GameObjectModels.dtree"
IVMapManager* VMAP::gVMapManager = NULL
const char VMAP::RAW_VMAP_MAGIC[] = "VMAP043"
const char VMAP::VMAP_MAGIC[] = "VMAP_4.3"