allow multiple concave meshes, each with their own bvh
This commit is contained in:
18
opencl/gpu_narrowphase/host/b3BvhInfo.h
Normal file
18
opencl/gpu_narrowphase/host/b3BvhInfo.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef B3_BVH_INFO_H
|
||||
#define B3_BVH_INFO_H
|
||||
|
||||
#include "Bullet3Common/b3Vector3.h"
|
||||
|
||||
struct b3BvhInfo
|
||||
{
|
||||
b3Vector3 m_aabbMin;
|
||||
b3Vector3 m_aabbMax;
|
||||
b3Vector3 m_quantization;
|
||||
int m_numNodes;
|
||||
int m_numSubTrees;
|
||||
int m_nodeOffset;
|
||||
int m_subTreeOffset;
|
||||
|
||||
};
|
||||
|
||||
#endif //B3_BVH_INFO_H
|
||||
@@ -16,7 +16,10 @@ enum btShapeTypes
|
||||
|
||||
struct b3Collidable
|
||||
{
|
||||
int m_numChildShapes;
|
||||
union {
|
||||
int m_numChildShapes;
|
||||
int m_bvhIndex;
|
||||
};
|
||||
float m_radius;
|
||||
int m_shapeType;
|
||||
int m_shapeIndex;
|
||||
|
||||
@@ -38,6 +38,7 @@ typedef b3AlignedObjectArray<b3Vector3> btVertexArray;
|
||||
#include "../kernels/bvhTraversal.h"
|
||||
#include "../kernels/primitiveContacts.h"
|
||||
|
||||
|
||||
#include "Bullet3Geometry/b3AabbUtil.h"
|
||||
|
||||
|
||||
@@ -853,6 +854,8 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( const btOpenCLArray<btI
|
||||
b3AlignedObjectArray<class b3OptimizedBvh*>& bvhData,
|
||||
btOpenCLArray<btQuantizedBvhNode>* treeNodesGPU,
|
||||
btOpenCLArray<btBvhSubtreeInfo>* subTreesGPU,
|
||||
btOpenCLArray<b3BvhInfo>* bvhInfo,
|
||||
|
||||
int numObjects,
|
||||
int maxTriConvexPairCapacity,
|
||||
btOpenCLArray<btInt4>& triangleConvexPairsOut,
|
||||
@@ -1077,13 +1080,11 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( const btOpenCLArray<btI
|
||||
//now perform the tree query on GPU
|
||||
{
|
||||
|
||||
int numNodes = bvhData.size()? bvhData[0]->getQuantizedNodeArray().size() : 0;
|
||||
if (numNodes)
|
||||
|
||||
|
||||
{
|
||||
int numSubTrees = subTreesGPU->size();
|
||||
b3Vector3 bvhAabbMin = bvhData[0]->m_bvhAabbMin;
|
||||
b3Vector3 bvhAabbMax = bvhData[0]->m_bvhAabbMax;
|
||||
b3Vector3 bvhQuantization = bvhData[0]->m_bvhQuantization;
|
||||
|
||||
|
||||
{
|
||||
BT_PROFILE("m_bvhTraversalKernel");
|
||||
numConcavePairs = numConcavePairsOut.at(0);
|
||||
@@ -1096,10 +1097,8 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( const btOpenCLArray<btI
|
||||
launcher.setBuffer( numConcavePairsOut.getBufferCL());
|
||||
launcher.setBuffer( subTreesGPU->getBufferCL());
|
||||
launcher.setBuffer( treeNodesGPU->getBufferCL());
|
||||
launcher.setConst( bvhAabbMin);
|
||||
launcher.setConst( bvhAabbMax);
|
||||
launcher.setConst( bvhQuantization);
|
||||
launcher.setConst(numSubTrees);
|
||||
launcher.setBuffer( bvhInfo->getBufferCL());
|
||||
|
||||
launcher.setConst( nPairs );
|
||||
launcher.setConst( maxTriConvexPairCapacity);
|
||||
int num = nPairs;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "parallel_primitives/host/btInt2.h"
|
||||
#include "parallel_primitives/host/btInt4.h"
|
||||
#include "b3OptimizedBvh.h"
|
||||
#include "b3BvhInfo.h"
|
||||
|
||||
//#include "../../dynamics/basic_demo/Stubs/ChNarrowPhase.h"
|
||||
|
||||
@@ -85,6 +86,7 @@ struct GpuSatCollision
|
||||
b3AlignedObjectArray<class b3OptimizedBvh*>& bvhData,
|
||||
btOpenCLArray<btQuantizedBvhNode>* treeNodesGPU,
|
||||
btOpenCLArray<btBvhSubtreeInfo>* subTreesGPU,
|
||||
btOpenCLArray<b3BvhInfo>* bvhInfo,
|
||||
int numObjects,
|
||||
int maxTriConvexPairCapacity,
|
||||
btOpenCLArray<btInt4>& triangleConvexPairs,
|
||||
|
||||
Reference in New Issue
Block a user