Bullet Collision Detection & Physics Library: btBatchedConstraints.h Source File

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"
20 #include "LinearMath/btAlignedObjectArray.h"
21 #include "BulletDynamics/ConstraintSolver/btSolverBody.h"
22 #include "BulletDynamics/ConstraintSolver/btSolverConstraint.h"
23
24 class btIDebugDraw;
25
26 struct btBatchedConstraints
27 {
28 enum BatchingMethod
29 {
30 BATCHING_METHOD_SPATIAL_GRID_2D,
31 BATCHING_METHOD_SPATIAL_GRID_3D,
32 BATCHING_METHOD_COUNT
33 };
34 struct Range
35 {
36 int begin;
37 int end;
38
39 Range() : begin(0), end(0) {}
40 Range(int _beg, int _end) : begin(_beg), end(_end) {}
41 };
42
43 btAlignedObjectArray<int> m_constraintIndices;
44 btAlignedObjectArray<Range> m_batches; // each batch is a range of indices in the m_constraintIndices array
45 btAlignedObjectArray<Range> m_phases; // each phase is range of indices in the m_batches array
46 btAlignedObjectArray<char> m_phaseGrainSize; // max grain size for each phase
47 btAlignedObjectArray<int> m_phaseOrder; // phases can be done in any order, so we can randomize the order here
48 btIDebugDraw* m_debugDrawer;
49
50 static bool s_debugDrawBatches;
51
52 btBatchedConstraints() { m_debugDrawer = NULL; }
53 void setup(btConstraintArray* constraints,
54 const btAlignedObjectArray<btSolverBody>& bodies,
55 BatchingMethod batchingMethod,
56 int minBatchSize,
57 int maxBatchSize,
58 btAlignedObjectArray<char>* scratchMemory);
59 bool validate(btConstraintArray* constraints, const btAlignedObjectArray<btSolverBody>& bodies) const;
60 };
61
62 #endif // BT_BATCHED_CONSTRAINTS_H
btAlignedObjectArray.h
btSolverBody.h
btSolverConstraint.h
btThreads.h
btAlignedObjectArray< int >
btIDebugDraw
The btIDebugDraw interface class allows hooking up a debug renderer to visually debug simulations.
Definition: btIDebugDraw.h:27
btBatchedConstraints::Range
Definition: btBatchedConstraints.h:35
btBatchedConstraints::Range::Range
Range(int _beg, int _end)
Definition: btBatchedConstraints.h:40
btBatchedConstraints::Range::begin
int begin
Definition: btBatchedConstraints.h:36
btBatchedConstraints::Range::end
int end
Definition: btBatchedConstraints.h:37
btBatchedConstraints::Range::Range
Range()
Definition: btBatchedConstraints.h:39
btBatchedConstraints
Definition: btBatchedConstraints.h:27
btBatchedConstraints::validate
bool validate(btConstraintArray *constraints, const btAlignedObjectArray< btSolverBody > &bodies) const
Definition: btBatchedConstraints.cpp:46
btBatchedConstraints::s_debugDrawBatches
static bool s_debugDrawBatches
Definition: btBatchedConstraints.h:50
btBatchedConstraints::m_batches
btAlignedObjectArray< Range > m_batches
Definition: btBatchedConstraints.h:44
btBatchedConstraints::btBatchedConstraints
btBatchedConstraints()
Definition: btBatchedConstraints.h:52
btBatchedConstraints::m_constraintIndices
btAlignedObjectArray< int > m_constraintIndices
Definition: btBatchedConstraints.h:43
btBatchedConstraints::setup
void setup(btConstraintArray *constraints, const btAlignedObjectArray< btSolverBody > &bodies, BatchingMethod batchingMethod, int minBatchSize, int maxBatchSize, btAlignedObjectArray< char > *scratchMemory)
Definition: btBatchedConstraints.cpp:1063
btBatchedConstraints::m_phaseGrainSize
btAlignedObjectArray< char > m_phaseGrainSize
Definition: btBatchedConstraints.h:46
btBatchedConstraints::m_phaseOrder
btAlignedObjectArray< int > m_phaseOrder
Definition: btBatchedConstraints.h:47
btBatchedConstraints::m_phases
btAlignedObjectArray< Range > m_phases
Definition: btBatchedConstraints.h:45
btBatchedConstraints::m_debugDrawer
btIDebugDraw * m_debugDrawer
Definition: btBatchedConstraints.h:48
btBatchedConstraints::BatchingMethod
BatchingMethod
Definition: btBatchedConstraints.h:29
btBatchedConstraints::BATCHING_METHOD_SPATIAL_GRID_3D
@ BATCHING_METHOD_SPATIAL_GRID_3D
Definition: btBatchedConstraints.h:31
btBatchedConstraints::BATCHING_METHOD_COUNT
@ BATCHING_METHOD_COUNT
Definition: btBatchedConstraints.h:32
btBatchedConstraints::BATCHING_METHOD_SPATIAL_GRID_2D
@ BATCHING_METHOD_SPATIAL_GRID_2D
Definition: btBatchedConstraints.h:30