1 | /* |
---|
2 | Bullet Continuous Collision Detection and Physics Library |
---|
3 | Copyright (c) 2003-2007 Erwin Coumans http://bulletphysics.com |
---|
4 | |
---|
5 | This software is provided 'as-is', without any express or implied warranty. |
---|
6 | In no event will the authors be held liable for any damages arising from the use of this software. |
---|
7 | Permission is granted to anyone to use this software for any purpose, |
---|
8 | including commercial applications, and to alter it and redistribute it freely, |
---|
9 | subject to the following restrictions: |
---|
10 | |
---|
11 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. |
---|
12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. |
---|
13 | 3. This notice may not be removed or altered from any source distribution. |
---|
14 | */ |
---|
15 | |
---|
16 | #ifndef SPU_BATCH_RAYCASTER_H |
---|
17 | #define SPU_BATCH_RAYCASTER_H |
---|
18 | |
---|
19 | #include "LinearMath/btAlignedObjectArray.h" |
---|
20 | #include "BulletCollision/CollisionDispatch/btCollisionObject.h" |
---|
21 | #include "SpuRaycastTaskProcess.h" |
---|
22 | #include "SpuRaycastTask/SpuRaycastTask.h" |
---|
23 | #include "SpuCollisionObjectWrapper.h" |
---|
24 | |
---|
25 | /* FIXME: |
---|
26 | * Need to decide how callbacks are performed... |
---|
27 | */ |
---|
28 | class SpuBatchRaycaster |
---|
29 | { |
---|
30 | protected: |
---|
31 | SpuCollisionObjectWrapper* castUponObjectWrappers; |
---|
32 | int numCastUponObjectWrappers; |
---|
33 | btAlignedObjectArray<SpuRaycastTaskWorkUnit> rayBatch; |
---|
34 | btAlignedObjectArray<SpuRaycastTaskWorkUnitOut> rayBatchOutput; |
---|
35 | SpuRaycastTaskProcess* m_spuRaycastTaskProcess; |
---|
36 | class btThreadSupportInterface* m_threadInterface; |
---|
37 | public: |
---|
38 | SpuBatchRaycaster (class btThreadSupportInterface* threadInterface, int maxNumOutstandingTasks); |
---|
39 | ~SpuBatchRaycaster (); |
---|
40 | void setCollisionObjects (btCollisionObjectArray& castUponObjects, int numCastUponObjects); |
---|
41 | void setCollisionObjectsSkipPE (btCollisionObjectArray& castUponObjects, int numCastUponObjects); |
---|
42 | void addRay (const btVector3& rayFrom, const btVector3& rayTo, const btScalar hitFraction = 1.0); |
---|
43 | void clearRays (); |
---|
44 | void performBatchRaycast (); |
---|
45 | const SpuRaycastTaskWorkUnitOut& operator [] (int i) const; |
---|
46 | int getNumRays () const; |
---|
47 | }; |
---|
48 | |
---|
49 | #endif |
---|