add ray-convex CPU implementation, make CPU raytest default for now
tweak/increase the b3Config values again, so it works better on the Macbook Retina GPU.
This commit is contained in:
@@ -288,9 +288,8 @@ void BasicGpuDemo::initPhysics()
|
|||||||
//create a few dynamic rigidbodies
|
//create a few dynamic rigidbodies
|
||||||
// Re-using the same collision is better for memory usage and performance
|
// Re-using the same collision is better for memory usage and performance
|
||||||
|
|
||||||
//btBoxShape* colShape = new btBoxShape(btVector3(SCALING*1,SCALING*1,SCALING*1));
|
btBoxShape* colShape = new btBoxShape(btVector3(SCALING*1,SCALING*1,SCALING*1));
|
||||||
|
//btCollisionShape* colShape = new btSphereShape(btScalar(SCALING*1.f));
|
||||||
btCollisionShape* colShape = new btSphereShape(btScalar(SCALING*1.f));
|
|
||||||
m_collisionShapes.push_back(colShape);
|
m_collisionShapes.push_back(colShape);
|
||||||
|
|
||||||
/// Create Dynamic Objects
|
/// Create Dynamic Objects
|
||||||
|
|||||||
@@ -458,7 +458,7 @@ void GpuRaytraceScene::renderScene()
|
|||||||
|
|
||||||
|
|
||||||
//m_raycaster->castRaysHost(rays, hits, this->m_data->m_np->getNumRigidBodies(), m_data->m_np->getBodiesCpu(), m_data->m_np->getNumCollidablesGpu(), m_data->m_np->getCollidablesCpu());
|
//m_raycaster->castRaysHost(rays, hits, this->m_data->m_np->getNumRigidBodies(), m_data->m_np->getBodiesCpu(), m_data->m_np->getNumCollidablesGpu(), m_data->m_np->getCollidablesCpu());
|
||||||
m_raycaster->castRays(rays, hits, this->m_data->m_np->getNumRigidBodies(), m_data->m_np->getBodiesCpu(), m_data->m_np->getNumCollidablesGpu(), m_data->m_np->getCollidablesCpu());
|
m_raycaster->castRays(rays, hits, this->m_data->m_np->getNumRigidBodies(), m_data->m_np->getBodiesCpu(), m_data->m_np->getNumCollidablesGpu(), m_data->m_np->getCollidablesCpu(), m_data->m_np->getInternalData());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ void GpuRigidBodyDemo::initPhysics(const ConstructionInfo& ci)
|
|||||||
b3Config config;
|
b3Config config;
|
||||||
config.m_maxConvexBodies = b3Max(config.m_maxConvexBodies,ci.arraySizeX*ci.arraySizeY*ci.arraySizeZ+10);
|
config.m_maxConvexBodies = b3Max(config.m_maxConvexBodies,ci.arraySizeX*ci.arraySizeY*ci.arraySizeZ+10);
|
||||||
config.m_maxConvexShapes = config.m_maxConvexBodies;
|
config.m_maxConvexShapes = config.m_maxConvexBodies;
|
||||||
config.m_maxBroadphasePairs = 8*config.m_maxConvexBodies;
|
config.m_maxBroadphasePairs = 12*config.m_maxConvexBodies;
|
||||||
config.m_maxContactCapacity = config.m_maxBroadphasePairs;
|
config.m_maxContactCapacity = config.m_maxBroadphasePairs;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
#include "b3GpuRaycast.h"
|
#include "b3GpuRaycast.h"
|
||||||
#include "Bullet3OpenCL/NarrowphaseCollision/b3Collidable.h"
|
#include "Bullet3OpenCL/NarrowphaseCollision/b3Collidable.h"
|
||||||
#include "Bullet3Collision/NarrowPhaseCollision/b3RigidBodyCL.h"
|
#include "Bullet3Collision/NarrowPhaseCollision/b3RigidBodyCL.h"
|
||||||
|
#include "Bullet3OpenCL/RigidBody/b3GpuNarrowPhaseInternalData.h"
|
||||||
|
|
||||||
|
|
||||||
#include "Bullet3OpenCL/Initialize/b3OpenCLUtils.h"
|
#include "Bullet3OpenCL/Initialize/b3OpenCLUtils.h"
|
||||||
#include "Bullet3OpenCL/ParallelPrimitives/b3OpenCLArray.h"
|
#include "Bullet3OpenCL/ParallelPrimitives/b3OpenCLArray.h"
|
||||||
@@ -73,9 +75,57 @@ bool sphere_intersect(const b3Vector3& spherePos, b3Scalar radius, const b3Vect
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool rayConvex(const b3Vector3& rayFromLocal, const b3Vector3& rayToLocal, const b3ConvexPolyhedronCL& poly,
|
||||||
|
const struct b3GpuNarrowPhaseInternalData* narrowphaseData, float& hitFraction, b3Vector3& hitNormal)
|
||||||
|
{
|
||||||
|
float exitFraction = hitFraction;
|
||||||
|
float enterFraction = -0.1f;
|
||||||
|
b3Vector3 curHitNormal(0,0,0);
|
||||||
|
for (int i=0;i<poly.m_numFaces;i++)
|
||||||
|
{
|
||||||
|
const b3GpuFace& face = narrowphaseData->m_convexFaces[poly.m_faceOffset+i];
|
||||||
|
float fromPlaneDist = b3Dot(rayFromLocal,face.m_plane)+face.m_plane.w;
|
||||||
|
float toPlaneDist = b3Dot(rayToLocal,face.m_plane)+face.m_plane.w;
|
||||||
|
if (fromPlaneDist<0.f)
|
||||||
|
{
|
||||||
|
if (toPlaneDist >= 0.f)
|
||||||
|
{
|
||||||
|
float fraction = fromPlaneDist / (fromPlaneDist-toPlaneDist);
|
||||||
|
if (exitFraction>fraction)
|
||||||
|
{
|
||||||
|
exitFraction = fraction;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
if (toPlaneDist<0.f)
|
||||||
|
{
|
||||||
|
float fraction = fromPlaneDist / (fromPlaneDist-toPlaneDist);
|
||||||
|
if (enterFraction <= fraction)
|
||||||
|
{
|
||||||
|
enterFraction = fraction;
|
||||||
|
curHitNormal = face.m_plane;
|
||||||
|
curHitNormal.w = 0.f;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (exitFraction <= enterFraction)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enterFraction < 0.f)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
hitFraction = enterFraction;
|
||||||
|
hitNormal = curHitNormal;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void b3GpuRaycast::castRaysHost(const b3AlignedObjectArray<b3RayInfo>& rays, b3AlignedObjectArray<b3RayHit>& hitResults,
|
void b3GpuRaycast::castRaysHost(const b3AlignedObjectArray<b3RayInfo>& rays, b3AlignedObjectArray<b3RayHit>& hitResults,
|
||||||
int numBodies,const struct b3RigidBodyCL* bodies, int numCollidables,const struct b3Collidable* collidables)
|
int numBodies,const struct b3RigidBodyCL* bodies, int numCollidables,const struct b3Collidable* collidables, const struct b3GpuNarrowPhaseInternalData* narrowphaseData)
|
||||||
{
|
{
|
||||||
|
|
||||||
// return castRays(rays,hitResults,numBodies,bodies,numCollidables,collidables);
|
// return castRays(rays,hitResults,numBodies,bodies,numCollidables,collidables);
|
||||||
@@ -88,6 +138,7 @@ void b3GpuRaycast::castRaysHost(const b3AlignedObjectArray<b3RayInfo>& rays, b3A
|
|||||||
float hitFraction = hitResults[r].m_hitFraction;
|
float hitFraction = hitResults[r].m_hitFraction;
|
||||||
|
|
||||||
int hitBodyIndex= -1;
|
int hitBodyIndex= -1;
|
||||||
|
b3Vector3 hitNormal;
|
||||||
|
|
||||||
for (int b=0;b<numBodies;b++)
|
for (int b=0;b<numBodies;b++)
|
||||||
{
|
{
|
||||||
@@ -103,9 +154,34 @@ void b3GpuRaycast::castRaysHost(const b3AlignedObjectArray<b3RayInfo>& rays, b3A
|
|||||||
if (sphere_intersect(pos, radius, rayFrom, rayTo,hitFraction))
|
if (sphere_intersect(pos, radius, rayFrom, rayTo,hitFraction))
|
||||||
{
|
{
|
||||||
hitBodyIndex = b;
|
hitBodyIndex = b;
|
||||||
|
b3Vector3 hitPoint;
|
||||||
|
hitPoint.setInterpolate3(rays[r].m_from, rays[r].m_to,hitFraction);
|
||||||
|
hitNormal = (hitPoint-bodies[b].m_pos).normalize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case SHAPE_CONVEX_HULL:
|
||||||
|
{
|
||||||
|
|
||||||
|
b3Transform convexWorldTransform;
|
||||||
|
convexWorldTransform.setIdentity();
|
||||||
|
convexWorldTransform.setOrigin(bodies[b].m_pos);
|
||||||
|
convexWorldTransform.setRotation(bodies[b].m_quat);
|
||||||
|
b3Transform convexWorld2Local = convexWorldTransform.inverse();
|
||||||
|
|
||||||
|
b3Vector3 rayFromLocal = convexWorld2Local(rayFrom);
|
||||||
|
b3Vector3 rayToLocal = convexWorld2Local(rayTo);
|
||||||
|
|
||||||
|
|
||||||
|
int shapeIndex = collidables[bodies[b].m_collidableIdx].m_shapeIndex;
|
||||||
|
const b3ConvexPolyhedronCL& poly = narrowphaseData->m_convexPolyhedra[shapeIndex];
|
||||||
|
if (rayConvex(rayFromLocal, rayToLocal,poly,narrowphaseData, hitFraction, hitNormal))
|
||||||
|
{
|
||||||
|
hitBodyIndex = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
static bool once=true;
|
static bool once=true;
|
||||||
@@ -122,7 +198,7 @@ void b3GpuRaycast::castRaysHost(const b3AlignedObjectArray<b3RayInfo>& rays, b3A
|
|||||||
|
|
||||||
hitResults[r].m_hitFraction = hitFraction;
|
hitResults[r].m_hitFraction = hitFraction;
|
||||||
hitResults[r].m_hitPoint.setInterpolate3(rays[r].m_from, rays[r].m_to,hitFraction);
|
hitResults[r].m_hitPoint.setInterpolate3(rays[r].m_from, rays[r].m_to,hitFraction);
|
||||||
hitResults[r].m_hitNormal = (hitResults[r].m_hitPoint-bodies[hitBodyIndex].m_pos).normalize();
|
hitResults[r].m_hitNormal = hitNormal;
|
||||||
hitResults[r].m_hitResult0 = hitBodyIndex;
|
hitResults[r].m_hitResult0 = hitBodyIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,8 +206,9 @@ void b3GpuRaycast::castRaysHost(const b3AlignedObjectArray<b3RayInfo>& rays, b3A
|
|||||||
}
|
}
|
||||||
|
|
||||||
void b3GpuRaycast::castRays(const b3AlignedObjectArray<b3RayInfo>& rays, b3AlignedObjectArray<b3RayHit>& hitResults,
|
void b3GpuRaycast::castRays(const b3AlignedObjectArray<b3RayInfo>& rays, b3AlignedObjectArray<b3RayHit>& hitResults,
|
||||||
int numBodies,const struct b3RigidBodyCL* bodies, int numCollidables, const struct b3Collidable* collidables)
|
int numBodies,const struct b3RigidBodyCL* bodies, int numCollidables, const struct b3Collidable* collidables, const struct b3GpuNarrowPhaseInternalData* narrowphaseData)
|
||||||
{
|
{
|
||||||
|
|
||||||
B3_PROFILE("castRaysGPU");
|
B3_PROFILE("castRaysGPU");
|
||||||
|
|
||||||
b3OpenCLArray<b3RayInfo> gpuRays(m_data->m_context,m_data->m_q);
|
b3OpenCLArray<b3RayInfo> gpuRays(m_data->m_context,m_data->m_q);
|
||||||
|
|||||||
@@ -18,10 +18,13 @@ public:
|
|||||||
virtual ~b3GpuRaycast();
|
virtual ~b3GpuRaycast();
|
||||||
|
|
||||||
void castRaysHost(const b3AlignedObjectArray<b3RayInfo>& raysIn, b3AlignedObjectArray<b3RayHit>& hitResults,
|
void castRaysHost(const b3AlignedObjectArray<b3RayInfo>& raysIn, b3AlignedObjectArray<b3RayHit>& hitResults,
|
||||||
int numBodies, const struct b3RigidBodyCL* bodies, int numCollidables, const struct b3Collidable* collidables);
|
int numBodies, const struct b3RigidBodyCL* bodies, int numCollidables, const struct b3Collidable* collidables,
|
||||||
|
const struct b3GpuNarrowPhaseInternalData* narrowphaseData);
|
||||||
|
|
||||||
void castRays(const b3AlignedObjectArray<b3RayInfo>& rays, b3AlignedObjectArray<b3RayHit>& hitResults,
|
void castRays(const b3AlignedObjectArray<b3RayInfo>& rays, b3AlignedObjectArray<b3RayHit>& hitResults,
|
||||||
int numBodies,const struct b3RigidBodyCL* bodies, int numCollidables, const struct b3Collidable* collidables);
|
int numBodies,const struct b3RigidBodyCL* bodies, int numCollidables, const struct b3Collidable* collidables,
|
||||||
|
const struct b3GpuNarrowPhaseInternalData* narrowphaseData
|
||||||
|
);
|
||||||
|
|
||||||
/* const b3OpenCLArray<b3RigidBodyCL>* bodyBuf,
|
/* const b3OpenCLArray<b3RigidBodyCL>* bodyBuf,
|
||||||
b3OpenCLArray<b3Contact4>* contactOut, int& nContacts,
|
b3OpenCLArray<b3Contact4>* contactOut, int& nContacts,
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ struct b3Config
|
|||||||
int m_maxTriConvexPairCapacity;
|
int m_maxTriConvexPairCapacity;
|
||||||
|
|
||||||
b3Config()
|
b3Config()
|
||||||
:m_maxConvexBodies(128*1024),
|
:m_maxConvexBodies(32*1024),
|
||||||
m_maxVerticesPerFace(64),
|
m_maxVerticesPerFace(64),
|
||||||
m_maxFacesPerShape(12),
|
m_maxFacesPerShape(12),
|
||||||
m_maxConvexVertices(8192),
|
m_maxConvexVertices(8192),
|
||||||
@@ -29,7 +29,7 @@ struct b3Config
|
|||||||
m_maxTriConvexPairCapacity(256*1024)
|
m_maxTriConvexPairCapacity(256*1024)
|
||||||
{
|
{
|
||||||
m_maxConvexShapes = m_maxConvexBodies;
|
m_maxConvexShapes = m_maxConvexBodies;
|
||||||
m_maxBroadphasePairs = 8*m_maxConvexBodies;
|
m_maxBroadphasePairs = 12*m_maxConvexBodies;
|
||||||
m_maxContactCapacity = m_maxBroadphasePairs;
|
m_maxContactCapacity = m_maxBroadphasePairs;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -12,73 +12,7 @@
|
|||||||
#include "Bullet3Geometry/b3AabbUtil.h"
|
#include "Bullet3Geometry/b3AabbUtil.h"
|
||||||
#include "Bullet3OpenCL/NarrowphaseCollision/b3BvhInfo.h"
|
#include "Bullet3OpenCL/NarrowphaseCollision/b3BvhInfo.h"
|
||||||
|
|
||||||
struct b3GpuNarrowPhaseInternalData
|
#include "b3GpuNarrowPhaseInternalData.h"
|
||||||
{
|
|
||||||
b3AlignedObjectArray<b3ConvexUtility*>* m_convexData;
|
|
||||||
|
|
||||||
b3AlignedObjectArray<b3ConvexPolyhedronCL> m_convexPolyhedra;
|
|
||||||
b3AlignedObjectArray<b3Vector3> m_uniqueEdges;
|
|
||||||
b3AlignedObjectArray<b3Vector3> m_convexVertices;
|
|
||||||
b3AlignedObjectArray<int> m_convexIndices;
|
|
||||||
|
|
||||||
b3OpenCLArray<b3ConvexPolyhedronCL>* m_convexPolyhedraGPU;
|
|
||||||
b3OpenCLArray<b3Vector3>* m_uniqueEdgesGPU;
|
|
||||||
b3OpenCLArray<b3Vector3>* m_convexVerticesGPU;
|
|
||||||
b3OpenCLArray<int>* m_convexIndicesGPU;
|
|
||||||
|
|
||||||
b3OpenCLArray<b3Vector3>* m_worldVertsB1GPU;
|
|
||||||
b3OpenCLArray<b3Int4>* m_clippingFacesOutGPU;
|
|
||||||
b3OpenCLArray<b3Vector3>* m_worldNormalsAGPU;
|
|
||||||
b3OpenCLArray<b3Vector3>* m_worldVertsA1GPU;
|
|
||||||
b3OpenCLArray<b3Vector3>* m_worldVertsB2GPU;
|
|
||||||
|
|
||||||
b3AlignedObjectArray<b3GpuChildShape> m_cpuChildShapes;
|
|
||||||
b3OpenCLArray<b3GpuChildShape>* m_gpuChildShapes;
|
|
||||||
|
|
||||||
b3AlignedObjectArray<b3GpuFace> m_convexFaces;
|
|
||||||
b3OpenCLArray<b3GpuFace>* m_convexFacesGPU;
|
|
||||||
|
|
||||||
GpuSatCollision* m_gpuSatCollision;
|
|
||||||
|
|
||||||
b3AlignedObjectArray<b3Int2>* m_pBufPairsCPU;
|
|
||||||
|
|
||||||
//b3OpenCLArray<b3Int2>* m_convexPairsOutGPU;
|
|
||||||
//b3OpenCLArray<b3Int2>* m_planePairs;
|
|
||||||
|
|
||||||
b3OpenCLArray<b3Contact4>* m_pBufContactOutGPU;
|
|
||||||
b3AlignedObjectArray<b3Contact4>* m_pBufContactOutCPU;
|
|
||||||
|
|
||||||
|
|
||||||
b3AlignedObjectArray<b3RigidBodyCL>* m_bodyBufferCPU;
|
|
||||||
b3OpenCLArray<b3RigidBodyCL>* m_bodyBufferGPU;
|
|
||||||
|
|
||||||
b3AlignedObjectArray<b3InertiaCL>* m_inertiaBufferCPU;
|
|
||||||
b3OpenCLArray<b3InertiaCL>* m_inertiaBufferGPU;
|
|
||||||
|
|
||||||
int m_numAcceleratedShapes;
|
|
||||||
int m_numAcceleratedRigidBodies;
|
|
||||||
|
|
||||||
b3AlignedObjectArray<b3Collidable> m_collidablesCPU;
|
|
||||||
b3OpenCLArray<b3Collidable>* m_collidablesGPU;
|
|
||||||
|
|
||||||
b3OpenCLArray<b3SapAabb>* m_localShapeAABBGPU;
|
|
||||||
b3AlignedObjectArray<b3SapAabb>* m_localShapeAABBCPU;
|
|
||||||
|
|
||||||
b3AlignedObjectArray<class b3OptimizedBvh*> m_bvhData;
|
|
||||||
|
|
||||||
b3AlignedObjectArray<b3QuantizedBvhNode> m_treeNodesCPU;
|
|
||||||
b3AlignedObjectArray<b3BvhSubtreeInfo> m_subTreesCPU;
|
|
||||||
|
|
||||||
b3AlignedObjectArray<b3BvhInfo> m_bvhInfoCPU;
|
|
||||||
b3OpenCLArray<b3BvhInfo>* m_bvhInfoGPU;
|
|
||||||
|
|
||||||
b3OpenCLArray<b3QuantizedBvhNode>* m_treeNodesGPU;
|
|
||||||
b3OpenCLArray<b3BvhSubtreeInfo>* m_subTreesGPU;
|
|
||||||
|
|
||||||
|
|
||||||
b3Config m_config;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -91,6 +91,11 @@ public:
|
|||||||
b3Collidable& getCollidableCpu(int collidableIndex);
|
b3Collidable& getCollidableCpu(int collidableIndex);
|
||||||
const b3Collidable& getCollidableCpu(int collidableIndex) const;
|
const b3Collidable& getCollidableCpu(int collidableIndex) const;
|
||||||
|
|
||||||
|
const b3GpuNarrowPhaseInternalData* getInternalData() const
|
||||||
|
{
|
||||||
|
return m_data;
|
||||||
|
}
|
||||||
|
|
||||||
const struct b3SapAabb& getLocalSpaceAabb(int collidableIndex) const;
|
const struct b3SapAabb& getLocalSpaceAabb(int collidableIndex) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
93
src/Bullet3OpenCL/RigidBody/b3GpuNarrowPhaseInternalData.h
Normal file
93
src/Bullet3OpenCL/RigidBody/b3GpuNarrowPhaseInternalData.h
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
|
||||||
|
#ifndef B3_GPU_NARROWPHASE_INTERNAL_DATA_H
|
||||||
|
#define B3_GPU_NARROWPHASE_INTERNAL_DATA_H
|
||||||
|
|
||||||
|
#include "Bullet3OpenCL/ParallelPrimitives/b3OpenCLArray.h"
|
||||||
|
#include "Bullet3OpenCL/NarrowphaseCollision/b3ConvexPolyhedronCL.h"
|
||||||
|
#include "b3Config.h"
|
||||||
|
#include "Bullet3OpenCL/NarrowphaseCollision/b3Collidable.h"
|
||||||
|
#include "Bullet3OpenCL/Initialize/b3OpenCLInclude.h"
|
||||||
|
#include "Bullet3Common/b3AlignedObjectArray.h"
|
||||||
|
#include "Bullet3Common/b3Vector3.h"
|
||||||
|
|
||||||
|
#include "Bullet3Collision/NarrowPhaseCollision/b3RigidBodyCL.h"
|
||||||
|
#include "Bullet3Collision/NarrowPhaseCollision/b3Contact4.h"
|
||||||
|
#include "Bullet3OpenCL/BroadphaseCollision/b3SapAabb.h"
|
||||||
|
|
||||||
|
#include "Bullet3OpenCL/NarrowphaseCollision/b3QuantizedBvh.h"
|
||||||
|
#include "Bullet3OpenCL/NarrowphaseCollision/b3BvhInfo.h"
|
||||||
|
#include "Bullet3Common/b3Int4.h"
|
||||||
|
#include "Bullet3Common/b3Int2.h"
|
||||||
|
|
||||||
|
|
||||||
|
class b3ConvexUtility;
|
||||||
|
|
||||||
|
struct b3GpuNarrowPhaseInternalData
|
||||||
|
{
|
||||||
|
b3AlignedObjectArray<b3ConvexUtility*>* m_convexData;
|
||||||
|
|
||||||
|
b3AlignedObjectArray<b3ConvexPolyhedronCL> m_convexPolyhedra;
|
||||||
|
b3AlignedObjectArray<b3Vector3> m_uniqueEdges;
|
||||||
|
b3AlignedObjectArray<b3Vector3> m_convexVertices;
|
||||||
|
b3AlignedObjectArray<int> m_convexIndices;
|
||||||
|
|
||||||
|
b3OpenCLArray<b3ConvexPolyhedronCL>* m_convexPolyhedraGPU;
|
||||||
|
b3OpenCLArray<b3Vector3>* m_uniqueEdgesGPU;
|
||||||
|
b3OpenCLArray<b3Vector3>* m_convexVerticesGPU;
|
||||||
|
b3OpenCLArray<int>* m_convexIndicesGPU;
|
||||||
|
|
||||||
|
b3OpenCLArray<b3Vector3>* m_worldVertsB1GPU;
|
||||||
|
b3OpenCLArray<b3Int4>* m_clippingFacesOutGPU;
|
||||||
|
b3OpenCLArray<b3Vector3>* m_worldNormalsAGPU;
|
||||||
|
b3OpenCLArray<b3Vector3>* m_worldVertsA1GPU;
|
||||||
|
b3OpenCLArray<b3Vector3>* m_worldVertsB2GPU;
|
||||||
|
|
||||||
|
b3AlignedObjectArray<b3GpuChildShape> m_cpuChildShapes;
|
||||||
|
b3OpenCLArray<b3GpuChildShape>* m_gpuChildShapes;
|
||||||
|
|
||||||
|
b3AlignedObjectArray<b3GpuFace> m_convexFaces;
|
||||||
|
b3OpenCLArray<b3GpuFace>* m_convexFacesGPU;
|
||||||
|
|
||||||
|
struct GpuSatCollision* m_gpuSatCollision;
|
||||||
|
|
||||||
|
b3AlignedObjectArray<b3Int2>* m_pBufPairsCPU;
|
||||||
|
|
||||||
|
//b3OpenCLArray<b3Int2>* m_convexPairsOutGPU;
|
||||||
|
//b3OpenCLArray<b3Int2>* m_planePairs;
|
||||||
|
|
||||||
|
b3OpenCLArray<b3Contact4>* m_pBufContactOutGPU;
|
||||||
|
b3AlignedObjectArray<b3Contact4>* m_pBufContactOutCPU;
|
||||||
|
|
||||||
|
|
||||||
|
b3AlignedObjectArray<b3RigidBodyCL>* m_bodyBufferCPU;
|
||||||
|
b3OpenCLArray<b3RigidBodyCL>* m_bodyBufferGPU;
|
||||||
|
|
||||||
|
b3AlignedObjectArray<b3InertiaCL>* m_inertiaBufferCPU;
|
||||||
|
b3OpenCLArray<b3InertiaCL>* m_inertiaBufferGPU;
|
||||||
|
|
||||||
|
int m_numAcceleratedShapes;
|
||||||
|
int m_numAcceleratedRigidBodies;
|
||||||
|
|
||||||
|
b3AlignedObjectArray<b3Collidable> m_collidablesCPU;
|
||||||
|
b3OpenCLArray<b3Collidable>* m_collidablesGPU;
|
||||||
|
|
||||||
|
b3OpenCLArray<b3SapAabb>* m_localShapeAABBGPU;
|
||||||
|
b3AlignedObjectArray<b3SapAabb>* m_localShapeAABBCPU;
|
||||||
|
|
||||||
|
b3AlignedObjectArray<class b3OptimizedBvh*> m_bvhData;
|
||||||
|
|
||||||
|
b3AlignedObjectArray<b3QuantizedBvhNode> m_treeNodesCPU;
|
||||||
|
b3AlignedObjectArray<b3BvhSubtreeInfo> m_subTreesCPU;
|
||||||
|
|
||||||
|
b3AlignedObjectArray<b3BvhInfo> m_bvhInfoCPU;
|
||||||
|
b3OpenCLArray<b3BvhInfo>* m_bvhInfoGPU;
|
||||||
|
|
||||||
|
b3OpenCLArray<b3QuantizedBvhNode>* m_treeNodesGPU;
|
||||||
|
b3OpenCLArray<b3BvhSubtreeInfo>* m_subTreesGPU;
|
||||||
|
|
||||||
|
|
||||||
|
b3Config m_config;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //B3_GPU_NARROWPHASE_INTERNAL_DATA_H
|
||||||
@@ -457,6 +457,9 @@ int b3GpuRigidBodyPipeline::registerPhysicsInstance(float mass, const float* po
|
|||||||
|
|
||||||
void b3GpuRigidBodyPipeline::castRays(const b3AlignedObjectArray<b3RayInfo>& rays, b3AlignedObjectArray<b3RayHit>& hitResults)
|
void b3GpuRigidBodyPipeline::castRays(const b3AlignedObjectArray<b3RayInfo>& rays, b3AlignedObjectArray<b3RayHit>& hitResults)
|
||||||
{
|
{
|
||||||
this->m_data->m_raycaster->castRays(rays,hitResults,getNumBodies(),this->m_data->m_narrowphase->getBodiesCpu(),m_data->m_narrowphase->getNumCollidablesGpu(), m_data->m_narrowphase->getCollidablesCpu());
|
this->m_data->m_raycaster->castRaysHost(rays,hitResults,
|
||||||
|
getNumBodies(),this->m_data->m_narrowphase->getBodiesCpu(),
|
||||||
|
m_data->m_narrowphase->getNumCollidablesGpu(), m_data->m_narrowphase->getCollidablesCpu(), m_data->m_narrowphase->getInternalData()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user