Bullet Collision Detection & Physics Library
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
btGpu3DGridBroadphase Class Reference

The btGpu3DGridBroadphase uses GPU-style code compiled for CPU to compute overlapping pairs. More...

#include <btGpu3DGridBroadphase.h>

Inheritance diagram for btGpu3DGridBroadphase:
Inheritance graph
[legend]
Collaboration diagram for btGpu3DGridBroadphase:
Collaboration graph
[legend]

Public Member Functions

 btGpu3DGridBroadphase (const btVector3 &worldAabbMin, const btVector3 &worldAabbMax, int gridSizeX, int gridSizeY, int gridSizeZ, int maxSmallProxies, int maxLargeProxies, int maxPairsPerBody, int maxBodiesPerCell=8, btScalar cellFactorAABB=btScalar(1.0f))
 
 btGpu3DGridBroadphase (btOverlappingPairCache *overlappingPairCache, const btVector3 &worldAabbMin, const btVector3 &worldAabbMax, int gridSizeX, int gridSizeY, int gridSizeZ, int maxSmallProxies, int maxLargeProxies, int maxPairsPerBody, int maxBodiesPerCell=8, btScalar cellFactorAABB=btScalar(1.0f))
 
virtual ~btGpu3DGridBroadphase ()
 
virtual void calculateOverlappingPairs (btDispatcher *dispatcher)
 calculateOverlappingPairs is optional: incremental algorithms (sweep and prune) might do it during the set aabb More...
 
virtual btBroadphaseProxycreateProxy (const btVector3 &aabbMin, const btVector3 &aabbMax, int shapeType, void *userPtr, short int collisionFilterGroup, short int collisionFilterMask, btDispatcher *dispatcher, void *multiSapProxy)
 
virtual void destroyProxy (btBroadphaseProxy *proxy, btDispatcher *dispatcher)
 
virtual void rayTest (const btVector3 &rayFrom, const btVector3 &rayTo, btBroadphaseRayCallback &rayCallback, const btVector3 &aabbMin=btVector3(0, 0, 0), const btVector3 &aabbMax=btVector3(0, 0, 0))
 
virtual void resetPool (btDispatcher *dispatcher)
 reset broadphase internal structures, to ensure determinism/reproducability More...
 
- Public Member Functions inherited from btSimpleBroadphase
 btSimpleBroadphase (int maxProxies=16384, btOverlappingPairCache *overlappingPairCache=0)
 
virtual ~btSimpleBroadphase ()
 
virtual void setAabb (btBroadphaseProxy *proxy, const btVector3 &aabbMin, const btVector3 &aabbMax, btDispatcher *dispatcher)
 
virtual void getAabb (btBroadphaseProxy *proxy, btVector3 &aabbMin, btVector3 &aabbMax) const
 
virtual void aabbTest (const btVector3 &aabbMin, const btVector3 &aabbMax, btBroadphaseAabbCallback &callback)
 
btOverlappingPairCachegetOverlappingPairCache ()
 
const btOverlappingPairCachegetOverlappingPairCache () const
 
bool testAabbOverlap (btBroadphaseProxy *proxy0, btBroadphaseProxy *proxy1)
 
virtual void getBroadphaseAabb (btVector3 &aabbMin, btVector3 &aabbMax) const
 getAabb returns the axis aligned bounding box in the 'global' coordinate frame will add some transform later More...
 
virtual void printStats ()
 
- Public Member Functions inherited from btBroadphaseInterface
virtual ~btBroadphaseInterface ()
 

Protected Member Functions

int allocLargeHandle ()
 
void freeLargeHandle (btSimpleBroadphaseProxy *proxy)
 
bool isLargeProxy (const btVector3 &aabbMin, const btVector3 &aabbMax)
 
bool isLargeProxy (btBroadphaseProxy *proxy)
 
void _initialize (const btVector3 &worldAabbMin, const btVector3 &worldAabbMax, int gridSizeX, int gridSizeY, int gridSizeZ, int maxSmallProxies, int maxLargeProxies, int maxPairsPerBody, int maxBodiesPerCell=8, btScalar cellFactorAABB=btScalar(1.0f))
 
void _finalize ()
 
void addPairsToCache (btDispatcher *dispatcher)
 
void addLarge2LargePairsToCache (btDispatcher *dispatcher)
 
virtual void setParameters (bt3DGridBroadphaseParams *hostParams)
 
virtual void prepareAABB ()
 
virtual void calcHashAABB ()
 
virtual void sortHash ()
 
virtual void findCellStart ()
 
virtual void findOverlappingPairs ()
 
virtual void findPairsLarge ()
 
virtual void computePairCacheChanges ()
 
virtual void scanOverlappingPairBuff ()
 
virtual void squeezeOverlappingPairBuff ()
 
- Protected Member Functions inherited from btSimpleBroadphase
int allocHandle ()
 
void freeHandle (btSimpleBroadphaseProxy *proxy)
 
btSimpleBroadphaseProxygetSimpleProxyFromProxy (btBroadphaseProxy *proxy)
 
const btSimpleBroadphaseProxygetSimpleProxyFromProxy (btBroadphaseProxy *proxy) const
 
void validate ()
 

Protected Attributes

bool m_bInitialized
 
unsigned int m_numBodies
 
unsigned int m_numCells
 
unsigned int m_maxPairsPerBody
 
btScalar m_cellFactorAABB
 
unsigned int m_maxBodiesPerCell
 
bt3DGridBroadphaseParams m_params
 
btScalar m_maxRadius
 
unsigned int * m_hBodiesHash
 
unsigned int * m_hCellStart
 
unsigned int * m_hPairBuffStartCurr
 
bt3DGrid3F1Um_hAABB
 
unsigned int * m_hPairBuff
 
unsigned int * m_hPairScan
 
unsigned int * m_hPairOut
 
int m_numLargeHandles
 
int m_maxLargeHandles
 
int m_LastLargeHandleIndex
 
btSimpleBroadphaseProxym_pLargeHandles
 
void * m_pLargeHandlesRawPtr
 
int m_firstFreeLargeHandle
 
unsigned int m_numPairsAdded
 
unsigned int m_numPairsRemoved
 
unsigned int m_numOverflows
 
- Protected Attributes inherited from btSimpleBroadphase
int m_numHandles
 
int m_maxHandles
 
int m_LastHandleIndex
 
btSimpleBroadphaseProxym_pHandles
 
void * m_pHandlesRawPtr
 
int m_firstFreeHandle
 
btOverlappingPairCachem_pairCache
 
bool m_ownsPairCache
 
int m_invalidPair
 

Additional Inherited Members

- Static Public Member Functions inherited from btSimpleBroadphase
static bool aabbOverlap (btSimpleBroadphaseProxy *proxy0, btSimpleBroadphaseProxy *proxy1)
 

Detailed Description

The btGpu3DGridBroadphase uses GPU-style code compiled for CPU to compute overlapping pairs.

Definition at line 31 of file btGpu3DGridBroadphase.h.

Constructor & Destructor Documentation

btGpu3DGridBroadphase::btGpu3DGridBroadphase ( const btVector3 worldAabbMin,
const btVector3 worldAabbMax,
int  gridSizeX,
int  gridSizeY,
int  gridSizeZ,
int  maxSmallProxies,
int  maxLargeProxies,
int  maxPairsPerBody,
int  maxBodiesPerCell = 8,
btScalar  cellFactorAABB = btScalar(1.0f) 
)

Definition at line 46 of file btGpu3DGridBroadphase.cpp.

btGpu3DGridBroadphase::btGpu3DGridBroadphase ( btOverlappingPairCache overlappingPairCache,
const btVector3 worldAabbMin,
const btVector3 worldAabbMax,
int  gridSizeX,
int  gridSizeY,
int  gridSizeZ,
int  maxSmallProxies,
int  maxLargeProxies,
int  maxPairsPerBody,
int  maxBodiesPerCell = 8,
btScalar  cellFactorAABB = btScalar(1.0f) 
)

Definition at line 64 of file btGpu3DGridBroadphase.cpp.

btGpu3DGridBroadphase::~btGpu3DGridBroadphase ( )
virtual

Definition at line 81 of file btGpu3DGridBroadphase.cpp.

Member Function Documentation

void btGpu3DGridBroadphase::_finalize ( )
protected

Definition at line 176 of file btGpu3DGridBroadphase.cpp.

void btGpu3DGridBroadphase::_initialize ( const btVector3 worldAabbMin,
const btVector3 worldAabbMax,
int  gridSizeX,
int  gridSizeY,
int  gridSizeZ,
int  maxSmallProxies,
int  maxLargeProxies,
int  maxPairsPerBody,
int  maxBodiesPerCell = 8,
btScalar  cellFactorAABB = btScalar(1.0f) 
)
protected

Definition at line 90 of file btGpu3DGridBroadphase.cpp.

void btGpu3DGridBroadphase::addLarge2LargePairsToCache ( btDispatcher dispatcher)
protected

Definition at line 348 of file btGpu3DGridBroadphase.cpp.

void btGpu3DGridBroadphase::addPairsToCache ( btDispatcher dispatcher)
protected

Definition at line 226 of file btGpu3DGridBroadphase.cpp.

int btGpu3DGridBroadphase::allocLargeHandle ( )
inlineprotected

Definition at line 57 of file btGpu3DGridBroadphase.h.

void btGpu3DGridBroadphase::calcHashAABB ( )
protectedvirtual

Definition at line 485 of file btGpu3DGridBroadphase.cpp.

void btGpu3DGridBroadphase::calculateOverlappingPairs ( btDispatcher dispatcher)
virtual

calculateOverlappingPairs is optional: incremental algorithms (sweep and prune) might do it during the set aabb

if you don't like to skip the invalid pairs in the array, execute following code:

Reimplemented from btSimpleBroadphase.

Definition at line 192 of file btGpu3DGridBroadphase.cpp.

void btGpu3DGridBroadphase::computePairCacheChanges ( )
protectedvirtual

Definition at line 556 of file btGpu3DGridBroadphase.cpp.

btBroadphaseProxy * btGpu3DGridBroadphase::createProxy ( const btVector3 aabbMin,
const btVector3 aabbMax,
int  shapeType,
void *  userPtr,
short int  collisionFilterGroup,
short int  collisionFilterMask,
btDispatcher dispatcher,
void *  multiSapProxy 
)
virtual

you have to increase the cell size, so 'large' proxies become 'small' proxies (fitting a cell)

Reimplemented from btSimpleBroadphase.

Definition at line 271 of file btGpu3DGridBroadphase.cpp.

void btGpu3DGridBroadphase::destroyProxy ( btBroadphaseProxy proxy,
btDispatcher dispatcher 
)
virtual

Reimplemented from btSimpleBroadphase.

Definition at line 296 of file btGpu3DGridBroadphase.cpp.

void btGpu3DGridBroadphase::findCellStart ( )
protectedvirtual

Definition at line 529 of file btGpu3DGridBroadphase.cpp.

void btGpu3DGridBroadphase::findOverlappingPairs ( )
protectedvirtual

Definition at line 538 of file btGpu3DGridBroadphase.cpp.

void btGpu3DGridBroadphase::findPairsLarge ( )
protectedvirtual

Definition at line 547 of file btGpu3DGridBroadphase.cpp.

void btGpu3DGridBroadphase::freeLargeHandle ( btSimpleBroadphaseProxy proxy)
inlineprotected

Definition at line 69 of file btGpu3DGridBroadphase.h.

bool btGpu3DGridBroadphase::isLargeProxy ( const btVector3 aabbMin,
const btVector3 aabbMax 
)
protected

use the bounding sphere radius of this bounding box, to include rotation

Definition at line 328 of file btGpu3DGridBroadphase.cpp.

bool btGpu3DGridBroadphase::isLargeProxy ( btBroadphaseProxy proxy)
protected

Definition at line 341 of file btGpu3DGridBroadphase.cpp.

void btGpu3DGridBroadphase::prepareAABB ( )
protectedvirtual

Definition at line 418 of file btGpu3DGridBroadphase.cpp.

void btGpu3DGridBroadphase::rayTest ( const btVector3 rayFrom,
const btVector3 rayTo,
btBroadphaseRayCallback rayCallback,
const btVector3 aabbMin = btVector3(0,0,0),
const btVector3 aabbMax = btVector3(0,0,0) 
)
virtual

Reimplemented from btSimpleBroadphase.

Definition at line 396 of file btGpu3DGridBroadphase.cpp.

void btGpu3DGridBroadphase::resetPool ( btDispatcher dispatcher)
virtual

reset broadphase internal structures, to ensure determinism/reproducability

Reimplemented from btSimpleBroadphase.

Definition at line 315 of file btGpu3DGridBroadphase.cpp.

void btGpu3DGridBroadphase::scanOverlappingPairBuff ( )
protectedvirtual

Definition at line 565 of file btGpu3DGridBroadphase.cpp.

void btGpu3DGridBroadphase::setParameters ( bt3DGridBroadphaseParams hostParams)
protectedvirtual

Definition at line 477 of file btGpu3DGridBroadphase.cpp.

void btGpu3DGridBroadphase::sortHash ( )
protectedvirtual

Definition at line 494 of file btGpu3DGridBroadphase.cpp.

void btGpu3DGridBroadphase::squeezeOverlappingPairBuff ( )
protectedvirtual

Definition at line 579 of file btGpu3DGridBroadphase.cpp.

Member Data Documentation

bool btGpu3DGridBroadphase::m_bInitialized
protected

Definition at line 34 of file btGpu3DGridBroadphase.h.

btScalar btGpu3DGridBroadphase::m_cellFactorAABB
protected

Definition at line 38 of file btGpu3DGridBroadphase.h.

int btGpu3DGridBroadphase::m_firstFreeLargeHandle
protected

Definition at line 56 of file btGpu3DGridBroadphase.h.

bt3DGrid3F1U* btGpu3DGridBroadphase::m_hAABB
protected

Definition at line 46 of file btGpu3DGridBroadphase.h.

unsigned int* btGpu3DGridBroadphase::m_hBodiesHash
protected

Definition at line 43 of file btGpu3DGridBroadphase.h.

unsigned int* btGpu3DGridBroadphase::m_hCellStart
protected

Definition at line 44 of file btGpu3DGridBroadphase.h.

unsigned int* btGpu3DGridBroadphase::m_hPairBuff
protected

Definition at line 47 of file btGpu3DGridBroadphase.h.

unsigned int* btGpu3DGridBroadphase::m_hPairBuffStartCurr
protected

Definition at line 45 of file btGpu3DGridBroadphase.h.

unsigned int* btGpu3DGridBroadphase::m_hPairOut
protected

Definition at line 49 of file btGpu3DGridBroadphase.h.

unsigned int* btGpu3DGridBroadphase::m_hPairScan
protected

Definition at line 48 of file btGpu3DGridBroadphase.h.

int btGpu3DGridBroadphase::m_LastLargeHandleIndex
protected

Definition at line 53 of file btGpu3DGridBroadphase.h.

unsigned int btGpu3DGridBroadphase::m_maxBodiesPerCell
protected

Definition at line 39 of file btGpu3DGridBroadphase.h.

int btGpu3DGridBroadphase::m_maxLargeHandles
protected

Definition at line 52 of file btGpu3DGridBroadphase.h.

unsigned int btGpu3DGridBroadphase::m_maxPairsPerBody
protected

Definition at line 37 of file btGpu3DGridBroadphase.h.

btScalar btGpu3DGridBroadphase::m_maxRadius
protected

Definition at line 41 of file btGpu3DGridBroadphase.h.

unsigned int btGpu3DGridBroadphase::m_numBodies
protected

Definition at line 35 of file btGpu3DGridBroadphase.h.

unsigned int btGpu3DGridBroadphase::m_numCells
protected

Definition at line 36 of file btGpu3DGridBroadphase.h.

int btGpu3DGridBroadphase::m_numLargeHandles
protected

Definition at line 51 of file btGpu3DGridBroadphase.h.

unsigned int btGpu3DGridBroadphase::m_numOverflows
protected

Definition at line 87 of file btGpu3DGridBroadphase.h.

unsigned int btGpu3DGridBroadphase::m_numPairsAdded
protected

Definition at line 85 of file btGpu3DGridBroadphase.h.

unsigned int btGpu3DGridBroadphase::m_numPairsRemoved
protected

Definition at line 86 of file btGpu3DGridBroadphase.h.

bt3DGridBroadphaseParams btGpu3DGridBroadphase::m_params
protected

Definition at line 40 of file btGpu3DGridBroadphase.h.

btSimpleBroadphaseProxy* btGpu3DGridBroadphase::m_pLargeHandles
protected

Definition at line 54 of file btGpu3DGridBroadphase.h.

void* btGpu3DGridBroadphase::m_pLargeHandlesRawPtr
protected

Definition at line 55 of file btGpu3DGridBroadphase.h.


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