TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
BIHWrap< T, BoundsFunc > Class Template Reference

#include <BoundingIntervalHierarchyWrapper.h>

Classes

struct  MDLCallback
 

Public Member Functions

 BIHWrap ()
 
void insert (const T &obj)
 
void remove (const T &obj)
 
void balance ()
 
template<typename RayCallback >
void intersectRay (const G3D::Ray &ray, RayCallback &intersectCallback, float &maxDist)
 
template<typename IsectCallback >
void intersectPoint (const G3D::Vector3 &point, IsectCallback &intersectCallback)
 

Private Types

typedef G3D::Array< const T * > ObjArray
 

Private Attributes

BIH m_tree
 
ObjArray m_objects
 
G3D::Table< const T *, uint32m_obj2Idx
 
G3D::Set< const T * > m_objects_to_push
 
int unbalanced_times
 

Member Typedef Documentation

template<class T , class BoundsFunc = BoundsTrait<T>>
typedef G3D::Array<const T*> BIHWrap< T, BoundsFunc >::ObjArray
private

Constructor & Destructor Documentation

template<class T , class BoundsFunc = BoundsTrait<T>>
BIHWrap< T, BoundsFunc >::BIHWrap ( )
inline
69 : unbalanced_times(0) { }
int unbalanced_times
Definition: BoundingIntervalHierarchyWrapper.h:66

Member Function Documentation

template<class T , class BoundsFunc = BoundsTrait<T>>
void BIHWrap< T, BoundsFunc >::balance ( )
inline
89  {
90  if (unbalanced_times == 0)
91  return;
92 
93  unbalanced_times = 0;
97  //assert that m_obj2Idx has all the keys
98 
99  m_tree.build(m_objects, BoundsFunc::getBounds2);
100  }
ObjArray m_objects
Definition: BoundingIntervalHierarchyWrapper.h:63
void fastClear()
Definition: Array.h:419
int unbalanced_times
Definition: BoundingIntervalHierarchyWrapper.h:66
G3D::Set< const T * > m_objects_to_push
Definition: BoundingIntervalHierarchyWrapper.h:65
BIH m_tree
Definition: BoundingIntervalHierarchyWrapper.h:62
G3D::Table< const T *, uint32 > m_obj2Idx
Definition: BoundingIntervalHierarchyWrapper.h:64
Array< Key > getKeys() const
Definition: Table.h:907
Array< T > getMembers() const
Definition: Set.h:93
void build(const PrimArray &primitives, BoundsFunc &getBounds, uint32 leafSize=3, bool printStats=false)
Definition: BoundingIntervalHierarchy.h:84

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<class T , class BoundsFunc = BoundsTrait<T>>
void BIHWrap< T, BoundsFunc >::insert ( const T &  obj)
inline
72  {
75  }
int unbalanced_times
Definition: BoundingIntervalHierarchyWrapper.h:66
G3D::Set< const T * > m_objects_to_push
Definition: BoundingIntervalHierarchyWrapper.h:65
bool insert(const T &member)
Definition: Set.h:62

+ Here is the call graph for this function:

template<class T , class BoundsFunc = BoundsTrait<T>>
template<typename IsectCallback >
void BIHWrap< T, BoundsFunc >::intersectPoint ( const G3D::Vector3 point,
IsectCallback &  intersectCallback 
)
inline
112  {
113  balance();
114  MDLCallback<IsectCallback> callback(intersectCallback, m_objects.getCArray(), m_objects.size());
115  m_tree.intersectPoint(point, callback);
116  }
ObjArray m_objects
Definition: BoundingIntervalHierarchyWrapper.h:63
T * getCArray()
Definition: Array.h:256
BIH m_tree
Definition: BoundingIntervalHierarchyWrapper.h:62
int size() const
Definition: Array.h:430
void intersectPoint(const G3D::Vector3 &p, IsectCallback &intersectCallback) const
Definition: BoundingIntervalHierarchy.h:260
void balance()
Definition: BoundingIntervalHierarchyWrapper.h:88

+ Here is the call graph for this function:

template<class T , class BoundsFunc = BoundsTrait<T>>
template<typename RayCallback >
void BIHWrap< T, BoundsFunc >::intersectRay ( const G3D::Ray ray,
RayCallback &  intersectCallback,
float &  maxDist 
)
inline
104  {
105  balance();
106  MDLCallback<RayCallback> temp_cb(intersectCallback, m_objects.getCArray(), m_objects.size());
107  m_tree.intersectRay(ray, temp_cb, maxDist, true);
108  }
ObjArray m_objects
Definition: BoundingIntervalHierarchyWrapper.h:63
T * getCArray()
Definition: Array.h:256
BIH m_tree
Definition: BoundingIntervalHierarchyWrapper.h:62
int size() const
Definition: Array.h:430
void balance()
Definition: BoundingIntervalHierarchyWrapper.h:88
void intersectRay(const G3D::Ray &r, RayCallback &intersectCallback, float &maxDist, bool stopAtFirst=false) const
Definition: BoundingIntervalHierarchy.h:121

+ Here is the call graph for this function:

template<class T , class BoundsFunc = BoundsTrait<T>>
void BIHWrap< T, BoundsFunc >::remove ( const T &  obj)
inline
78  {
80  uint32 Idx = 0;
81  const T * temp;
82  if (m_obj2Idx.getRemove(&obj, temp, Idx))
83  m_objects[Idx] = NULL;
84  else
86  }
ObjArray m_objects
Definition: BoundingIntervalHierarchyWrapper.h:63
bool remove(const T &member)
Definition: Set.h:72
bool getRemove(const Key &key, Key &removedKey, Value &removedValue)
Definition: Table.h:660
int unbalanced_times
Definition: BoundingIntervalHierarchyWrapper.h:66
arena_t NULL
Definition: jemalloc_internal.h:624
G3D::Set< const T * > m_objects_to_push
Definition: BoundingIntervalHierarchyWrapper.h:65
uint32_t uint32
Definition: Define.h:150
G3D::Table< const T *, uint32 > m_obj2Idx
Definition: BoundingIntervalHierarchyWrapper.h:64

+ Here is the call graph for this function:

Member Data Documentation

template<class T , class BoundsFunc = BoundsTrait<T>>
G3D::Table<const T*, uint32> BIHWrap< T, BoundsFunc >::m_obj2Idx
private
template<class T , class BoundsFunc = BoundsTrait<T>>
ObjArray BIHWrap< T, BoundsFunc >::m_objects
private
template<class T , class BoundsFunc = BoundsTrait<T>>
G3D::Set<const T*> BIHWrap< T, BoundsFunc >::m_objects_to_push
private
template<class T , class BoundsFunc = BoundsTrait<T>>
BIH BIHWrap< T, BoundsFunc >::m_tree
private
template<class T , class BoundsFunc = BoundsTrait<T>>
int BIHWrap< T, BoundsFunc >::unbalanced_times
private

The documentation for this class was generated from the following file: