mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Vmaps: Remove unused template argument from RegularGrid2D
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "BoundingIntervalHierarchy.h"
|
||||
#include <stdexcept>
|
||||
|
||||
void BIH::buildHierarchy(std::vector<uint32>& tempTree, buildData& dat, BuildStats& stats) const
|
||||
{
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
#include <G3D/Ray.h>
|
||||
#include <G3D/Vector3.h>
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
|
||||
#define MAX_STACK_SIZE 64
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "IteratorPair.h"
|
||||
#include <G3D/Ray.h>
|
||||
#include <G3D/BoundsTrait.h>
|
||||
#include <G3D/PositionTrait.h>
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
@@ -34,8 +33,7 @@ struct NodeCreator{
|
||||
template<class T,
|
||||
class Node,
|
||||
class NodeCreatorFunc = NodeCreator<Node>,
|
||||
class BoundsFunc = BoundsTrait<T>,
|
||||
class PositionFunc = PositionTrait<T>
|
||||
class BoundsFunc = BoundsTrait<T>
|
||||
>
|
||||
class TC_COMMON_API RegularGrid2D
|
||||
{
|
||||
@@ -45,15 +43,14 @@ public:
|
||||
CELL_NUMBER = 64,
|
||||
};
|
||||
|
||||
#define HGRID_MAP_SIZE (533.33333f * 64.f) // shouldn't be changed
|
||||
#define CELL_SIZE float(HGRID_MAP_SIZE/(float)CELL_NUMBER)
|
||||
#define CELL_SIZE 533.33333f
|
||||
|
||||
typedef std::unordered_multimap<const T*, Node*> MemberTable;
|
||||
typedef std::unordered_multimap<T const*, Node*> MemberTable;
|
||||
|
||||
MemberTable memberTable;
|
||||
std::unique_ptr<Node> nodes[CELL_NUMBER][CELL_NUMBER] = { };
|
||||
|
||||
void insert(const T& value)
|
||||
void insert(T const& value)
|
||||
{
|
||||
G3D::AABox bounds = G3D::AABox::empty();
|
||||
BoundsFunc::getBounds(value, bounds);
|
||||
@@ -70,7 +67,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void remove(const T& value)
|
||||
void remove(T const& value)
|
||||
{
|
||||
for (auto& p : Trinity::Containers::MapEqualRange(memberTable, &value))
|
||||
p.second->remove(value);
|
||||
@@ -86,21 +83,18 @@ public:
|
||||
n->balance();
|
||||
}
|
||||
|
||||
bool contains(const T& value) const { return memberTable.count(&value) > 0; }
|
||||
bool contains(T const& value) const { return memberTable.contains(&value); }
|
||||
bool empty() const { return memberTable.empty(); }
|
||||
|
||||
struct Cell
|
||||
{
|
||||
int x, y;
|
||||
bool operator==(Cell const& c2) const
|
||||
{
|
||||
return x == c2.x && y == c2.y;
|
||||
}
|
||||
|
||||
friend bool operator==(Cell const&, Cell const&) = default;
|
||||
|
||||
static Cell ComputeCell(float fx, float fy)
|
||||
{
|
||||
Cell c = { int(fx * (1.f / CELL_SIZE) + (CELL_NUMBER / 2)), int(fy * (1.f / CELL_SIZE) + (CELL_NUMBER / 2)) };
|
||||
return c;
|
||||
return { .x = int(fx * (1.f / CELL_SIZE) + (CELL_NUMBER / 2)), .y = int(fy * (1.f / CELL_SIZE) + (CELL_NUMBER / 2)) };
|
||||
}
|
||||
|
||||
bool isValid() const { return x >= 0 && x < CELL_NUMBER && y >= 0 && y < CELL_NUMBER; }
|
||||
@@ -115,13 +109,13 @@ public:
|
||||
}
|
||||
|
||||
template<typename RayCallback>
|
||||
void intersectRay(const G3D::Ray& ray, RayCallback& intersectCallback, float max_dist)
|
||||
void intersectRay(G3D::Ray const& ray, RayCallback& intersectCallback, float max_dist)
|
||||
{
|
||||
intersectRay(ray, intersectCallback, max_dist, ray.origin() + ray.direction() * max_dist);
|
||||
}
|
||||
|
||||
template<typename RayCallback>
|
||||
void intersectRay(const G3D::Ray& ray, RayCallback& intersectCallback, float& max_dist, const G3D::Vector3& end)
|
||||
void intersectRay(G3D::Ray const& ray, RayCallback& intersectCallback, float& max_dist, G3D::Vector3 const& end)
|
||||
{
|
||||
Cell cell = Cell::ComputeCell(ray.origin().x, ray.origin().y);
|
||||
if (!cell.isValid())
|
||||
@@ -197,7 +191,7 @@ public:
|
||||
}
|
||||
|
||||
template<typename IsectCallback>
|
||||
void intersectPoint(const G3D::Vector3& point, IsectCallback& intersectCallback)
|
||||
void intersectPoint(G3D::Vector3 const& point, IsectCallback& intersectCallback)
|
||||
{
|
||||
Cell cell = Cell::ComputeCell(point.x, point.y);
|
||||
if (!cell.isValid())
|
||||
@@ -208,7 +202,7 @@ public:
|
||||
|
||||
// Optimized verson of intersectRay function for rays with vertical directions
|
||||
template<typename RayCallback>
|
||||
void intersectZAllignedRay(const G3D::Ray& ray, RayCallback& intersectCallback, float& max_dist)
|
||||
void intersectZAllignedRay(G3D::Ray const& ray, RayCallback& intersectCallback, float& max_dist)
|
||||
{
|
||||
Cell cell = Cell::ComputeCell(ray.origin().x, ray.origin().y);
|
||||
if (!cell.isValid())
|
||||
@@ -219,6 +213,5 @@ public:
|
||||
};
|
||||
|
||||
#undef CELL_SIZE
|
||||
#undef HGRID_MAP_SIZE
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user