本文整理汇总了C++中btAlignedAlloc函数的典型用法代码示例。如果您正苦于以下问题:C++ btAlignedAlloc函数的具体用法?C++ btAlignedAlloc怎么用?C++ btAlignedAlloc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了btAlignedAlloc函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: btAlignedAlloc
btCriticalSection* Win32ThreadSupport::createCriticalSection()
{
unsigned char* mem = (unsigned char*) btAlignedAlloc(sizeof(btWin32CriticalSection),16);
btWin32CriticalSection* cs = new(mem) btWin32CriticalSection();
return cs;
}
开发者ID:JinMyong,项目名称:Game_MatchEmUp,代码行数:6,代码来源:Win32ThreadSupport.cpp
示例2: btAlignedAlloc
btDefaultCollisionConfiguration::btDefaultCollisionConfiguration(const btDefaultCollisionConstructionInfo& constructionInfo)
//btDefaultCollisionConfiguration::btDefaultCollisionConfiguration(btStackAlloc* stackAlloc,btPoolAllocator* persistentManifoldPool,btPoolAllocator* collisionAlgorithmPool)
{
void* mem = btAlignedAlloc(sizeof(btVoronoiSimplexSolver),16);
m_simplexSolver = new (mem)btVoronoiSimplexSolver();
#define USE_EPA 1
#ifdef USE_EPA
mem = btAlignedAlloc(sizeof(btGjkEpaPenetrationDepthSolver),16);
m_pdSolver = new (mem)btGjkEpaPenetrationDepthSolver;
#else
mem = btAlignedAlloc(sizeof(btMinkowskiPenetrationDepthSolver),16);
m_pdSolver = new (mem)btMinkowskiPenetrationDepthSolver;
#endif//USE_EPA
//default CreationFunctions, filling the m_doubleDispatch table
mem = btAlignedAlloc(sizeof(btConvexConvexAlgorithm::CreateFunc),16);
m_convexConvexCreateFunc = new(mem) btConvexConvexAlgorithm::CreateFunc(m_simplexSolver,m_pdSolver);
mem = btAlignedAlloc(sizeof(btConvexConcaveCollisionAlgorithm::CreateFunc),16);
m_convexConcaveCreateFunc = new (mem)btConvexConcaveCollisionAlgorithm::CreateFunc;
mem = btAlignedAlloc(sizeof(btConvexConcaveCollisionAlgorithm::CreateFunc),16);
m_swappedConvexConcaveCreateFunc = new (mem)btConvexConcaveCollisionAlgorithm::SwappedCreateFunc;
mem = btAlignedAlloc(sizeof(btCompoundCollisionAlgorithm::CreateFunc),16);
m_compoundCreateFunc = new (mem)btCompoundCollisionAlgorithm::CreateFunc;
mem = btAlignedAlloc(sizeof(btCompoundCollisionAlgorithm::SwappedCreateFunc),16);
m_swappedCompoundCreateFunc = new (mem)btCompoundCollisionAlgorithm::SwappedCreateFunc;
mem = btAlignedAlloc(sizeof(btEmptyAlgorithm::CreateFunc),16);
m_emptyCreateFunc = new(mem) btEmptyAlgorithm::CreateFunc;
mem = btAlignedAlloc(sizeof(btSphereSphereCollisionAlgorithm::CreateFunc),16);
m_sphereSphereCF = new(mem) btSphereSphereCollisionAlgorithm::CreateFunc;
#ifdef USE_BUGGY_SPHERE_BOX_ALGORITHM
mem = btAlignedAlloc(sizeof(btSphereBoxCollisionAlgorithm::CreateFunc),16);
m_sphereBoxCF = new(mem) btSphereBoxCollisionAlgorithm::CreateFunc;
mem = btAlignedAlloc(sizeof(btSphereBoxCollisionAlgorithm::CreateFunc),16);
m_boxSphereCF = new (mem)btSphereBoxCollisionAlgorithm::CreateFunc;
m_boxSphereCF->m_swapped = true;
#endif //USE_BUGGY_SPHERE_BOX_ALGORITHM
mem = btAlignedAlloc(sizeof(btSphereTriangleCollisionAlgorithm::CreateFunc),16);
m_sphereTriangleCF = new (mem)btSphereTriangleCollisionAlgorithm::CreateFunc;
mem = btAlignedAlloc(sizeof(btSphereTriangleCollisionAlgorithm::CreateFunc),16);
m_triangleSphereCF = new (mem)btSphereTriangleCollisionAlgorithm::CreateFunc;
m_triangleSphereCF->m_swapped = true;
mem = btAlignedAlloc(sizeof(btBoxBoxCollisionAlgorithm::CreateFunc),16);
m_boxBoxCF = new(mem)btBoxBoxCollisionAlgorithm::CreateFunc;
//convex versus plane
mem = btAlignedAlloc (sizeof(btConvexPlaneCollisionAlgorithm::CreateFunc),16);
m_convexPlaneCF = new (mem) btConvexPlaneCollisionAlgorithm::CreateFunc;
mem = btAlignedAlloc (sizeof(btConvexPlaneCollisionAlgorithm::CreateFunc),16);
m_planeConvexCF = new (mem) btConvexPlaneCollisionAlgorithm::CreateFunc;
m_planeConvexCF->m_swapped = true;
///calculate maximum element size, big enough to fit any collision algorithm in the memory pool
int maxSize = sizeof(btConvexConvexAlgorithm);
int maxSize2 = sizeof(btConvexConcaveCollisionAlgorithm);
int maxSize3 = sizeof(btCompoundCollisionAlgorithm);
int sl = sizeof(btConvexSeparatingDistanceUtil);
sl = sizeof(btGjkPairDetector);
int collisionAlgorithmMaxElementSize = btMax(maxSize,maxSize2);
collisionAlgorithmMaxElementSize = btMax(collisionAlgorithmMaxElementSize,maxSize3);
if (constructionInfo.m_stackAlloc)
{
m_ownsStackAllocator = false;
this->m_stackAlloc = constructionInfo.m_stackAlloc;
} else
{
m_ownsStackAllocator = true;
void* mem = btAlignedAlloc(sizeof(btStackAlloc),16);
m_stackAlloc = new(mem)btStackAlloc(constructionInfo.m_defaultStackAllocatorSize);
}
if (constructionInfo.m_persistentManifoldPool)
{
m_ownsPersistentManifoldPool = false;
m_persistentManifoldPool = constructionInfo.m_persistentManifoldPool;
} else
{
m_ownsPersistentManifoldPool = true;
void* mem = btAlignedAlloc(sizeof(btPoolAllocator),16);
m_persistentManifoldPool = new (mem) btPoolAllocator(sizeof(btPersistentManifold),constructionInfo.m_defaultMaxPersistentManifoldPoolSize);
}
if (constructionInfo.m_collisionAlgorithmPool)
{
m_ownsCollisionAlgorithmPool = false;
m_collisionAlgorithmPool = constructionInfo.m_collisionAlgorithmPool;
} else
{
m_ownsCollisionAlgorithmPool = true;
void* mem = btAlignedAlloc(sizeof(btPoolAllocator),16);
m_collisionAlgorithmPool = new(mem) btPoolAllocator(collisionAlgorithmMaxElementSize,constructionInfo.m_defaultMaxCollisionAlgorithmPoolSize);
}
//.........这里部分代码省略.........
开发者ID:Belxjander,项目名称:Asuna,代码行数:101,代码来源:btDefaultCollisionConfiguration.cpp
示例3: setTexturing
void ParticlesDemo::initPhysics()
{
setTexturing(false);
setShadows(false);
// setCameraDistance(80.f);
setCameraDistance(3.0f);
// m_cameraTargetPosition.setValue(50, 10, 0);
m_cameraTargetPosition.setValue(0, 0, 0);
// m_azi = btScalar(0.f);
// m_ele = btScalar(0.f);
m_azi = btScalar(45.f);
m_ele = btScalar(30.f);
setFrustumZPlanes(0.1f, 10.f);
///collision configuration contains default setup for memory, collision setup
btDefaultCollisionConstructionInfo dci;
dci.m_defaultMaxPersistentManifoldPoolSize=50000;
dci.m_defaultMaxCollisionAlgorithmPoolSize=50000;
m_collisionConfiguration = new btDefaultCollisionConfiguration(dci);
///use the default collision dispatcher. For parallel processing you can use a diffent dispatcher (see Extras/BulletMultiThreaded)
m_dispatcher = new btCollisionDispatcher(m_collisionConfiguration);
m_pairCache = new (btAlignedAlloc(sizeof(btHashedOverlappingPairCache),16))btHashedOverlappingPairCache();
// m_broadphase = new btDbvtBroadphase(m_pairCache);
m_broadphase = new btNullBroadphase();
///the default constraint solver
m_solver = new btSequentialImpulseConstraintSolver();
m_pWorld = new btParticlesDynamicsWorld(m_dispatcher,m_broadphase,m_solver,m_collisionConfiguration, 65536);
m_dialogDynamicsWorld = new GL_DialogDynamicsWorld();
GL_DialogWindow* settings = m_dialogDynamicsWorld->createDialog(50,0,280,280,"CPU fallback");
m_pWorld->m_useCpuControls[0] = 0;
GL_ToggleControl* ctrl = 0;
m_pWorld->m_useCpuControls[SIMSTAGE_INTEGRATE_MOTION] = m_dialogDynamicsWorld->createToggle(settings,"Integrate Motion");
m_pWorld->m_useCpuControls[SIMSTAGE_COMPUTE_CELL_ID] = m_dialogDynamicsWorld->createToggle(settings,"Compute Cell ID");
m_pWorld->m_useCpuControls[SIMSTAGE_SORT_CELL_ID] = m_dialogDynamicsWorld->createToggle(settings,"Sort Cell ID");
m_pWorld->m_useCpuControls[SIMSTAGE_FIND_CELL_START] = m_dialogDynamicsWorld->createToggle(settings,"Find Cell Start");
m_pWorld->m_useCpuControls[SIMSTAGE_COLLIDE_PARTICLES] = m_dialogDynamicsWorld->createToggle(settings,"Collide Particles");
for(int i = 1; i < SIMSTAGE_TOTAL; i++)
{
m_pWorld->m_useCpuControls[i]->m_active = false;
}
#if defined(CL_PLATFORM_MINI_CL)
// these kernels use barrier()
m_pWorld->m_useCpuControls[SIMSTAGE_SORT_CELL_ID]->m_active = true;
m_pWorld->m_useCpuControls[SIMSTAGE_FIND_CELL_START]->m_active = true;
#endif
// out of date
// m_pWorld->m_useCpuControls[SIMSTAGE_SORT_CELL_ID]->m_active = true;
//m_pWorld->m_useCpuControls[SIMSTAGE_FIND_CELL_START]->m_active = true;
m_dynamicsWorld = m_pWorld;
m_pWorld->getSimulationIslandManager()->setSplitIslands(true);
m_pWorld->setGravity(btVector3(0,-10.,0));
m_pWorld->getSolverInfo().m_numIterations = 4;
{
// btCollisionShape* colShape = new btSphereShape(btScalar(1.0f));
/*
btCollisionShape* colShape = new btSphereShape(DEF_PARTICLE_RADIUS);
m_collisionShapes.push_back(colShape);
btTransform startTransform;
startTransform.setIdentity();
btScalar mass(1.f);
btVector3 localInertia(0,0,0);
colShape->calculateLocalInertia(mass,localInertia);
float start_x = START_POS_X - ARRAY_SIZE_X * DIST * btScalar(0.5f);
float start_y = START_POS_Y - ARRAY_SIZE_Y * DIST * btScalar(0.5f);
float start_z = START_POS_Z - ARRAY_SIZE_Z * DIST * btScalar(0.5f);
startTransform.setOrigin(btVector3(start_x, start_y, start_z));
btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,0,colShape,localInertia);
rbInfo.m_startWorldTransform = startTransform;
btRigidBody* body = new btRigidBody(rbInfo);
m_pWorld->addRigidBody(body);
*/
init_scene_directly();
}
clientResetScene();
m_pWorld->initDeviceData();
}
开发者ID:LiamYao,项目名称:experiments,代码行数:96,代码来源:ParticlesDemo.cpp
示例4: plNewCylinderShape
plCollisionShapeHandle plNewCylinderShape(plReal radius, plReal height)
{
void* mem = btAlignedAlloc(sizeof(btCylinderShape),16);
return (plCollisionShapeHandle) new (mem)btCylinderShape(btVector3(radius,height,radius));
}
开发者ID:JinMyong,项目名称:Game_MatchEmUp,代码行数:5,代码来源:Bullet-C-API.cpp
示例5: plNewBulletSdk
plPhysicsSdkHandle plNewBulletSdk()
{
void* mem = btAlignedAlloc(sizeof(btPhysicsSdk),16);
return (plPhysicsSdkHandle)new (mem)btPhysicsSdk;
}
开发者ID:JinMyong,项目名称:Game_MatchEmUp,代码行数:5,代码来源:Bullet-C-API.cpp
示例6: new
btPairCachingGhostObject::btPairCachingGhostObject()
{
m_hashPairCache = new (btAlignedAlloc(sizeof(btHashedOverlappingPairCache),16)) btHashedOverlappingPairCache();
}
开发者ID:andemi02,项目名称:orkid,代码行数:4,代码来源:btGhostObject.cpp
示例7: plNewBoxShape
plCollisionShapeHandle plNewBoxShape(plReal x, plReal y, plReal z)
{
void* mem = btAlignedAlloc(sizeof(btBoxShape),16);
return (plCollisionShapeHandle) new (mem)btBoxShape(btVector3(x,y,z));
}
开发者ID:JinMyong,项目名称:Game_MatchEmUp,代码行数:5,代码来源:Bullet-C-API.cpp
示例8: pl_cylindershape_new
PlCylinderShape* pl_cylindershape_new(PlReal radius, PlReal height)
{
void* mem = btAlignedAlloc(sizeof(btCylinderShape),16);
return (PlCylinderShape*) new (mem)btCylinderShape(btVector3(radius,height,radius));
}
开发者ID:cessationoftime,项目名称:BulletVapi,代码行数:5,代码来源:Bullet-C-API.cpp
示例9: pl_convexhullshape_new
/* Convex Meshes */
PlConvexHullShape* pl_convexhullshape_new()
{
void* mem = btAlignedAlloc(sizeof(btConvexHullShape),16);
return (PlConvexHullShape*) new (mem)btConvexHullShape();
}
开发者ID:cessationoftime,项目名称:BulletVapi,代码行数:6,代码来源:Bullet-C-API.cpp
示例10: pl_boxshape_new
PlBoxShape* pl_boxshape_new(PlReal x, PlReal y, PlReal z)
{
void* mem = btAlignedAlloc(sizeof(btBoxShape),16);
return (PlBoxShape*) new (mem)btBoxShape(btVector3(x,y,z));
}
开发者ID:cessationoftime,项目名称:BulletVapi,代码行数:5,代码来源:Bullet-C-API.cpp
示例11: pl_coneshape_new
PlConeShape* pl_coneshape_new(PlReal radius, PlReal height)
{
void* mem = btAlignedAlloc(sizeof(btConeShape),16);
return (PlConeShape*) new (mem)btConeShape(radius,height);
}
开发者ID:cessationoftime,项目名称:BulletVapi,代码行数:5,代码来源:Bullet-C-API.cpp
示例12: pl_sphereshape_new
PlSphereShape* pl_sphereshape_new(PlReal radius)
{
void* mem = btAlignedAlloc(sizeof(btSphereShape),16);
return (PlSphereShape*) new (mem)btSphereShape(radius);
}
开发者ID:cessationoftime,项目名称:BulletVapi,代码行数:6,代码来源:Bullet-C-API.cpp
示例13: pl_physicssdk_new
PlPhysicsSdk* pl_physicssdk_new()
{
void* mem = btAlignedAlloc(sizeof(btPhysicsSdk),16);
return (PlPhysicsSdk*)new (mem)btPhysicsSdk;
}
开发者ID:cessationoftime,项目名称:BulletVapi,代码行数:5,代码来源:Bullet-C-API.cpp
示例14: pl_quaternion_new
PlQuaternion* pl_quaternion_new()
{
PlQuaternion* mem = (PlQuaternion*)(btAlignedAlloc(4 * sizeof(PlReal),16));
return (PlQuaternion*)mem;
}
开发者ID:cessationoftime,项目名称:BulletVapi,代码行数:5,代码来源:Bullet-C-API.cpp
示例15: setTexturing
//.........这里部分代码省略.........
gIndices[index++] = (j+1)*NUM_VERTS_X+i+1;
gIndices[index++] = j*NUM_VERTS_X+i;
gIndices[index++] = (j+1)*NUM_VERTS_X+i+1;
gIndices[index++] = (j+1)*NUM_VERTS_X+i;
#endif //SHIFT_INDICES
#endif //SWAP_WINDING
}
}
m_indexVertexArrays = new btTriangleIndexVertexArray(totalTriangles,
gIndices,
indexStride,
totalVerts,(btScalar*) &gVertices[0].x(),vertStride);
bool useQuantizedAabbCompression = true;
//comment out the next line to read the BVH from disk (first run the demo once to create the BVH)
#define SERIALIZE_TO_DISK 1
#ifdef SERIALIZE_TO_DISK
btVector3 aabbMin(-1000,-1000,-1000),aabbMax(1000,1000,1000);
trimeshShape = new btBvhTriangleMeshShape(m_indexVertexArrays,useQuantizedAabbCompression,aabbMin,aabbMax);
m_collisionShapes.push_back(trimeshShape);
///we can serialize the BVH data
void* buffer = 0;
int numBytes = trimeshShape->getOptimizedBvh()->calculateSerializeBufferSize();
buffer = btAlignedAlloc(numBytes,16);
bool swapEndian = false;
trimeshShape->getOptimizedBvh()->serialize(buffer,numBytes,swapEndian);
#ifdef __QNX__
FILE* file = fopen("app/native/bvh.bin","wb");
#else
FILE* file = fopen("bvh.bin","wb");
#endif
fwrite(buffer,1,numBytes,file);
fclose(file);
btAlignedFree(buffer);
#else
trimeshShape = new btBvhTriangleMeshShape(m_indexVertexArrays,useQuantizedAabbCompression,false);
char* fileName = "bvh.bin";
#ifdef __QNX__
char* fileName = "app/native/bvh.bin";
#else
char* fileName = "bvh.bin";
#endif
int size=0;
btOptimizedBvh* bvh = 0;
if (fseek(file, 0, SEEK_END) || (size = ftell(file)) == EOF || fseek(file, 0, SEEK_SET)) { /* File operations denied? ok, just close and return failure */
printf("Error: cannot get filesize from %s\n", fileName);
exit(0);
} else
{
开发者ID:Bredoto,项目名称:Bullet,代码行数:67,代码来源:InternalEdgeDemo.cpp
示例16: pl_compoundshape_new
PlCompoundShape* pl_compoundshape_new()
{
void* mem = btAlignedAlloc(sizeof(btCompoundShape),16);
return (PlCompoundShape*) new (mem)btCompoundShape();
}
开发者ID:cessationoftime,项目名称:BulletVapi,代码行数:5,代码来源:Bullet-C-API.cpp
示例17: createTriangleMeshContainer
btTriangleIndexVertexArray* btCollisionWorldImporter::createMeshInterface(btStridingMeshInterfaceData& meshData)
{
btTriangleIndexVertexArray* meshInterface = createTriangleMeshContainer();
for (int i=0;i<meshData.m_numMeshParts;i++)
{
btIndexedMesh meshPart;
meshPart.m_numTriangles = meshData.m_meshPartsPtr[i].m_numTriangles;
meshPart.m_numVertices = meshData.m_meshPartsPtr[i].m_numVertices;
if (meshData.m_meshPartsPtr[i].m_indices32)
{
meshPart.m_indexType = PHY_INTEGER;
meshPart.m_triangleIndexStride = 3*sizeof(int);
int* indexArray = (int*)btAlignedAlloc(sizeof(int)*3*meshPart.m_numTriangles,16);
m_indexArrays.push_back(indexArray);
for (int j=0;j<3*meshPart.m_numTriangles;j++)
{
indexArray[j] = meshData.m_meshPartsPtr[i].m_indices32[j].m_value;
}
meshPart.m_triangleIndexBase = (const unsigned char*)indexArray;
} else
{
if (meshData.m_meshPartsPtr[i].m_3indices16)
{
meshPart.m_indexType = PHY_SHORT;
meshPart.m_triangleIndexStride = sizeof(short int)*3;//sizeof(btShortIntIndexTripletData);
short int* indexArray = (short int*)btAlignedAlloc(sizeof(short int)*3*meshPart.m_numTriangles,16);
m_shortIndexArrays.push_back(indexArray);
for (int j=0;j<meshPart.m_numTriangles;j++)
{
indexArray[3*j] = meshData.m_meshPartsPtr[i].m_3indices16[j].m_values[0];
indexArray[3*j+1] = meshData.m_meshPartsPtr[i].m_3indices16[j].m_values[1];
indexArray[3*j+2] = meshData.m_meshPartsPtr[i].m_3indices16[j].m_values[2];
}
meshPart.m_triangleIndexBase = (const unsigned char*)indexArray;
}
if (meshData.m_meshPartsPtr[i].m_indices16)
{
meshPart.m_indexType = PHY_SHORT;
meshPart.m_triangleIndexStride = 3*sizeof(short int);
short int* indexArray = (short int*)btAlignedAlloc(sizeof(short int)*3*meshPart.m_numTriangles,16);
m_shortIndexArrays.push_back(indexArray);
for (int j=0;j<3*meshPart.m_numTriangles;j++)
{
indexArray[j] = meshData.m_meshPartsPtr[i].m_indices16[j].m_value;
}
meshPart.m_triangleIndexBase = (const unsigned char*)indexArray;
}
if (meshData.m_meshPartsPtr[i].m_3indices8)
{
meshPart.m_indexType = PHY_UCHAR;
meshPart.m_triangleIndexStride = sizeof(unsigned char)*3;
unsigned char* indexArray = (unsigned char*)btAlignedAlloc(sizeof(unsigned char)*3*meshPart.m_numTriangles,16);
m_charIndexArrays.push_back(indexArray);
for (int j=0;j<meshPart.m_numTriangles;j++)
{
indexArray[3*j] = meshData.m_meshPartsPtr[i].m_3indices8[j].m_values[0];
indexArray[3*j+1] = meshData.m_meshPartsPtr[i].m_3indices8[j].m_values[1];
indexArray[3*j+2] = meshData.m_meshPartsPtr[i].m_3indices8[j].m_values[2];
}
meshPart.m_triangleIndexBase = (const unsigned char*)indexArray;
}
}
if (meshData.m_meshPartsPtr[i].m_vertices3f)
{
meshPart.m_vertexType = PHY_FLOAT;
meshPart.m_vertexStride = sizeof(btVector3FloatData);
btVector3FloatData* vertices = (btVector3FloatData*) btAlignedAlloc(sizeof(btVector3FloatData)*meshPart.m_numVertices,16);
m_floatVertexArrays.push_back(vertices);
for (int j=0;j<meshPart.m_numVertices;j++)
{
vertices[j].m_floats[0] = meshData.m_meshPartsPtr[i].m_vertices3f[j].m_floats[0];
vertices[j].m_floats[1] = meshData.m_meshPartsPtr[i].m_vertices3f[j].m_floats[1];
vertices[j].m_floats[2] = meshData.m_meshPartsPtr[i].m_vertices3f[j].m_floats[2];
vertices[j].m_floats[3] = meshData.m_meshPartsPtr[i].m_vertices3f[j].m_floats[3];
}
meshPart.m_vertexBase = (const unsigned char*)vertices;
} else
{
meshPart.m_vertexType = PHY_DOUBLE;
meshPart.m_vertexStride = sizeof(btVector3DoubleData);
btVector3DoubleData* vertices = (btVector3DoubleData*) btAlignedAlloc(sizeof(btVector3DoubleData)*meshPart.m_numVertices,16);
m_doubleVertexArrays.push_back(vertices);
for (int j=0;j<meshPart.m_numVertices;j++)
{
//.........这里部分代码省略.........
开发者ID:M3237-CPP,项目名称:Deep-Space-Deathmatch,代码行数:101,代码来源:btCollisionWorldImporter.cpp
示例18: pl_vector3_new
PlVector3* pl_vector3_new()
{
PlVector3* mem = (PlVector3*)(btAlignedAlloc(3 * sizeof(PlReal),16));
return mem;
}
开发者ID:cessationoftime,项目名称:BulletVapi,代码行数:6,代码来源:Bullet-C-API.cpp
示例19: plNewSphereShape
plCollisionShapeHandle plNewSphereShape(plReal radius)
{
void* mem = btAlignedAlloc(sizeof(btSphereShape),16);
return (plCollisionShapeHandle) new (mem)btSphereShape(radius);
}
开发者ID:JinMyong,项目名称:Game_MatchEmUp,代码行数:6,代码来源:Bullet-C-API.cpp
示例20: processOverlap
virtual bool processOverlap(btBroadphasePair& collisionPair)
{
//PPU version
//(*m_dispatcher->getNearCallback())(collisionPair,*m_dispatcher,m_dispatchInfo);
//only support discrete collision detection for now, we could fallback on PPU/unoptimized version for TOI/CCD
btAssert(m_dispatchInfo.m_dispatchFunc == btDispatcherInfo::DISPATCH_DISCRETE);
//by default, Bullet will use this near callback
{
///userInfo is used to determine if the SPU has to handle this case or not (skip PPU tasks)
if (!collisionPair.m_internalTmpValue)
{
collisionPair.m_internalTmpValue = 1;
}
if (!collisionPair.m_algorithm)
{
btCollisionObject* colObj0 = (btCollisionObject*)collisionPair.m_pProxy0->m_clientObject;
btCollisionObject* colObj1 = (btCollisionObject*)collisionPair.m_pProxy1->m_clientObject;
btCollisionAlgorithmConstructionInfo ci;
ci.m_dispatcher1 = m_dispatcher;
ci.m_manifold = 0;
if (m_dispatcher->needsCollision(colObj0,colObj1))
{
int proxyType0 = colObj0->getCollisionShape()->getShapeType();
int proxyType1 = colObj1->getCollisionShape()->getShapeType();
bool supportsSpuDispatch = m_dispatcher->supportsDispatchPairOnSpu(proxyType0,proxyType1)
&& (colObj0->getCollisionFlags() != btCollisionObject::CF_DISABLE_SPU_COLLISION_PROCESSING)
&& (colObj1->getCollisionFlags() != btCollisionObject::CF_DISABLE_SPU_COLLISION_PROCESSING);
if (proxyType0 == COMPOUND_SHAPE_PROXYTYPE)
{
btCompoundShape* compound = (btCompoundShape*)colObj0->getCollisionShape();
if (compound->getNumChildShapes()>MAX_SPU_COMPOUND_SUBSHAPES)
{
//printf("PPU fallback, compound->getNumChildShapes(%d)>%d\n",compound->getNumChildShapes(),MAX_SPU_COMPOUND_SUBSHAPES);
supportsSpuDispatch = false;
}
}
if (proxyType1 == COMPOUND_SHAPE_PROXYTYPE)
{
btCompoundShape* compound = (btCompoundShape*)colObj1->getCollisionShape();
if (compound->getNumChildShapes()>MAX_SPU_COMPOUND_SUBSHAPES)
{
//printf("PPU fallback, compound->getNumChildShapes(%d)>%d\n",compound->getNumChildShapes(),MAX_SPU_COMPOUND_SUBSHAPES);
supportsSpuDispatch = false;
}
}
if (supportsSpuDispatch)
{
int so = sizeof(SpuContactManifoldCollisionAlgorithm);
#ifdef ALLOCATE_SEPARATELY
void* mem = btAlignedAlloc(so,16);//m_dispatcher->allocateCollisionAlgorithm(so);
#else
void* mem = m_dispatcher->allocateCollisionAlgorithm(so);
#endif
collisionPair.m_algorithm = new(mem) SpuContactManifoldCollisionAlgorithm(ci,colObj0,colObj1);
collisionPair.m_internalTmpValue = 2;
} else
{
collisionPair.m_algorithm = m_dispatcher->findAlgorithm(colObj0,colObj1);
collisionPair.m_internalTmpValue = 3;
}
}
}
}
return false;
}
开发者ID:jakekrish98,项目名称:bullet-physics,代码行数:75,代码来源:SpuGatheringCollisionDispatcher.cpp
注:本文中的btAlignedAlloc函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论