refactor(Collision): update some methods to UpperCamelCase (#6486)

This commit is contained in:
Kitzunu
2021-06-27 16:37:22 +02:00
committed by GitHub
parent a2a01e19d1
commit b84f9b8a4b
18 changed files with 63 additions and 61 deletions

View File

@@ -66,7 +66,7 @@ private:
public: public:
BIH() { init_empty(); } BIH() { init_empty(); }
template< class BoundsFunc, class PrimArray > template< class BoundsFunc, class PrimArray >
void build(const PrimArray& primitives, BoundsFunc& getBounds, uint32 leafSize = 3, bool printStats = false) void build(const PrimArray& primitives, BoundsFunc& GetBounds, uint32 leafSize = 3, bool printStats = false)
{ {
if (primitives.size() == 0) if (primitives.size() == 0)
{ {
@@ -79,11 +79,11 @@ public:
dat.numPrims = primitives.size(); dat.numPrims = primitives.size();
dat.indices = new uint32[dat.numPrims]; dat.indices = new uint32[dat.numPrims];
dat.primBound = new G3D::AABox[dat.numPrims]; dat.primBound = new G3D::AABox[dat.numPrims];
getBounds(primitives[0], bounds); GetBounds(primitives[0], bounds);
for (uint32 i = 0; i < dat.numPrims; ++i) for (uint32 i = 0; i < dat.numPrims; ++i)
{ {
dat.indices[i] = i; dat.indices[i] = i;
getBounds(primitives[i], dat.primBound[i]); GetBounds(primitives[i], dat.primBound[i]);
bounds.merge(dat.primBound[i]); bounds.merge(dat.primBound[i]);
} }
std::vector<uint32> tempTree; std::vector<uint32> tempTree;

View File

@@ -97,7 +97,7 @@ public:
m_objects_to_push.getMembers(m_objects); m_objects_to_push.getMembers(m_objects);
//assert that m_obj2Idx has all the keys //assert that m_obj2Idx has all the keys
m_tree.build(m_objects, BoundsFunc::getBounds2); m_tree.build(m_objects, BoundsFunc::GetBounds2);
} }
template<typename RayCallback> template<typename RayCallback>

View File

@@ -29,13 +29,13 @@ template<> struct HashTrait< GameObjectModel>
template<> struct PositionTrait< GameObjectModel> template<> struct PositionTrait< GameObjectModel>
{ {
static void getPosition(const GameObjectModel& g, G3D::Vector3& p) { p = g.getPosition(); } static void GetPosition(const GameObjectModel& g, G3D::Vector3& p) { p = g.GetPosition(); }
}; };
template<> struct BoundsTrait< GameObjectModel> template<> struct BoundsTrait< GameObjectModel>
{ {
static void getBounds(const GameObjectModel& g, G3D::AABox& out) { out = g.getBounds();} static void GetBounds(const GameObjectModel& g, G3D::AABox& out) { out = g.GetBounds();}
static void getBounds2(const GameObjectModel* g, G3D::AABox& out) { out = g->getBounds();} static void GetBounds2(const GameObjectModel* g, G3D::AABox& out) { out = g->GetBounds();}
}; };
typedef RegularGrid2D<GameObjectModel, BIHWrap<GameObjectModel>> ParentTree; typedef RegularGrid2D<GameObjectModel, BIHWrap<GameObjectModel>> ParentTree;
@@ -145,7 +145,7 @@ struct DynamicTreeIntersectionCallback
bool didHit() const { return did_hit;} bool didHit() const { return did_hit;}
}; };
bool DynamicMapTree::getIntersectionTime(const uint32 phasemask, const G3D::Ray& ray, bool DynamicMapTree::GetIntersectionTime(const uint32 phasemask, const G3D::Ray& ray,
const G3D::Vector3& endPos, float& maxDist) const const G3D::Vector3& endPos, float& maxDist) const
{ {
float distance = maxDist; float distance = maxDist;
@@ -158,7 +158,7 @@ bool DynamicMapTree::getIntersectionTime(const uint32 phasemask, const G3D::Ray&
return callback.didHit(); return callback.didHit();
} }
bool DynamicMapTree::getObjectHitPos(const uint32 phasemask, const G3D::Vector3& startPos, bool DynamicMapTree::GetObjectHitPos(const uint32 phasemask, const G3D::Vector3& startPos,
const G3D::Vector3& endPos, G3D::Vector3& resultHit, const G3D::Vector3& endPos, G3D::Vector3& resultHit,
float modifyDist) const float modifyDist) const
{ {
@@ -175,7 +175,7 @@ bool DynamicMapTree::getObjectHitPos(const uint32 phasemask, const G3D::Vector3&
G3D::Vector3 dir = (endPos - startPos) / maxDist; // direction with length of 1 G3D::Vector3 dir = (endPos - startPos) / maxDist; // direction with length of 1
G3D::Ray ray(startPos, dir); G3D::Ray ray(startPos, dir);
float dist = maxDist; float dist = maxDist;
if (getIntersectionTime(phasemask, ray, endPos, dist)) if (GetIntersectionTime(phasemask, ray, endPos, dist))
{ {
resultHit = startPos + dir * dist; resultHit = startPos + dir * dist;
if (modifyDist < 0) if (modifyDist < 0)

View File

@@ -29,10 +29,10 @@ public:
[[nodiscard]] bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, [[nodiscard]] bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2,
float z2, uint32 phasemask) const; float z2, uint32 phasemask) const;
bool getIntersectionTime(uint32 phasemask, const G3D::Ray& ray, bool GetIntersectionTime(uint32 phasemask, const G3D::Ray& ray,
const G3D::Vector3& endPos, float& maxDist) const; const G3D::Vector3& endPos, float& maxDist) const;
bool getObjectHitPos(uint32 phasemask, const G3D::Vector3& pPos1, bool GetObjectHitPos(uint32 phasemask, const G3D::Vector3& pPos1,
const G3D::Vector3& pPos2, G3D::Vector3& pResultHitPos, const G3D::Vector3& pPos2, G3D::Vector3& pResultHitPos,
float pModifyDist) const; float pModifyDist) const;

View File

@@ -53,7 +53,7 @@ namespace VMAP
test if we hit an object. return true if we hit one. rx, ry, rz will hold the hit position or the dest position, if no intersection was found test if we hit an object. return true if we hit one. rx, ry, rz will hold the hit position or the dest position, if no intersection was found
return a position, that is pReduceDist closer to the origin return a position, that is pReduceDist closer to the origin
*/ */
virtual bool getObjectHitPos(unsigned int pMapId, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float& ry, float& rz, float pModifyDist) = 0; virtual bool GetObjectHitPos(unsigned int pMapId, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float& ry, float& rz, float pModifyDist) = 0;
/** /**
send debug commands send debug commands
*/ */
@@ -79,7 +79,7 @@ namespace VMAP
Query world model area info. Query world model area info.
\param z gets adjusted to the ground height for which this are info is valid \param z gets adjusted to the ground height for which this are info is valid
*/ */
virtual bool getAreaInfo(unsigned int pMapId, float x, float y, float& z, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const = 0; virtual bool GetAreaInfo(unsigned int pMapId, float x, float y, float& z, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const = 0;
virtual bool GetLiquidLevel(uint32 pMapId, float x, float y, float z, uint8 ReqLiquidType, float& level, float& floor, uint32& type) const = 0; virtual bool GetLiquidLevel(uint32 pMapId, float x, float y, float z, uint8 ReqLiquidType, float& level, float& floor, uint32& type) const = 0;
}; };
} }

View File

@@ -200,7 +200,7 @@ namespace VMAP
get the hit position and return true if we hit something get the hit position and return true if we hit something
otherwise the result pos will be the dest pos otherwise the result pos will be the dest pos
*/ */
bool VMapManager2::getObjectHitPos(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float& ry, float& rz, float modifyDist) bool VMapManager2::GetObjectHitPos(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float& ry, float& rz, float modifyDist)
{ {
#if defined(ENABLE_VMAP_CHECKS) #if defined(ENABLE_VMAP_CHECKS)
if (isLineOfSightCalcEnabled() && !IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_LOS)) if (isLineOfSightCalcEnabled() && !IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_LOS))
@@ -212,7 +212,7 @@ namespace VMAP
Vector3 pos1 = convertPositionToInternalRep(x1, y1, z1); Vector3 pos1 = convertPositionToInternalRep(x1, y1, z1);
Vector3 pos2 = convertPositionToInternalRep(x2, y2, z2); Vector3 pos2 = convertPositionToInternalRep(x2, y2, z2);
Vector3 resultPos; Vector3 resultPos;
bool result = instanceTree->second->getObjectHitPos(pos1, pos2, resultPos, modifyDist); bool result = instanceTree->second->GetObjectHitPos(pos1, pos2, resultPos, modifyDist);
resultPos = convertPositionToInternalRep(resultPos.x, resultPos.y, resultPos.z); resultPos = convertPositionToInternalRep(resultPos.x, resultPos.y, resultPos.z);
rx = resultPos.x; rx = resultPos.x;
ry = resultPos.y; ry = resultPos.y;
@@ -255,7 +255,7 @@ namespace VMAP
return VMAP_INVALID_HEIGHT_VALUE; return VMAP_INVALID_HEIGHT_VALUE;
} }
bool VMapManager2::getAreaInfo(unsigned int mapId, float x, float y, float& z, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const bool VMapManager2::GetAreaInfo(unsigned int mapId, float x, float y, float& z, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const
{ {
#if defined(ENABLE_VMAP_CHECKS) #if defined(ENABLE_VMAP_CHECKS)
if (!IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_AREAFLAG)) if (!IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_AREAFLAG))
@@ -265,7 +265,7 @@ namespace VMAP
if (instanceTree != iInstanceMapTrees.end()) if (instanceTree != iInstanceMapTrees.end())
{ {
Vector3 pos = convertPositionToInternalRep(x, y, z); Vector3 pos = convertPositionToInternalRep(x, y, z);
bool result = instanceTree->second->getAreaInfo(pos, flags, adtId, rootId, groupId); bool result = instanceTree->second->GetAreaInfo(pos, flags, adtId, rootId, groupId);
// z is not touched by convertPositionToInternalRep(), so just copy // z is not touched by convertPositionToInternalRep(), so just copy
z = pos.z; z = pos.z;
return result; return result;
@@ -353,7 +353,7 @@ namespace VMAP
return StaticMapTree::CanLoadMap(std::string(basePath), mapId, x, y); return StaticMapTree::CanLoadMap(std::string(basePath), mapId, x, y);
} }
void VMapManager2::getInstanceMapTree(InstanceTreeMap& instanceMapTree) void VMapManager2::GetInstanceMapTree(InstanceTreeMap& instanceMapTree)
{ {
instanceMapTree = iInstanceMapTrees; instanceMapTree = iInstanceMapTrees;
} }

View File

@@ -112,12 +112,12 @@ namespace VMAP
/** /**
fill the hit pos and return true, if an object was hit fill the hit pos and return true, if an object was hit
*/ */
bool getObjectHitPos(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float& ry, float& rz, float modifyDist) override; bool GetObjectHitPos(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float& ry, float& rz, float modifyDist) override;
float getHeight(unsigned int mapId, float x, float y, float z, float maxSearchDist) override; float getHeight(unsigned int mapId, float x, float y, float z, float maxSearchDist) override;
bool processCommand(char* /*command*/) override { return false; } // for debug and extensions bool processCommand(char* /*command*/) override { return false; } // for debug and extensions
bool getAreaInfo(unsigned int pMapId, float x, float y, float& z, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const override; bool GetAreaInfo(unsigned int pMapId, float x, float y, float& z, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const override;
bool GetLiquidLevel(uint32 pMapId, float x, float y, float z, uint8 reqLiquidType, float& level, float& floor, uint32& type) const override; bool GetLiquidLevel(uint32 pMapId, float x, float y, float z, uint8 reqLiquidType, float& level, float& floor, uint32& type) const override;
WorldModel* acquireModelInstance(const std::string& basepath, const std::string& filename); WorldModel* acquireModelInstance(const std::string& basepath, const std::string& filename);
@@ -129,7 +129,7 @@ namespace VMAP
return getMapFileName(mapId); return getMapFileName(mapId);
} }
bool existsMap(const char* basePath, unsigned int mapId, int x, int y) override; bool existsMap(const char* basePath, unsigned int mapId, int x, int y) override;
void getInstanceMapTree(InstanceTreeMap& instanceMapTree); void GetInstanceMapTree(InstanceTreeMap& instanceMapTree);
typedef uint32(*GetLiquidFlagsFn)(uint32 liquidType); typedef uint32(*GetLiquidFlagsFn)(uint32 liquidType);
GetLiquidFlagsFn GetLiquidFlagsPtr; GetLiquidFlagsFn GetLiquidFlagsPtr;

View File

@@ -86,7 +86,7 @@ namespace VMAP
return tilefilename.str(); return tilefilename.str();
} }
bool StaticMapTree::getAreaInfo(Vector3& pos, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const bool StaticMapTree::GetAreaInfo(Vector3& pos, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const
{ {
AreaInfoCallback intersectionCallBack(iTreeValues); AreaInfoCallback intersectionCallBack(iTreeValues);
iTree.intersectPoint(pos, intersectionCallBack); iTree.intersectPoint(pos, intersectionCallBack);
@@ -131,7 +131,7 @@ namespace VMAP
Else, pMaxDist is not modified and returns false; Else, pMaxDist is not modified and returns false;
*/ */
bool StaticMapTree::getIntersectionTime(const G3D::Ray& pRay, float& pMaxDist, bool StopAtFirstHit) const bool StaticMapTree::GetIntersectionTime(const G3D::Ray& pRay, float& pMaxDist, bool StopAtFirstHit) const
{ {
float distance = pMaxDist; float distance = pMaxDist;
MapRayCallback intersectionCallBack(iTreeValues); MapRayCallback intersectionCallBack(iTreeValues);
@@ -162,8 +162,10 @@ namespace VMAP
} }
// direction with length of 1 // direction with length of 1
G3D::Ray ray = G3D::Ray::fromOriginAndDirection(pos1, (pos2 - pos1) / maxDist); G3D::Ray ray = G3D::Ray::fromOriginAndDirection(pos1, (pos2 - pos1) / maxDist);
if (getIntersectionTime(ray, maxDist, true))
if (GetIntersectionTime(ray, maxDist, true))
{ {
return false; return false;
} }
@@ -175,7 +177,7 @@ namespace VMAP
Return the hit pos or the original dest pos Return the hit pos or the original dest pos
*/ */
bool StaticMapTree::getObjectHitPos(const Vector3& pPos1, const Vector3& pPos2, Vector3& pResultHitPos, float pModifyDist) const bool StaticMapTree::GetObjectHitPos(const Vector3& pPos1, const Vector3& pPos2, Vector3& pResultHitPos, float pModifyDist) const
{ {
bool result = false; bool result = false;
float maxDist = (pPos2 - pPos1).magnitude(); float maxDist = (pPos2 - pPos1).magnitude();
@@ -190,7 +192,7 @@ namespace VMAP
Vector3 dir = (pPos2 - pPos1) / maxDist; // direction with length of 1 Vector3 dir = (pPos2 - pPos1) / maxDist; // direction with length of 1
G3D::Ray ray(pPos1, dir); G3D::Ray ray(pPos1, dir);
float dist = maxDist; float dist = maxDist;
if (getIntersectionTime(ray, dist, false)) if (GetIntersectionTime(ray, dist, false))
{ {
pResultHitPos = pPos1 + dir * dist; pResultHitPos = pPos1 + dir * dist;
if (pModifyDist < 0) if (pModifyDist < 0)
@@ -226,7 +228,7 @@ namespace VMAP
Vector3 dir = Vector3(0, 0, -1); Vector3 dir = Vector3(0, 0, -1);
G3D::Ray ray(pPos, dir); // direction with length of 1 G3D::Ray ray(pPos, dir); // direction with length of 1
float maxDist = maxSearchDist; float maxDist = maxSearchDist;
if (getIntersectionTime(ray, maxDist, false)) if (GetIntersectionTime(ray, maxDist, false))
{ {
height = pPos.z - maxDist; height = pPos.z - maxDist;
} }
@@ -507,7 +509,7 @@ namespace VMAP
iLoadedTiles.erase(tile); iLoadedTiles.erase(tile);
} }
void StaticMapTree::getModelInstances(ModelInstance*& models, uint32& count) void StaticMapTree::GetModelInstances(ModelInstance*& models, uint32& count)
{ {
models = iTreeValues; models = iTreeValues;
count = iNTreeValues; count = iNTreeValues;

View File

@@ -45,7 +45,7 @@ namespace VMAP
std::string iBasePath; std::string iBasePath;
private: private:
bool getIntersectionTime(const G3D::Ray& pRay, float& pMaxDist, bool StopAtFirstHit) const; bool GetIntersectionTime(const G3D::Ray& pRay, float& pMaxDist, bool StopAtFirstHit) const;
//bool containsLoadedMapTile(unsigned int pTileIdent) const { return(iLoadedMapTiles.containsKey(pTileIdent)); } //bool containsLoadedMapTile(unsigned int pTileIdent) const { return(iLoadedMapTiles.containsKey(pTileIdent)); }
public: public:
static std::string getTileFileName(uint32 mapID, uint32 tileX, uint32 tileY); static std::string getTileFileName(uint32 mapID, uint32 tileX, uint32 tileY);
@@ -57,9 +57,9 @@ namespace VMAP
~StaticMapTree(); ~StaticMapTree();
[[nodiscard]] bool isInLineOfSight(const G3D::Vector3& pos1, const G3D::Vector3& pos2) const; [[nodiscard]] bool isInLineOfSight(const G3D::Vector3& pos1, const G3D::Vector3& pos2) const;
bool getObjectHitPos(const G3D::Vector3& pos1, const G3D::Vector3& pos2, G3D::Vector3& pResultHitPos, float pModifyDist) const; bool GetObjectHitPos(const G3D::Vector3& pos1, const G3D::Vector3& pos2, G3D::Vector3& pResultHitPos, float pModifyDist) const;
[[nodiscard]] float getHeight(const G3D::Vector3& pPos, float maxSearchDist) const; [[nodiscard]] float getHeight(const G3D::Vector3& pPos, float maxSearchDist) const;
bool getAreaInfo(G3D::Vector3& pos, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const; bool GetAreaInfo(G3D::Vector3& pos, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const;
bool GetLocationInfo(const G3D::Vector3& pos, LocationInfo& info) const; bool GetLocationInfo(const G3D::Vector3& pos, LocationInfo& info) const;
bool InitMap(const std::string& fname, VMapManager2* vm); bool InitMap(const std::string& fname, VMapManager2* vm);
@@ -68,7 +68,7 @@ namespace VMAP
void UnloadMapTile(uint32 tileX, uint32 tileY, VMapManager2* vm); void UnloadMapTile(uint32 tileX, uint32 tileY, VMapManager2* vm);
[[nodiscard]] bool isTiled() const { return iIsTiled; } [[nodiscard]] bool isTiled() const { return iIsTiled; }
[[nodiscard]] uint32 numLoadedTiles() const { return iLoadedTiles.size(); } [[nodiscard]] uint32 numLoadedTiles() const { return iLoadedTiles.size(); }
void getModelInstances(ModelInstance*& models, uint32& count); void GetModelInstances(ModelInstance*& models, uint32& count);
}; };
struct AreaInfo struct AreaInfo

View File

@@ -20,7 +20,7 @@ using std::pair;
template<> struct BoundsTrait<VMAP::ModelSpawn*> template<> struct BoundsTrait<VMAP::ModelSpawn*>
{ {
static void getBounds(const VMAP::ModelSpawn* const& obj, G3D::AABox& out) { out = obj->getBounds(); } static void GetBounds(const VMAP::ModelSpawn* const& obj, G3D::AABox& out) { out = obj->GetBounds(); }
}; };
namespace VMAP namespace VMAP
@@ -92,7 +92,7 @@ namespace VMAP
try try
{ {
pTree.build(mapSpawns, BoundsTrait<ModelSpawn*>::getBounds); pTree.build(mapSpawns, BoundsTrait<ModelSpawn*>::GetBounds);
} }
catch (std::exception& e) catch (std::exception& e)
{ {

View File

@@ -42,11 +42,11 @@ class GameObjectModel
public: public:
std::string name; std::string name;
[[nodiscard]] const G3D::AABox& getBounds() const { return iBound; } [[nodiscard]] const G3D::AABox& GetBounds() const { return iBound; }
~GameObjectModel(); ~GameObjectModel();
[[nodiscard]] const G3D::Vector3& getPosition() const { return iPos; } [[nodiscard]] const G3D::Vector3& GetPosition() const { return iPos; }
/** Enables\disables collision. */ /** Enables\disables collision. */
void disable() { phasemask = 0; } void disable() { phasemask = 0; }

View File

@@ -41,7 +41,7 @@ namespace VMAP
bool operator==(const ModelSpawn& other) const { return ID == other.ID; } bool operator==(const ModelSpawn& other) const { return ID == other.ID; }
//uint32 hashCode() const { return ID; } //uint32 hashCode() const { return ID; }
// temp? // temp?
[[nodiscard]] const G3D::AABox& getBounds() const { return iBound; } [[nodiscard]] const G3D::AABox& GetBounds() const { return iBound; }
static bool readFromFile(FILE* rf, ModelSpawn& spawn); static bool readFromFile(FILE* rf, ModelSpawn& spawn);
static bool writeToFile(FILE* rw, const ModelSpawn& spawn); static bool writeToFile(FILE* rw, const ModelSpawn& spawn);

View File

@@ -14,7 +14,7 @@ using G3D::Ray;
template<> struct BoundsTrait<VMAP::GroupModel> template<> struct BoundsTrait<VMAP::GroupModel>
{ {
static void getBounds(const VMAP::GroupModel& obj, G3D::AABox& out) { out = obj.GetBound(); } static void GetBounds(const VMAP::GroupModel& obj, G3D::AABox& out) { out = obj.GetBound(); }
}; };
namespace VMAP namespace VMAP
@@ -257,7 +257,7 @@ namespace VMAP
return result; return result;
} }
void WmoLiquid::getPosInfo(uint32& tilesX, uint32& tilesY, G3D::Vector3& corner) const void WmoLiquid::GetPosInfo(uint32& tilesX, uint32& tilesY, G3D::Vector3& corner) const
{ {
tilesX = iTilesX; tilesX = iTilesX;
tilesY = iTilesY; tilesY = iTilesY;
@@ -442,7 +442,7 @@ namespace VMAP
return 0; return 0;
} }
void GroupModel::getMeshData(std::vector<G3D::Vector3>& outVertices, std::vector<MeshTriangle>& outTriangles, WmoLiquid*& liquid) void GroupModel::GetMeshData(std::vector<G3D::Vector3>& outVertices, std::vector<MeshTriangle>& outTriangles, WmoLiquid*& liquid)
{ {
outVertices = vertices; outVertices = vertices;
outTriangles = triangles; outTriangles = triangles;
@@ -454,7 +454,7 @@ namespace VMAP
void WorldModel::setGroupModels(std::vector<GroupModel>& models) void WorldModel::setGroupModels(std::vector<GroupModel>& models)
{ {
groupModels.swap(models); groupModels.swap(models);
groupTree.build(groupModels, BoundsTrait<GroupModel>::getBounds, 1); groupTree.build(groupModels, BoundsTrait<GroupModel>::GetBounds, 1);
} }
struct WModelRayCallBack struct WModelRayCallBack
@@ -638,7 +638,7 @@ namespace VMAP
return result; return result;
} }
void WorldModel::getGroupModels(std::vector<GroupModel>& outGroupModels) void WorldModel::GetGroupModels(std::vector<GroupModel>& outGroupModels)
{ {
outGroupModels = groupModels; outGroupModels = groupModels;
} }

View File

@@ -45,7 +45,7 @@ namespace VMAP
uint32 GetFileSize(); uint32 GetFileSize();
bool writeToFile(FILE* wf); bool writeToFile(FILE* wf);
static bool readFromFile(FILE* rf, WmoLiquid*& liquid); static bool readFromFile(FILE* rf, WmoLiquid*& liquid);
void getPosInfo(uint32& tilesX, uint32& tilesY, G3D::Vector3& corner) const; void GetPosInfo(uint32& tilesX, uint32& tilesY, G3D::Vector3& corner) const;
private: private:
WmoLiquid() { } WmoLiquid() { }
uint32 iTilesX{0}; //!< number of tiles in x direction, each uint32 iTilesX{0}; //!< number of tiles in x direction, each
@@ -78,7 +78,7 @@ namespace VMAP
[[nodiscard]] const G3D::AABox& GetBound() const { return iBound; } [[nodiscard]] const G3D::AABox& GetBound() const { return iBound; }
[[nodiscard]] uint32 GetMogpFlags() const { return iMogpFlags; } [[nodiscard]] uint32 GetMogpFlags() const { return iMogpFlags; }
[[nodiscard]] uint32 GetWmoID() const { return iGroupWMOID; } [[nodiscard]] uint32 GetWmoID() const { return iGroupWMOID; }
void getMeshData(std::vector<G3D::Vector3>& outVertices, std::vector<MeshTriangle>& outTriangles, WmoLiquid*& liquid); void GetMeshData(std::vector<G3D::Vector3>& outVertices, std::vector<MeshTriangle>& outTriangles, WmoLiquid*& liquid);
protected: protected:
G3D::AABox iBound; G3D::AABox iBound;
uint32 iMogpFlags{0};// 0x8 outdor; 0x2000 indoor uint32 iMogpFlags{0};// 0x8 outdor; 0x2000 indoor
@@ -102,7 +102,7 @@ namespace VMAP
bool GetLocationInfo(const G3D::Vector3& p, const G3D::Vector3& down, float& dist, LocationInfo& info) const; bool GetLocationInfo(const G3D::Vector3& p, const G3D::Vector3& down, float& dist, LocationInfo& info) const;
bool writeFile(const std::string& filename); bool writeFile(const std::string& filename);
bool readFile(const std::string& filename); bool readFile(const std::string& filename);
void getGroupModels(std::vector<GroupModel>& outGroupModels); void GetGroupModels(std::vector<GroupModel>& outGroupModels);
protected: protected:
uint32 RootWMOID{0}; uint32 RootWMOID{0};
std::vector<GroupModel> groupModels; std::vector<GroupModel> groupModels;

View File

@@ -74,10 +74,10 @@ public:
void insert(const T& value) void insert(const T& value)
{ {
G3D::Vector3 pos[9]; G3D::Vector3 pos[9];
pos[0] = value.getBounds().corner(0); pos[0] = value.GetBounds().corner(0);
pos[1] = value.getBounds().corner(1); pos[1] = value.GetBounds().corner(1);
pos[2] = value.getBounds().corner(2); pos[2] = value.GetBounds().corner(2);
pos[3] = value.getBounds().corner(3); pos[3] = value.GetBounds().corner(3);
pos[4] = (pos[0] + pos[1]) / 2.0f; pos[4] = (pos[0] + pos[1]) / 2.0f;
pos[5] = (pos[1] + pos[2]) / 2.0f; pos[5] = (pos[1] + pos[2]) / 2.0f;
pos[6] = (pos[2] + pos[3]) / 2.0f; pos[6] = (pos[2] + pos[3]) / 2.0f;

View File

@@ -2076,7 +2076,7 @@ bool Map::GetAreaInfo(float x, float y, float z, uint32& flags, int32& adtId, in
{ {
float vmap_z = z; float vmap_z = z;
VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager(); VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager();
if (vmgr->getAreaInfo(GetId(), x, y, vmap_z, flags, adtId, rootId, groupId)) if (vmgr->GetAreaInfo(GetId(), x, y, vmap_z, flags, adtId, rootId, groupId))
{ {
// check if there's terrain between player height and object height // check if there's terrain between player height and object height
if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y)) if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y))
@@ -2265,13 +2265,13 @@ bool Map::isInLineOfSight(float x1, float y1, float z1, float x2, float y2, floa
return true; return true;
} }
bool Map::getObjectHitPos(uint32 phasemask, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float& ry, float& rz, float modifyDist) bool Map::GetObjectHitPos(uint32 phasemask, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float& ry, float& rz, float modifyDist)
{ {
G3D::Vector3 startPos(x1, y1, z1); G3D::Vector3 startPos(x1, y1, z1);
G3D::Vector3 dstPos(x2, y2, z2); G3D::Vector3 dstPos(x2, y2, z2);
G3D::Vector3 resultPos; G3D::Vector3 resultPos;
bool result = _dynamicTree.getObjectHitPos(phasemask, startPos, dstPos, resultPos, modifyDist); bool result = _dynamicTree.GetObjectHitPos(phasemask, startPos, dstPos, resultPos, modifyDist);
rx = resultPos.x; rx = resultPos.x;
ry = resultPos.y; ry = resultPos.y;
@@ -3701,7 +3701,7 @@ bool Map::CheckCollisionAndGetValidCoords(const WorldObject* source, float start
// Unit is not on the ground, check for potential collision via vmaps // Unit is not on the ground, check for potential collision via vmaps
if (notOnGround) if (notOnGround)
{ {
bool col = VMAP::VMapFactory::createOrGetVMapManager()->getObjectHitPos(source->GetMapId(), bool col = VMAP::VMapFactory::createOrGetVMapManager()->GetObjectHitPos(source->GetMapId(),
startX, startY, startZ + halfHeight, startX, startY, startZ + halfHeight,
destX, destY, destZ + halfHeight, destX, destY, destZ + halfHeight,
destX, destY, destZ, -CONTACT_DISTANCE); destX, destY, destZ, -CONTACT_DISTANCE);
@@ -3716,7 +3716,7 @@ bool Map::CheckCollisionAndGetValidCoords(const WorldObject* source, float start
} }
// check dynamic collision // check dynamic collision
bool col = source->GetMap()->getObjectHitPos(source->GetPhaseMask(), bool col = source->GetMap()->GetObjectHitPos(source->GetPhaseMask(),
startX, startY, startZ + halfHeight, startX, startY, startZ + halfHeight,
destX, destY, destZ + halfHeight, destX, destY, destZ + halfHeight,
destX, destY, destZ, -CONTACT_DISTANCE); destX, destY, destZ, -CONTACT_DISTANCE);

View File

@@ -499,7 +499,7 @@ public:
void InsertGameObjectModel(const GameObjectModel& model) { _dynamicTree.insert(model); } void InsertGameObjectModel(const GameObjectModel& model) { _dynamicTree.insert(model); }
[[nodiscard]] bool ContainsGameObjectModel(const GameObjectModel& model) const { return _dynamicTree.contains(model);} [[nodiscard]] bool ContainsGameObjectModel(const GameObjectModel& model) const { return _dynamicTree.contains(model);}
[[nodiscard]] DynamicMapTree const& GetDynamicMapTree() const { return _dynamicTree; } [[nodiscard]] DynamicMapTree const& GetDynamicMapTree() const { return _dynamicTree; }
bool getObjectHitPos(uint32 phasemask, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float& ry, float& rz, float modifyDist); bool GetObjectHitPos(uint32 phasemask, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float& ry, float& rz, float modifyDist);
[[nodiscard]] float GetGameObjectFloor(uint32 phasemask, float x, float y, float z, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const [[nodiscard]] float GetGameObjectFloor(uint32 phasemask, float x, float y, float z, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const
{ {
return _dynamicTree.getHeight(x, y, z, maxSearchDist, phasemask); return _dynamicTree.getHeight(x, y, z, maxSearchDist, phasemask);

View File

@@ -646,14 +646,14 @@ namespace MMAP
break; break;
InstanceTreeMap instanceTrees; InstanceTreeMap instanceTrees;
((VMapManager2*)vmapManager)->getInstanceMapTree(instanceTrees); ((VMapManager2*)vmapManager)->GetInstanceMapTree(instanceTrees);
if (!instanceTrees[mapID]) if (!instanceTrees[mapID])
break; break;
ModelInstance* models = nullptr; ModelInstance* models = nullptr;
uint32 count = 0; uint32 count = 0;
instanceTrees[mapID]->getModelInstances(models, count); instanceTrees[mapID]->GetModelInstances(models, count);
if (!models) if (!models)
break; break;
@@ -671,7 +671,7 @@ namespace MMAP
retval = true; retval = true;
std::vector<GroupModel> groupModels; std::vector<GroupModel> groupModels;
worldModel->getGroupModels(groupModels); worldModel->GetGroupModels(groupModels);
// all M2s need to have triangle indices reversed // all M2s need to have triangle indices reversed
bool isM2 = instance.name.find(".m2") != std::string::npos || instance.name.find(".M2") != std::string::npos; bool isM2 = instance.name.find(".m2") != std::string::npos || instance.name.find(".M2") != std::string::npos;
@@ -690,7 +690,7 @@ namespace MMAP
std::vector<MeshTriangle> tempTriangles; std::vector<MeshTriangle> tempTriangles;
WmoLiquid* liquid = nullptr; WmoLiquid* liquid = nullptr;
groupModel.getMeshData(tempVertices, tempTriangles, liquid); groupModel.GetMeshData(tempVertices, tempTriangles, liquid);
// first handle collision mesh // first handle collision mesh
transform(tempVertices, transformedVertices, scale, rotation, position); transform(tempVertices, transformedVertices, scale, rotation, position);
@@ -707,7 +707,7 @@ namespace MMAP
std::vector<int> liqTris; std::vector<int> liqTris;
uint32 tilesX, tilesY, vertsX, vertsY; uint32 tilesX, tilesY, vertsX, vertsY;
G3D::Vector3 corner; G3D::Vector3 corner;
liquid->getPosInfo(tilesX, tilesY, corner); liquid->GetPosInfo(tilesX, tilesY, corner);
vertsX = tilesX + 1; vertsX = tilesX + 1;
vertsY = tilesY + 1; vertsY = tilesY + 1;
uint8* flags = liquid->GetFlagsStorage(); uint8* flags = liquid->GetFlagsStorage();