updateAabbsKernel.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. //this file is autogenerated using stringify.bat (premake --stringify) in the build folder of this project
  2. static const char* updateAabbsKernelCL= \
  3. "#ifndef B3_UPDATE_AABBS_H\n"
  4. "#define B3_UPDATE_AABBS_H\n"
  5. "#ifndef B3_AABB_H\n"
  6. "#define B3_AABB_H\n"
  7. "#ifndef B3_FLOAT4_H\n"
  8. "#define B3_FLOAT4_H\n"
  9. "#ifndef B3_PLATFORM_DEFINITIONS_H\n"
  10. "#define B3_PLATFORM_DEFINITIONS_H\n"
  11. "struct MyTest\n"
  12. "{\n"
  13. " int bla;\n"
  14. "};\n"
  15. "#ifdef __cplusplus\n"
  16. "#else\n"
  17. "//keep B3_LARGE_FLOAT*B3_LARGE_FLOAT < FLT_MAX\n"
  18. "#define B3_LARGE_FLOAT 1e18f\n"
  19. "#define B3_INFINITY 1e18f\n"
  20. "#define b3Assert(a)\n"
  21. "#define b3ConstArray(a) __global const a*\n"
  22. "#define b3AtomicInc atomic_inc\n"
  23. "#define b3AtomicAdd atomic_add\n"
  24. "#define b3Fabs fabs\n"
  25. "#define b3Sqrt native_sqrt\n"
  26. "#define b3Sin native_sin\n"
  27. "#define b3Cos native_cos\n"
  28. "#endif\n"
  29. "#endif\n"
  30. "#ifdef __cplusplus\n"
  31. "#else\n"
  32. " typedef float4 b3Float4;\n"
  33. " #define b3Float4ConstArg const b3Float4\n"
  34. " #define b3MakeFloat4 (float4)\n"
  35. " float b3Dot3F4(b3Float4ConstArg v0,b3Float4ConstArg v1)\n"
  36. " {\n"
  37. " float4 a1 = b3MakeFloat4(v0.xyz,0.f);\n"
  38. " float4 b1 = b3MakeFloat4(v1.xyz,0.f);\n"
  39. " return dot(a1, b1);\n"
  40. " }\n"
  41. " b3Float4 b3Cross3(b3Float4ConstArg v0,b3Float4ConstArg v1)\n"
  42. " {\n"
  43. " float4 a1 = b3MakeFloat4(v0.xyz,0.f);\n"
  44. " float4 b1 = b3MakeFloat4(v1.xyz,0.f);\n"
  45. " return cross(a1, b1);\n"
  46. " }\n"
  47. " #define b3MinFloat4 min\n"
  48. " #define b3MaxFloat4 max\n"
  49. " #define b3Normalized(a) normalize(a)\n"
  50. "#endif \n"
  51. " \n"
  52. "inline bool b3IsAlmostZero(b3Float4ConstArg v)\n"
  53. "{\n"
  54. " if(b3Fabs(v.x)>1e-6 || b3Fabs(v.y)>1e-6 || b3Fabs(v.z)>1e-6) \n"
  55. " return false;\n"
  56. " return true;\n"
  57. "}\n"
  58. "inline int b3MaxDot( b3Float4ConstArg vec, __global const b3Float4* vecArray, int vecLen, float* dotOut )\n"
  59. "{\n"
  60. " float maxDot = -B3_INFINITY;\n"
  61. " int i = 0;\n"
  62. " int ptIndex = -1;\n"
  63. " for( i = 0; i < vecLen; i++ )\n"
  64. " {\n"
  65. " float dot = b3Dot3F4(vecArray[i],vec);\n"
  66. " \n"
  67. " if( dot > maxDot )\n"
  68. " {\n"
  69. " maxDot = dot;\n"
  70. " ptIndex = i;\n"
  71. " }\n"
  72. " }\n"
  73. " b3Assert(ptIndex>=0);\n"
  74. " if (ptIndex<0)\n"
  75. " {\n"
  76. " ptIndex = 0;\n"
  77. " }\n"
  78. " *dotOut = maxDot;\n"
  79. " return ptIndex;\n"
  80. "}\n"
  81. "#endif //B3_FLOAT4_H\n"
  82. "#ifndef B3_MAT3x3_H\n"
  83. "#define B3_MAT3x3_H\n"
  84. "#ifndef B3_QUAT_H\n"
  85. "#define B3_QUAT_H\n"
  86. "#ifndef B3_PLATFORM_DEFINITIONS_H\n"
  87. "#ifdef __cplusplus\n"
  88. "#else\n"
  89. "#endif\n"
  90. "#endif\n"
  91. "#ifndef B3_FLOAT4_H\n"
  92. "#ifdef __cplusplus\n"
  93. "#else\n"
  94. "#endif \n"
  95. "#endif //B3_FLOAT4_H\n"
  96. "#ifdef __cplusplus\n"
  97. "#else\n"
  98. " typedef float4 b3Quat;\n"
  99. " #define b3QuatConstArg const b3Quat\n"
  100. " \n"
  101. " \n"
  102. "inline float4 b3FastNormalize4(float4 v)\n"
  103. "{\n"
  104. " v = (float4)(v.xyz,0.f);\n"
  105. " return fast_normalize(v);\n"
  106. "}\n"
  107. " \n"
  108. "inline b3Quat b3QuatMul(b3Quat a, b3Quat b);\n"
  109. "inline b3Quat b3QuatNormalized(b3QuatConstArg in);\n"
  110. "inline b3Quat b3QuatRotate(b3QuatConstArg q, b3QuatConstArg vec);\n"
  111. "inline b3Quat b3QuatInvert(b3QuatConstArg q);\n"
  112. "inline b3Quat b3QuatInverse(b3QuatConstArg q);\n"
  113. "inline b3Quat b3QuatMul(b3QuatConstArg a, b3QuatConstArg b)\n"
  114. "{\n"
  115. " b3Quat ans;\n"
  116. " ans = b3Cross3( a, b );\n"
  117. " ans += a.w*b+b.w*a;\n"
  118. "// ans.w = a.w*b.w - (a.x*b.x+a.y*b.y+a.z*b.z);\n"
  119. " ans.w = a.w*b.w - b3Dot3F4(a, b);\n"
  120. " return ans;\n"
  121. "}\n"
  122. "inline b3Quat b3QuatNormalized(b3QuatConstArg in)\n"
  123. "{\n"
  124. " b3Quat q;\n"
  125. " q=in;\n"
  126. " //return b3FastNormalize4(in);\n"
  127. " float len = native_sqrt(dot(q, q));\n"
  128. " if(len > 0.f)\n"
  129. " {\n"
  130. " q *= 1.f / len;\n"
  131. " }\n"
  132. " else\n"
  133. " {\n"
  134. " q.x = q.y = q.z = 0.f;\n"
  135. " q.w = 1.f;\n"
  136. " }\n"
  137. " return q;\n"
  138. "}\n"
  139. "inline float4 b3QuatRotate(b3QuatConstArg q, b3QuatConstArg vec)\n"
  140. "{\n"
  141. " b3Quat qInv = b3QuatInvert( q );\n"
  142. " float4 vcpy = vec;\n"
  143. " vcpy.w = 0.f;\n"
  144. " float4 out = b3QuatMul(b3QuatMul(q,vcpy),qInv);\n"
  145. " return out;\n"
  146. "}\n"
  147. "inline b3Quat b3QuatInverse(b3QuatConstArg q)\n"
  148. "{\n"
  149. " return (b3Quat)(-q.xyz, q.w);\n"
  150. "}\n"
  151. "inline b3Quat b3QuatInvert(b3QuatConstArg q)\n"
  152. "{\n"
  153. " return (b3Quat)(-q.xyz, q.w);\n"
  154. "}\n"
  155. "inline float4 b3QuatInvRotate(b3QuatConstArg q, b3QuatConstArg vec)\n"
  156. "{\n"
  157. " return b3QuatRotate( b3QuatInvert( q ), vec );\n"
  158. "}\n"
  159. "inline b3Float4 b3TransformPoint(b3Float4ConstArg point, b3Float4ConstArg translation, b3QuatConstArg orientation)\n"
  160. "{\n"
  161. " return b3QuatRotate( orientation, point ) + (translation);\n"
  162. "}\n"
  163. " \n"
  164. "#endif \n"
  165. "#endif //B3_QUAT_H\n"
  166. "#ifdef __cplusplus\n"
  167. "#else\n"
  168. "typedef struct\n"
  169. "{\n"
  170. " b3Float4 m_row[3];\n"
  171. "}b3Mat3x3;\n"
  172. "#define b3Mat3x3ConstArg const b3Mat3x3\n"
  173. "#define b3GetRow(m,row) (m.m_row[row])\n"
  174. "inline b3Mat3x3 b3QuatGetRotationMatrix(b3Quat quat)\n"
  175. "{\n"
  176. " b3Float4 quat2 = (b3Float4)(quat.x*quat.x, quat.y*quat.y, quat.z*quat.z, 0.f);\n"
  177. " b3Mat3x3 out;\n"
  178. " out.m_row[0].x=1-2*quat2.y-2*quat2.z;\n"
  179. " out.m_row[0].y=2*quat.x*quat.y-2*quat.w*quat.z;\n"
  180. " out.m_row[0].z=2*quat.x*quat.z+2*quat.w*quat.y;\n"
  181. " out.m_row[0].w = 0.f;\n"
  182. " out.m_row[1].x=2*quat.x*quat.y+2*quat.w*quat.z;\n"
  183. " out.m_row[1].y=1-2*quat2.x-2*quat2.z;\n"
  184. " out.m_row[1].z=2*quat.y*quat.z-2*quat.w*quat.x;\n"
  185. " out.m_row[1].w = 0.f;\n"
  186. " out.m_row[2].x=2*quat.x*quat.z-2*quat.w*quat.y;\n"
  187. " out.m_row[2].y=2*quat.y*quat.z+2*quat.w*quat.x;\n"
  188. " out.m_row[2].z=1-2*quat2.x-2*quat2.y;\n"
  189. " out.m_row[2].w = 0.f;\n"
  190. " return out;\n"
  191. "}\n"
  192. "inline b3Mat3x3 b3AbsoluteMat3x3(b3Mat3x3ConstArg matIn)\n"
  193. "{\n"
  194. " b3Mat3x3 out;\n"
  195. " out.m_row[0] = fabs(matIn.m_row[0]);\n"
  196. " out.m_row[1] = fabs(matIn.m_row[1]);\n"
  197. " out.m_row[2] = fabs(matIn.m_row[2]);\n"
  198. " return out;\n"
  199. "}\n"
  200. "__inline\n"
  201. "b3Mat3x3 mtZero();\n"
  202. "__inline\n"
  203. "b3Mat3x3 mtIdentity();\n"
  204. "__inline\n"
  205. "b3Mat3x3 mtTranspose(b3Mat3x3 m);\n"
  206. "__inline\n"
  207. "b3Mat3x3 mtMul(b3Mat3x3 a, b3Mat3x3 b);\n"
  208. "__inline\n"
  209. "b3Float4 mtMul1(b3Mat3x3 a, b3Float4 b);\n"
  210. "__inline\n"
  211. "b3Float4 mtMul3(b3Float4 a, b3Mat3x3 b);\n"
  212. "__inline\n"
  213. "b3Mat3x3 mtZero()\n"
  214. "{\n"
  215. " b3Mat3x3 m;\n"
  216. " m.m_row[0] = (b3Float4)(0.f);\n"
  217. " m.m_row[1] = (b3Float4)(0.f);\n"
  218. " m.m_row[2] = (b3Float4)(0.f);\n"
  219. " return m;\n"
  220. "}\n"
  221. "__inline\n"
  222. "b3Mat3x3 mtIdentity()\n"
  223. "{\n"
  224. " b3Mat3x3 m;\n"
  225. " m.m_row[0] = (b3Float4)(1,0,0,0);\n"
  226. " m.m_row[1] = (b3Float4)(0,1,0,0);\n"
  227. " m.m_row[2] = (b3Float4)(0,0,1,0);\n"
  228. " return m;\n"
  229. "}\n"
  230. "__inline\n"
  231. "b3Mat3x3 mtTranspose(b3Mat3x3 m)\n"
  232. "{\n"
  233. " b3Mat3x3 out;\n"
  234. " out.m_row[0] = (b3Float4)(m.m_row[0].x, m.m_row[1].x, m.m_row[2].x, 0.f);\n"
  235. " out.m_row[1] = (b3Float4)(m.m_row[0].y, m.m_row[1].y, m.m_row[2].y, 0.f);\n"
  236. " out.m_row[2] = (b3Float4)(m.m_row[0].z, m.m_row[1].z, m.m_row[2].z, 0.f);\n"
  237. " return out;\n"
  238. "}\n"
  239. "__inline\n"
  240. "b3Mat3x3 mtMul(b3Mat3x3 a, b3Mat3x3 b)\n"
  241. "{\n"
  242. " b3Mat3x3 transB;\n"
  243. " transB = mtTranspose( b );\n"
  244. " b3Mat3x3 ans;\n"
  245. " // why this doesn't run when 0ing in the for{}\n"
  246. " a.m_row[0].w = 0.f;\n"
  247. " a.m_row[1].w = 0.f;\n"
  248. " a.m_row[2].w = 0.f;\n"
  249. " for(int i=0; i<3; i++)\n"
  250. " {\n"
  251. "// a.m_row[i].w = 0.f;\n"
  252. " ans.m_row[i].x = b3Dot3F4(a.m_row[i],transB.m_row[0]);\n"
  253. " ans.m_row[i].y = b3Dot3F4(a.m_row[i],transB.m_row[1]);\n"
  254. " ans.m_row[i].z = b3Dot3F4(a.m_row[i],transB.m_row[2]);\n"
  255. " ans.m_row[i].w = 0.f;\n"
  256. " }\n"
  257. " return ans;\n"
  258. "}\n"
  259. "__inline\n"
  260. "b3Float4 mtMul1(b3Mat3x3 a, b3Float4 b)\n"
  261. "{\n"
  262. " b3Float4 ans;\n"
  263. " ans.x = b3Dot3F4( a.m_row[0], b );\n"
  264. " ans.y = b3Dot3F4( a.m_row[1], b );\n"
  265. " ans.z = b3Dot3F4( a.m_row[2], b );\n"
  266. " ans.w = 0.f;\n"
  267. " return ans;\n"
  268. "}\n"
  269. "__inline\n"
  270. "b3Float4 mtMul3(b3Float4 a, b3Mat3x3 b)\n"
  271. "{\n"
  272. " b3Float4 colx = b3MakeFloat4(b.m_row[0].x, b.m_row[1].x, b.m_row[2].x, 0);\n"
  273. " b3Float4 coly = b3MakeFloat4(b.m_row[0].y, b.m_row[1].y, b.m_row[2].y, 0);\n"
  274. " b3Float4 colz = b3MakeFloat4(b.m_row[0].z, b.m_row[1].z, b.m_row[2].z, 0);\n"
  275. " b3Float4 ans;\n"
  276. " ans.x = b3Dot3F4( a, colx );\n"
  277. " ans.y = b3Dot3F4( a, coly );\n"
  278. " ans.z = b3Dot3F4( a, colz );\n"
  279. " return ans;\n"
  280. "}\n"
  281. "#endif\n"
  282. "#endif //B3_MAT3x3_H\n"
  283. "typedef struct b3Aabb b3Aabb_t;\n"
  284. "struct b3Aabb\n"
  285. "{\n"
  286. " union\n"
  287. " {\n"
  288. " float m_min[4];\n"
  289. " b3Float4 m_minVec;\n"
  290. " int m_minIndices[4];\n"
  291. " };\n"
  292. " union\n"
  293. " {\n"
  294. " float m_max[4];\n"
  295. " b3Float4 m_maxVec;\n"
  296. " int m_signedMaxIndices[4];\n"
  297. " };\n"
  298. "};\n"
  299. "inline void b3TransformAabb2(b3Float4ConstArg localAabbMin,b3Float4ConstArg localAabbMax, float margin,\n"
  300. " b3Float4ConstArg pos,\n"
  301. " b3QuatConstArg orn,\n"
  302. " b3Float4* aabbMinOut,b3Float4* aabbMaxOut)\n"
  303. "{\n"
  304. " b3Float4 localHalfExtents = 0.5f*(localAabbMax-localAabbMin);\n"
  305. " localHalfExtents+=b3MakeFloat4(margin,margin,margin,0.f);\n"
  306. " b3Float4 localCenter = 0.5f*(localAabbMax+localAabbMin);\n"
  307. " b3Mat3x3 m;\n"
  308. " m = b3QuatGetRotationMatrix(orn);\n"
  309. " b3Mat3x3 abs_b = b3AbsoluteMat3x3(m);\n"
  310. " b3Float4 center = b3TransformPoint(localCenter,pos,orn);\n"
  311. " \n"
  312. " b3Float4 extent = b3MakeFloat4(b3Dot3F4(localHalfExtents,b3GetRow(abs_b,0)),\n"
  313. " b3Dot3F4(localHalfExtents,b3GetRow(abs_b,1)),\n"
  314. " b3Dot3F4(localHalfExtents,b3GetRow(abs_b,2)),\n"
  315. " 0.f);\n"
  316. " *aabbMinOut = center-extent;\n"
  317. " *aabbMaxOut = center+extent;\n"
  318. "}\n"
  319. "/// conservative test for overlap between two aabbs\n"
  320. "inline bool b3TestAabbAgainstAabb(b3Float4ConstArg aabbMin1,b3Float4ConstArg aabbMax1,\n"
  321. " b3Float4ConstArg aabbMin2, b3Float4ConstArg aabbMax2)\n"
  322. "{\n"
  323. " bool overlap = true;\n"
  324. " overlap = (aabbMin1.x > aabbMax2.x || aabbMax1.x < aabbMin2.x) ? false : overlap;\n"
  325. " overlap = (aabbMin1.z > aabbMax2.z || aabbMax1.z < aabbMin2.z) ? false : overlap;\n"
  326. " overlap = (aabbMin1.y > aabbMax2.y || aabbMax1.y < aabbMin2.y) ? false : overlap;\n"
  327. " return overlap;\n"
  328. "}\n"
  329. "#endif //B3_AABB_H\n"
  330. "#ifndef B3_COLLIDABLE_H\n"
  331. "#define B3_COLLIDABLE_H\n"
  332. "#ifndef B3_FLOAT4_H\n"
  333. "#ifdef __cplusplus\n"
  334. "#else\n"
  335. "#endif \n"
  336. "#endif //B3_FLOAT4_H\n"
  337. "#ifndef B3_QUAT_H\n"
  338. "#ifdef __cplusplus\n"
  339. "#else\n"
  340. "#endif \n"
  341. "#endif //B3_QUAT_H\n"
  342. "enum b3ShapeTypes\n"
  343. "{\n"
  344. " SHAPE_HEIGHT_FIELD=1,\n"
  345. " SHAPE_CONVEX_HULL=3,\n"
  346. " SHAPE_PLANE=4,\n"
  347. " SHAPE_CONCAVE_TRIMESH=5,\n"
  348. " SHAPE_COMPOUND_OF_CONVEX_HULLS=6,\n"
  349. " SHAPE_SPHERE=7,\n"
  350. " MAX_NUM_SHAPE_TYPES,\n"
  351. "};\n"
  352. "typedef struct b3Collidable b3Collidable_t;\n"
  353. "struct b3Collidable\n"
  354. "{\n"
  355. " union {\n"
  356. " int m_numChildShapes;\n"
  357. " int m_bvhIndex;\n"
  358. " };\n"
  359. " union\n"
  360. " {\n"
  361. " float m_radius;\n"
  362. " int m_compoundBvhIndex;\n"
  363. " };\n"
  364. " int m_shapeType;\n"
  365. " int m_shapeIndex;\n"
  366. "};\n"
  367. "typedef struct b3GpuChildShape b3GpuChildShape_t;\n"
  368. "struct b3GpuChildShape\n"
  369. "{\n"
  370. " b3Float4 m_childPosition;\n"
  371. " b3Quat m_childOrientation;\n"
  372. " int m_shapeIndex;\n"
  373. " int m_unused0;\n"
  374. " int m_unused1;\n"
  375. " int m_unused2;\n"
  376. "};\n"
  377. "struct b3CompoundOverlappingPair\n"
  378. "{\n"
  379. " int m_bodyIndexA;\n"
  380. " int m_bodyIndexB;\n"
  381. "// int m_pairType;\n"
  382. " int m_childShapeIndexA;\n"
  383. " int m_childShapeIndexB;\n"
  384. "};\n"
  385. "#endif //B3_COLLIDABLE_H\n"
  386. "#ifndef B3_RIGIDBODY_DATA_H\n"
  387. "#define B3_RIGIDBODY_DATA_H\n"
  388. "#ifndef B3_FLOAT4_H\n"
  389. "#ifdef __cplusplus\n"
  390. "#else\n"
  391. "#endif \n"
  392. "#endif //B3_FLOAT4_H\n"
  393. "#ifndef B3_QUAT_H\n"
  394. "#ifdef __cplusplus\n"
  395. "#else\n"
  396. "#endif \n"
  397. "#endif //B3_QUAT_H\n"
  398. "#ifndef B3_MAT3x3_H\n"
  399. "#ifdef __cplusplus\n"
  400. "#else\n"
  401. "#endif\n"
  402. "#endif //B3_MAT3x3_H\n"
  403. "typedef struct b3RigidBodyData b3RigidBodyData_t;\n"
  404. "struct b3RigidBodyData\n"
  405. "{\n"
  406. " b3Float4 m_pos;\n"
  407. " b3Quat m_quat;\n"
  408. " b3Float4 m_linVel;\n"
  409. " b3Float4 m_angVel;\n"
  410. " int m_collidableIdx;\n"
  411. " float m_invMass;\n"
  412. " float m_restituitionCoeff;\n"
  413. " float m_frictionCoeff;\n"
  414. "};\n"
  415. "typedef struct b3InertiaData b3InertiaData_t;\n"
  416. "struct b3InertiaData\n"
  417. "{\n"
  418. " b3Mat3x3 m_invInertiaWorld;\n"
  419. " b3Mat3x3 m_initInvInertia;\n"
  420. "};\n"
  421. "#endif //B3_RIGIDBODY_DATA_H\n"
  422. " \n"
  423. "void b3ComputeWorldAabb( int bodyId, __global const b3RigidBodyData_t* bodies, __global const b3Collidable_t* collidables, __global const b3Aabb_t* localShapeAABB, __global b3Aabb_t* worldAabbs)\n"
  424. "{\n"
  425. " __global const b3RigidBodyData_t* body = &bodies[bodyId];\n"
  426. " b3Float4 position = body->m_pos;\n"
  427. " b3Quat orientation = body->m_quat;\n"
  428. " \n"
  429. " int collidableIndex = body->m_collidableIdx;\n"
  430. " int shapeIndex = collidables[collidableIndex].m_shapeIndex;\n"
  431. " \n"
  432. " if (shapeIndex>=0)\n"
  433. " {\n"
  434. " \n"
  435. " b3Aabb_t localAabb = localShapeAABB[collidableIndex];\n"
  436. " b3Aabb_t worldAabb;\n"
  437. " \n"
  438. " b3Float4 aabbAMinOut,aabbAMaxOut; \n"
  439. " float margin = 0.f;\n"
  440. " b3TransformAabb2(localAabb.m_minVec,localAabb.m_maxVec,margin,position,orientation,&aabbAMinOut,&aabbAMaxOut);\n"
  441. " \n"
  442. " worldAabb.m_minVec =aabbAMinOut;\n"
  443. " worldAabb.m_minIndices[3] = bodyId;\n"
  444. " worldAabb.m_maxVec = aabbAMaxOut;\n"
  445. " worldAabb.m_signedMaxIndices[3] = body[bodyId].m_invMass==0.f? 0 : 1;\n"
  446. " worldAabbs[bodyId] = worldAabb;\n"
  447. " }\n"
  448. "}\n"
  449. "#endif //B3_UPDATE_AABBS_H\n"
  450. "__kernel void initializeGpuAabbsFull( const int numNodes, __global b3RigidBodyData_t* gBodies,__global b3Collidable_t* collidables, __global b3Aabb_t* plocalShapeAABB, __global b3Aabb_t* pAABB)\n"
  451. "{\n"
  452. " int nodeID = get_global_id(0);\n"
  453. " if( nodeID < numNodes )\n"
  454. " {\n"
  455. " b3ComputeWorldAabb(nodeID, gBodies, collidables, plocalShapeAABB,pAABB);\n"
  456. " }\n"
  457. "}\n"
  458. "__kernel void clearOverlappingPairsKernel( __global int4* pairs, int numPairs)\n"
  459. "{\n"
  460. " int pairId = get_global_id(0);\n"
  461. " if( pairId< numPairs )\n"
  462. " {\n"
  463. " pairs[pairId].z = 0xffffffff;\n"
  464. " }\n"
  465. "}\n"
  466. ;