RavEngine
Loading...
Searching...
No Matches
physx::Gu::NodeAllocator Class Reference

#include <GuAABBTree.h>

Inheritance diagram for physx::Gu::NodeAllocator:
[legend]
Collaboration diagram for physx::Gu::NodeAllocator:
[legend]

Classes

struct  Slab
 

Public Member Functions

void release ()
 
void init (PxU32 nbPrimitives, PxU32 limit)
 
AABBTreeBuildNode * getBiNode ()
 
- Public Member Functions inherited from physx::PxUserAllocated
PX_INLINE void * operator new (size_t, void *address)
 
PX_INLINE void operator delete (void *, void *)
 
template<typename Alloc >
PX_INLINE void * operator new (size_t size, Alloc alloc, const char *fileName, int line)
 
template<typename Alloc >
PX_INLINE void * operator new (size_t size, size_t, Alloc alloc, const char *fileName, int line)
 
template<typename Alloc >
PX_INLINE void * operator new[] (size_t size, Alloc alloc, const char *fileName, int line)
 
template<typename Alloc >
PX_INLINE void * operator new[] (size_t size, size_t, Alloc alloc, const char *fileName, int line)
 
template<typename Alloc >
PX_INLINE void operator delete (void *ptr, Alloc alloc, const char *fileName, int line)
 
template<typename Alloc >
PX_INLINE void operator delete[] (void *ptr, Alloc alloc, const char *fileName, int line)
 
PX_INLINE void operator delete (void *ptr)
 
PX_INLINE void operator delete[] (void *ptr)
 

Public Attributes

AABBTreeBuildNode * mPool
 
PxArray< Slab > mSlabs
 
PxU32 mCurrentSlabIndex
 
PxU32 mTotalNbNodes
 

Detailed Description

For complete trees we can predict the final number of nodes and preallocate them. For incomplete trees we can't. But we don't want to allocate nodes one by one (which would be quite slow), so we use this helper class to allocate N nodes at once, while minimizing the amount of nodes allocated for nothing. An initial amount of nodes is estimated using the max number for a complete tree, and the user-defined number of primitives per leaf. In ideal cases this estimated number will be quite close to the final number of nodes. When that number is not enough though, slabs of N=1024 extra nodes are allocated until the build is complete.


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