Bullet Collision Detection & Physics Library
btBatchedConstraints.h
Go to the documentation of this file.
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
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 BT_BATCHED_CONSTRAINTS_H
17 #define BT_BATCHED_CONSTRAINTS_H
18 
19 #include "LinearMath/btThreads.h"
23 
24 
25 class btIDebugDraw;
26 
28 {
30  {
34  };
35  struct Range
36  {
37  int begin;
38  int end;
39 
40  Range() : begin( 0 ), end( 0 ) {}
41  Range( int _beg, int _end ) : begin( _beg ), end( _end ) {}
42  };
43 
45  btAlignedObjectArray<Range> m_batches; // each batch is a range of indices in the m_constraintIndices array
46  btAlignedObjectArray<Range> m_phases; // each phase is range of indices in the m_batches array
47  btAlignedObjectArray<char> m_phaseGrainSize; // max grain size for each phase
48  btAlignedObjectArray<int> m_phaseOrder; // phases can be done in any order, so we can randomize the order here
50 
51  static bool s_debugDrawBatches;
52 
53  btBatchedConstraints() {m_debugDrawer=NULL;}
54  void setup( btConstraintArray* constraints,
56  BatchingMethod batchingMethod,
57  int minBatchSize,
58  int maxBatchSize,
59  btAlignedObjectArray<char>* scratchMemory
60  );
61  bool validate( btConstraintArray* constraints, const btAlignedObjectArray<btSolverBody>& bodies ) const;
62 };
63 
64 
65 #endif // BT_BATCHED_CONSTRAINTS_H
66 
btAlignedObjectArray< int > m_phaseOrder
The btIDebugDraw interface class allows hooking up a debug renderer to visually debug simulations...
Definition: btIDebugDraw.h:29
btAlignedObjectArray< Range > m_phases
btAlignedObjectArray< int > m_constraintIndices
btAlignedObjectArray< char > m_phaseGrainSize
void setup(btConstraintArray *constraints, const btAlignedObjectArray< btSolverBody > &bodies, BatchingMethod batchingMethod, int minBatchSize, int maxBatchSize, btAlignedObjectArray< char > *scratchMemory)
btIDebugDraw * m_debugDrawer
bool validate(btConstraintArray *constraints, const btAlignedObjectArray< btSolverBody > &bodies) const
btAlignedObjectArray< Range > m_batches