diff options
| author | Subv <s.v.h21@hotmail.com> | 2012-02-09 11:17:05 -0800 | 
|---|---|---|
| committer | Subv <s.v.h21@hotmail.com> | 2012-02-09 11:17:05 -0800 | 
| commit | 9791bb599ae85f26e1b5535e916263b0e97a0446 (patch) | |
| tree | 628f8ed69c9b9b3d63dd1991712ff6af2a364388 /src/server/collision/BoundingIntervalHierarchy.h | |
| parent | 4623db0abe917ed7099873456125b906e017ad4b (diff) | |
| parent | 93d199f04382fe3c7f6f08f59fd2ad058568679a (diff) | |
Merge pull request #5160 from TrinityCore/dynamic_vmaps
Added Dynamic Vmaps, RE-EXTRACT YOUR VMAPS
Diffstat (limited to 'src/server/collision/BoundingIntervalHierarchy.h')
| -rwxr-xr-x | src/server/collision/BoundingIntervalHierarchy.h | 22 | 
1 files changed, 17 insertions, 5 deletions
diff --git a/src/server/collision/BoundingIntervalHierarchy.h b/src/server/collision/BoundingIntervalHierarchy.h index b0c35237a9d..ea70fc3e322 100755 --- a/src/server/collision/BoundingIntervalHierarchy.h +++ b/src/server/collision/BoundingIntervalHierarchy.h @@ -81,13 +81,25 @@ struct AABound  class BIH  { +    private: +        void init_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() {}; -        template< class T, class BoundsFunc > -        void build(const std::vector<T> &primitives, BoundsFunc &getBounds, uint32 leafSize = 3, bool printStats=false) +        BIH() { init_empty(); } +        template< class BoundsFunc, class PrimArray > +        void build(const PrimArray &primitives, BoundsFunc &getBounds, uint32 leafSize = 3, bool printStats=false)          { -            if (primitives.empty()) +            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
\ No newline at end of file  | 
