Core/Collision: Ported dynamic line of sight patch by Silverice from MaNGOS and
added lots of improvements Please re-extract vmaps
This commit is contained in:
@@ -81,13 +81,25 @@ struct AABound
|
||||
|
||||
class BIH
|
||||
{
|
||||
public:
|
||||
BIH() {};
|
||||
template< class T, class BoundsFunc >
|
||||
void build(const std::vector<T> &primitives, BoundsFunc &getBounds, uint32 leafSize = 3, bool printStats=false)
|
||||
private:
|
||||
void init_empty()
|
||||
{
|
||||
if (primitives.empty())
|
||||
tree.clear();
|
||||
objects.clear();
|
||||
// create space for the first node
|
||||
tree.push_back(3 << 30); // dummy leaf
|
||||
tree.insert(tree.end(), 2, 0);
|
||||
}
|
||||
public:
|
||||
BIH() { init_empty(); }
|
||||
template< class BoundsFunc, class PrimArray >
|
||||
void build(const PrimArray &primitives, BoundsFunc &getBounds, uint32 leafSize = 3, bool printStats=false)
|
||||
{
|
||||
if (primitives.size() == 0)
|
||||
{
|
||||
init_empty();
|
||||
return;
|
||||
}
|
||||
|
||||
buildData dat;
|
||||
dat.maxPrims = leafSize;
|
||||
@@ -397,4 +409,4 @@ class BIH
|
||||
void subdivide(int left, int right, std::vector<uint32> &tempTree, buildData &dat, AABound &gridBox, AABound &nodeBox, int nodeIndex, int depth, BuildStats &stats);
|
||||
};
|
||||
|
||||
#endif // _BIH_H
|
||||
#endif // _BIH_H
|
||||
Reference in New Issue
Block a user