diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-11-05 09:25:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-05 09:25:33 +0100 |
commit | a89fa34c21103430b1d140ee04c3ae6a433d77ce (patch) | |
tree | 9ecfb36702c2044937c2063f4ef09da62bd7ca1f /thirdparty/bullet/src/Bullet3Collision/NarrowPhaseCollision/shared/b3UpdateAabbs.h | |
parent | f7a41c1e309226bd0deb6381e71a5ce005cbe4ef (diff) | |
parent | fb4871c919571d719d27738cc4d7db496a575b57 (diff) |
Merge pull request #12641 from AndreaCatania/bullet
Bullet physics wrapper
Diffstat (limited to 'thirdparty/bullet/src/Bullet3Collision/NarrowPhaseCollision/shared/b3UpdateAabbs.h')
-rw-r--r-- | thirdparty/bullet/src/Bullet3Collision/NarrowPhaseCollision/shared/b3UpdateAabbs.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/thirdparty/bullet/src/Bullet3Collision/NarrowPhaseCollision/shared/b3UpdateAabbs.h b/thirdparty/bullet/src/Bullet3Collision/NarrowPhaseCollision/shared/b3UpdateAabbs.h new file mode 100644 index 0000000000..8d40d19a03 --- /dev/null +++ b/thirdparty/bullet/src/Bullet3Collision/NarrowPhaseCollision/shared/b3UpdateAabbs.h @@ -0,0 +1,40 @@ +#ifndef B3_UPDATE_AABBS_H +#define B3_UPDATE_AABBS_H + + + +#include "Bullet3Collision/BroadPhaseCollision/shared/b3Aabb.h" +#include "Bullet3Collision/NarrowPhaseCollision/shared/b3Collidable.h" +#include "Bullet3Collision/NarrowPhaseCollision/shared/b3RigidBodyData.h" + + + +void b3ComputeWorldAabb( int bodyId, __global const b3RigidBodyData_t* bodies, __global const b3Collidable_t* collidables, __global const b3Aabb_t* localShapeAABB, __global b3Aabb_t* worldAabbs) +{ + __global const b3RigidBodyData_t* body = &bodies[bodyId]; + + b3Float4 position = body->m_pos; + b3Quat orientation = body->m_quat; + + int collidableIndex = body->m_collidableIdx; + int shapeIndex = collidables[collidableIndex].m_shapeIndex; + + if (shapeIndex>=0) + { + + b3Aabb_t localAabb = localShapeAABB[collidableIndex]; + b3Aabb_t worldAabb; + + b3Float4 aabbAMinOut,aabbAMaxOut; + float margin = 0.f; + b3TransformAabb2(localAabb.m_minVec,localAabb.m_maxVec,margin,position,orientation,&aabbAMinOut,&aabbAMaxOut); + + worldAabb.m_minVec =aabbAMinOut; + worldAabb.m_minIndices[3] = bodyId; + worldAabb.m_maxVec = aabbAMaxOut; + worldAabb.m_signedMaxIndices[3] = body[bodyId].m_invMass==0.f? 0 : 1; + worldAabbs[bodyId] = worldAabb; + } +} + +#endif //B3_UPDATE_AABBS_H |