move some files to shared folders
use b3Aabb for compound vs compound on host (for testing, towards BVH)
This commit is contained in:
@@ -7,7 +7,7 @@ class b3Vector3;
|
||||
#include "Bullet3OpenCL/ParallelPrimitives/b3RadixSort32CL.h"
|
||||
|
||||
#include "b3SapAabb.h"
|
||||
#include "Bullet3Common/b3Int2.h"
|
||||
#include "Bullet3Common/shared/b3Int2.h"
|
||||
|
||||
|
||||
class b3GpuSapBroadphase
|
||||
|
||||
@@ -2,19 +2,13 @@
|
||||
#define B3_SAP_AABB_H
|
||||
|
||||
#include "Bullet3Common/b3Scalar.h"
|
||||
#include "Bullet3Collision/BroadPhaseCollision/shared/b3Aabb.h"
|
||||
|
||||
B3_ATTRIBUTE_ALIGNED16(struct) b3SapAabb
|
||||
///just make sure that the b3Aabb is 16-byte aligned
|
||||
B3_ATTRIBUTE_ALIGNED16(struct) b3SapAabb : public b3Aabb
|
||||
{
|
||||
union
|
||||
{
|
||||
float m_min[4];
|
||||
int m_minIndices[4];
|
||||
};
|
||||
union
|
||||
{
|
||||
float m_max[4];
|
||||
int m_signedMaxIndices[4];
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif //B3_SAP_AABB_H
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
|
||||
#ifndef B3_COLLIDABLE_H
|
||||
#define B3_COLLIDABLE_H
|
||||
|
||||
#include "Bullet3Common/b3Vector3.h"
|
||||
#include "Bullet3Common/b3Quaternion.h"
|
||||
|
||||
enum b3ShapeTypes
|
||||
{
|
||||
SHAPE_HEIGHT_FIELD=1,
|
||||
|
||||
SHAPE_CONVEX_HULL=3,
|
||||
SHAPE_PLANE=4,
|
||||
SHAPE_CONCAVE_TRIMESH=5,
|
||||
SHAPE_COMPOUND_OF_CONVEX_HULLS=6,
|
||||
SHAPE_SPHERE=7,
|
||||
MAX_NUM_SHAPE_TYPES,
|
||||
};
|
||||
|
||||
struct b3Collidable
|
||||
{
|
||||
union {
|
||||
int m_numChildShapes;
|
||||
int m_bvhIndex;
|
||||
};
|
||||
float m_radius;
|
||||
int m_shapeType;
|
||||
int m_shapeIndex;
|
||||
};
|
||||
|
||||
struct b3CollidableNew
|
||||
{
|
||||
short int m_shapeType;
|
||||
short int m_numShapes;
|
||||
int m_shapeIndex;
|
||||
};
|
||||
|
||||
struct b3GpuChildShape
|
||||
{
|
||||
b3Vector3 m_childPosition;
|
||||
b3Quaternion m_childOrientation;
|
||||
int m_shapeIndex;
|
||||
int m_unused0;
|
||||
int m_unused1;
|
||||
int m_unused2;
|
||||
};
|
||||
|
||||
struct b3CompoundOverlappingPair
|
||||
{
|
||||
int m_bodyIndexA;
|
||||
int m_bodyIndexB;
|
||||
// int m_pairType;
|
||||
int m_childShapeIndexA;
|
||||
int m_childShapeIndexB;
|
||||
};
|
||||
#endif //B3_COLLIDABLE_H
|
||||
File diff suppressed because it is too large
Load Diff
@@ -7,30 +7,18 @@
|
||||
#include "Bullet3Common/b3AlignedObjectArray.h"
|
||||
#include "b3ConvexUtility.h"
|
||||
#include "b3ConvexPolyhedronCL.h"
|
||||
#include "b3Collidable.h"
|
||||
#include "Bullet3Collision/NarrowPhaseCollision/shared/b3Collidable.h"
|
||||
#include "Bullet3Collision/NarrowPhaseCollision/b3Contact4.h"
|
||||
#include "Bullet3Common/b3Int2.h"
|
||||
#include "Bullet3Common/b3Int4.h"
|
||||
#include "Bullet3Common/shared/b3Int2.h"
|
||||
#include "Bullet3Common/shared/b3Int4.h"
|
||||
#include "b3OptimizedBvh.h"
|
||||
#include "b3BvhInfo.h"
|
||||
#include "Bullet3Collision/BroadPhaseCollision/shared/b3Aabb.h"
|
||||
|
||||
//#include "../../dynamics/basic_demo/Stubs/ChNarrowPhase.h"
|
||||
|
||||
|
||||
struct b3YetAnotherAabb
|
||||
{
|
||||
union
|
||||
{
|
||||
float m_min[4];
|
||||
int m_minIndices[4];
|
||||
};
|
||||
union
|
||||
{
|
||||
float m_max[4];
|
||||
//int m_signedMaxIndices[4];
|
||||
//unsigned int m_unsignedMaxIndices[4];
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
struct GpuSatCollision
|
||||
{
|
||||
@@ -89,7 +77,9 @@ struct GpuSatCollision
|
||||
const b3OpenCLArray<b3Collidable>& gpuCollidables,
|
||||
const b3OpenCLArray<b3GpuChildShape>& gpuChildShapes,
|
||||
|
||||
const b3OpenCLArray<b3YetAnotherAabb>& clAabbs,
|
||||
const b3OpenCLArray<b3Aabb>& clAabbsWorldSpace,
|
||||
const b3OpenCLArray<b3Aabb>& clAabbsLocalSpace,
|
||||
|
||||
b3OpenCLArray<b3Vector3>& worldVertsB1GPU,
|
||||
b3OpenCLArray<b3Int4>& clippingFacesOutGPU,
|
||||
b3OpenCLArray<b3Vector3>& worldNormalsAGPU,
|
||||
|
||||
@@ -2,34 +2,12 @@
|
||||
#define CONVEX_POLYHEDRON_CL
|
||||
|
||||
#include "Bullet3Common/b3Transform.h"
|
||||
#include "Bullet3Collision/NarrowPhaseCollision/shared/b3ConvexPolyhedronData.h"
|
||||
|
||||
struct b3GpuFace
|
||||
|
||||
|
||||
B3_ATTRIBUTE_ALIGNED16(struct) b3ConvexPolyhedronCL : public b3ConvexPolyhedronData
|
||||
{
|
||||
b3Vector4 m_plane;
|
||||
int m_indexOffset;
|
||||
int m_numIndices;
|
||||
int m_unusedPadding1;
|
||||
int m_unusedPadding2;
|
||||
};
|
||||
|
||||
B3_ATTRIBUTE_ALIGNED16(struct) b3ConvexPolyhedronCL
|
||||
{
|
||||
b3Vector3 m_localCenter;
|
||||
b3Vector3 m_extents;
|
||||
b3Vector3 mC;
|
||||
b3Vector3 mE;
|
||||
|
||||
b3Scalar m_radius;
|
||||
int m_faceOffset;
|
||||
int m_numFaces;
|
||||
int m_numVertices;
|
||||
|
||||
int m_vertexOffset;
|
||||
int m_uniqueEdgesOffset;
|
||||
int m_numUniqueEdges;
|
||||
int m_unused;
|
||||
|
||||
|
||||
|
||||
inline void project(const b3Transform& trans, const b3Vector3& dir, const b3AlignedObjectArray<b3Vector3>& vertices, b3Scalar& min, b3Scalar& max) const
|
||||
{
|
||||
|
||||
@@ -10,9 +10,13 @@ static const char* primitiveContactsKernelsCL= \
|
||||
"{\n"
|
||||
" int bla;\n"
|
||||
"};\n"
|
||||
"#ifdef __cplusplus\n"
|
||||
"#else\n"
|
||||
"#define b3AtomicInc atomic_inc\n"
|
||||
"#endif\n"
|
||||
"#endif\n"
|
||||
"#ifdef __cplusplus\n"
|
||||
"#else//bla\n"
|
||||
"#else\n"
|
||||
" typedef float4 b3Float4;\n"
|
||||
"#endif \n"
|
||||
"#endif //B3_FLOAT4_H\n"
|
||||
|
||||
@@ -42,9 +42,13 @@ static const char* satClipKernelsCL= \
|
||||
"{\n"
|
||||
" int bla;\n"
|
||||
"};\n"
|
||||
"#ifdef __cplusplus\n"
|
||||
"#else\n"
|
||||
"#define b3AtomicInc atomic_inc\n"
|
||||
"#endif\n"
|
||||
"#endif\n"
|
||||
"#ifdef __cplusplus\n"
|
||||
"#else//bla\n"
|
||||
"#else\n"
|
||||
" typedef float4 b3Float4;\n"
|
||||
"#endif \n"
|
||||
"#endif //B3_FLOAT4_H\n"
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
#include "b3OpenCLArray.h"
|
||||
#include "Bullet3Common/b3Scalar.h"
|
||||
|
||||
#include "Bullet3Common/b3Int2.h"
|
||||
#include "Bullet3Common/b3Int4.h"
|
||||
#include "Bullet3Common/shared/b3Int2.h"
|
||||
#include "Bullet3Common/shared/b3Int4.h"
|
||||
|
||||
|
||||
class b3FillCL
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#include "b3GpuRaycast.h"
|
||||
#include "Bullet3OpenCL/NarrowphaseCollision/b3Collidable.h"
|
||||
#include "Bullet3Collision/NarrowPhaseCollision/shared/b3Collidable.h"
|
||||
#include "Bullet3Collision/NarrowPhaseCollision/b3RigidBodyCL.h"
|
||||
#include "Bullet3OpenCL/RigidBody/b3GpuNarrowPhaseInternalData.h"
|
||||
|
||||
|
||||
@@ -698,7 +698,7 @@ const struct b3Collidable* b3GpuNarrowPhase::getCollidablesCpu() const
|
||||
}
|
||||
|
||||
|
||||
cl_mem b3GpuNarrowPhase::getAabbBufferGpu()
|
||||
cl_mem b3GpuNarrowPhase::getAabbLocalSpaceBufferGpu()
|
||||
{
|
||||
return m_data->m_localShapeAABBGPU->getBufferCL();
|
||||
}
|
||||
@@ -726,8 +726,11 @@ const b3Contact4* b3GpuNarrowPhase::getContactsCPU() const
|
||||
return &m_data->m_pBufContactOutCPU->at(0);
|
||||
}
|
||||
|
||||
void b3GpuNarrowPhase::computeContacts(cl_mem broadphasePairs, int numBroadphasePairs, cl_mem aabbsWS, int numObjects)
|
||||
void b3GpuNarrowPhase::computeContacts(cl_mem broadphasePairs, int numBroadphasePairs, cl_mem aabbsWorldSpace, int numObjects)
|
||||
{
|
||||
|
||||
cl_mem aabbsLocalSpace = m_data->m_localShapeAABBGPU->getBufferCL();
|
||||
|
||||
int nContactOut = 0;
|
||||
|
||||
//swap buffer
|
||||
@@ -744,8 +747,11 @@ void b3GpuNarrowPhase::computeContacts(cl_mem broadphasePairs, int numBroadphase
|
||||
|
||||
|
||||
|
||||
b3OpenCLArray<b3YetAnotherAabb> clAabbArray(this->m_context,this->m_queue);
|
||||
clAabbArray.setFromOpenCLBuffer(aabbsWS,numObjects);
|
||||
b3OpenCLArray<b3Aabb> clAabbArrayWorldSpace(this->m_context,this->m_queue);
|
||||
clAabbArrayWorldSpace.setFromOpenCLBuffer(aabbsWorldSpace,numObjects);
|
||||
|
||||
b3OpenCLArray<b3Aabb> clAabbArrayLocalSpace(this->m_context,this->m_queue);
|
||||
clAabbArrayLocalSpace.setFromOpenCLBuffer(aabbsLocalSpace,numObjects);
|
||||
|
||||
m_data->m_gpuSatCollision->computeConvexConvexContactsGPUSAT(
|
||||
&broadphasePairsGPU, numBroadphasePairs,
|
||||
@@ -762,7 +768,8 @@ void b3GpuNarrowPhase::computeContacts(cl_mem broadphasePairs, int numBroadphase
|
||||
*m_data->m_convexIndicesGPU,
|
||||
*m_data->m_collidablesGPU,
|
||||
*m_data->m_gpuChildShapes,
|
||||
clAabbArray,
|
||||
clAabbArrayWorldSpace,
|
||||
clAabbArrayLocalSpace,
|
||||
*m_data->m_worldVertsB1GPU,
|
||||
*m_data->m_clippingFacesOutGPU,
|
||||
*m_data->m_worldNormalsAGPU,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef B3_GPU_NARROWPHASE_H
|
||||
#define B3_GPU_NARROWPHASE_H
|
||||
|
||||
#include "Bullet3OpenCL/NarrowphaseCollision/b3Collidable.h"
|
||||
#include "Bullet3Collision/NarrowPhaseCollision/shared/b3Collidable.h"
|
||||
#include "Bullet3OpenCL/Initialize/b3OpenCLInclude.h"
|
||||
#include "Bullet3Common/b3AlignedObjectArray.h"
|
||||
#include "Bullet3Common/b3Vector3.h"
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
void setObjectVelocityCpu(float* linVel, float* angVel, int bodyIndex);
|
||||
|
||||
|
||||
virtual void computeContacts(cl_mem broadphasePairs, int numBroadphasePairs, cl_mem aabbs, int numObjects);
|
||||
virtual void computeContacts(cl_mem broadphasePairs, int numBroadphasePairs, cl_mem aabbsWorldSpace, int numObjects);
|
||||
|
||||
|
||||
cl_mem getBodiesGpu();
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
cl_mem getContactsGpu();
|
||||
int getNumContactsGpu() const;
|
||||
|
||||
cl_mem getAabbBufferGpu();
|
||||
cl_mem getAabbLocalSpaceBufferGpu();
|
||||
|
||||
int getNumRigidBodies() const;
|
||||
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
#include "Bullet3OpenCL/ParallelPrimitives/b3OpenCLArray.h"
|
||||
#include "Bullet3OpenCL/NarrowphaseCollision/b3ConvexPolyhedronCL.h"
|
||||
#include "b3Config.h"
|
||||
#include "Bullet3OpenCL/NarrowphaseCollision/b3Collidable.h"
|
||||
#include "Bullet3Collision/NarrowPhaseCollision/shared/b3Collidable.h"
|
||||
|
||||
#include "Bullet3OpenCL/Initialize/b3OpenCLInclude.h"
|
||||
#include "Bullet3Common/b3AlignedObjectArray.h"
|
||||
#include "Bullet3Common/b3Vector3.h"
|
||||
@@ -16,8 +17,8 @@
|
||||
|
||||
#include "Bullet3OpenCL/NarrowphaseCollision/b3QuantizedBvh.h"
|
||||
#include "Bullet3OpenCL/NarrowphaseCollision/b3BvhInfo.h"
|
||||
#include "Bullet3Common/b3Int4.h"
|
||||
#include "Bullet3Common/b3Int2.h"
|
||||
#include "Bullet3Common/shared/b3Int4.h"
|
||||
#include "Bullet3Common/shared/b3Int2.h"
|
||||
|
||||
|
||||
class b3ConvexUtility;
|
||||
|
||||
@@ -450,7 +450,7 @@ void b3GpuRigidBodyPipeline::setupGpuAabbsFull()
|
||||
launcher.setBuffer(bodies);
|
||||
cl_mem collidables = m_data->m_narrowphase->getCollidablesGpu();
|
||||
launcher.setBuffer(collidables);
|
||||
cl_mem localAabbs = m_data->m_narrowphase->getAabbBufferGpu();
|
||||
cl_mem localAabbs = m_data->m_narrowphase->getAabbLocalSpaceBufferGpu();
|
||||
launcher.setBuffer(localAabbs);
|
||||
|
||||
cl_mem worldAabbs =0;
|
||||
|
||||
@@ -20,7 +20,8 @@ subject to the following restrictions:
|
||||
#include "Bullet3Common/b3AlignedObjectArray.h"
|
||||
|
||||
#include "Bullet3OpenCL/ParallelPrimitives/b3OpenCLArray.h"
|
||||
#include "Bullet3OpenCL/NarrowphaseCollision/b3Collidable.h"
|
||||
#include "Bullet3Collision/NarrowPhaseCollision/shared/b3Collidable.h"
|
||||
|
||||
|
||||
#include "Bullet3OpenCL/BroadphaseCollision/b3SapAabb.h"
|
||||
#include "Bullet3Dynamics/ConstraintSolver/b3TypedConstraint.h"
|
||||
|
||||
@@ -22,9 +22,13 @@ static const char* batchingKernelsCL= \
|
||||
"{\n"
|
||||
" int bla;\n"
|
||||
"};\n"
|
||||
"#ifdef __cplusplus\n"
|
||||
"#else\n"
|
||||
"#define b3AtomicInc atomic_inc\n"
|
||||
"#endif\n"
|
||||
"#endif\n"
|
||||
"#ifdef __cplusplus\n"
|
||||
"#else//bla\n"
|
||||
"#else\n"
|
||||
" typedef float4 b3Float4;\n"
|
||||
"#endif \n"
|
||||
"#endif //B3_FLOAT4_H\n"
|
||||
|
||||
@@ -22,9 +22,13 @@ static const char* batchingKernelsNewCL= \
|
||||
"{\n"
|
||||
" int bla;\n"
|
||||
"};\n"
|
||||
"#ifdef __cplusplus\n"
|
||||
"#else\n"
|
||||
"#define b3AtomicInc atomic_inc\n"
|
||||
"#endif\n"
|
||||
"#endif\n"
|
||||
"#ifdef __cplusplus\n"
|
||||
"#else//bla\n"
|
||||
"#else\n"
|
||||
" typedef float4 b3Float4;\n"
|
||||
"#endif \n"
|
||||
"#endif //B3_FLOAT4_H\n"
|
||||
|
||||
@@ -22,9 +22,13 @@ static const char* solverSetupCL= \
|
||||
"{\n"
|
||||
" int bla;\n"
|
||||
"};\n"
|
||||
"#ifdef __cplusplus\n"
|
||||
"#else\n"
|
||||
"#define b3AtomicInc atomic_inc\n"
|
||||
"#endif\n"
|
||||
"#endif\n"
|
||||
"#ifdef __cplusplus\n"
|
||||
"#else//bla\n"
|
||||
"#else\n"
|
||||
" typedef float4 b3Float4;\n"
|
||||
"#endif \n"
|
||||
"#endif //B3_FLOAT4_H\n"
|
||||
|
||||
@@ -22,9 +22,13 @@ static const char* solverSetup2CL= \
|
||||
"{\n"
|
||||
" int bla;\n"
|
||||
"};\n"
|
||||
"#ifdef __cplusplus\n"
|
||||
"#else\n"
|
||||
"#define b3AtomicInc atomic_inc\n"
|
||||
"#endif\n"
|
||||
"#endif\n"
|
||||
"#ifdef __cplusplus\n"
|
||||
"#else//bla\n"
|
||||
"#else\n"
|
||||
" typedef float4 b3Float4;\n"
|
||||
"#endif \n"
|
||||
"#endif //B3_FLOAT4_H\n"
|
||||
|
||||
@@ -22,9 +22,13 @@ static const char* solverUtilsCL= \
|
||||
"{\n"
|
||||
" int bla;\n"
|
||||
"};\n"
|
||||
"#ifdef __cplusplus\n"
|
||||
"#else\n"
|
||||
"#define b3AtomicInc atomic_inc\n"
|
||||
"#endif\n"
|
||||
"#endif\n"
|
||||
"#ifdef __cplusplus\n"
|
||||
"#else//bla\n"
|
||||
"#else\n"
|
||||
" typedef float4 b3Float4;\n"
|
||||
"#endif \n"
|
||||
"#endif //B3_FLOAT4_H\n"
|
||||
|
||||
Reference in New Issue
Block a user