-
Notifications
You must be signed in to change notification settings - Fork 7
/
BulletGlobals.cs
176 lines (150 loc) · 9.53 KB
/
BulletGlobals.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
/*
* C# / XNA port of Bullet (c) 2011 Mark Neale <xexuxjy@hotmail.com>
*
* Bullet Continuous Collision Detection and Physics Library
* Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/
*
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from
* the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 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.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
using System;
using System.Collections.Generic;
using System.IO;
using BulletXNA.BulletCollision;
using BulletXNA.LinearMath;
using BulletXNA.BulletDynamics;
namespace BulletXNA
{
public static class BulletGlobals
{
public static bool gDisableDeactivation = false;
public static int gOverlappingPairs = 0;
public static float gDeactivationTime = 2f;
public static int BT_BULLET_VERSION = 276;
public static int RAND_MAX = int.MaxValue;
public static float gContactBreakingThreshold = .02f;
public static Random gRandom = new Random();
public static IndexedMatrix IdentityMatrix = IndexedMatrix.Identity;
public static IContactAddedCallback gContactAddedCallback;
public static IDebugDraw gDebugDraw;
public static StreamWriter g_streamWriter;
public static IProfileManager g_profileManager;
public static void StartProfile(String name)
{
if (g_profileManager != null)
{
g_profileManager.Start_Profile(name);
}
}
public static void StopProfile()
{
if (g_profileManager != null)
{
g_profileManager.Stop_Profile();
}
}
public static void ResetProfile()
{
if (g_profileManager != null)
{
g_profileManager.Reset();
}
}
//public static ManifoldPoint GetManifoldPoint()
//{
// if (m_pointStack.Count == 0)
// {
// m_pointStack.Push(new ManifoldPoint());
// }
// ++m_assignedPointCount;
// return m_pointStack.Pop();
//}
//public static void ReleaseManifoldPoint(ManifoldPoint mp)
//{
// --m_assignedPointCount;
// m_pointStack.Push(mp);
//}
//private static Stack<ManifoldPoint> m_pointStack = new Stack<ManifoldPoint>(20);
//private static int m_assignedPointCount = 0;
public static PooledType<VoronoiSimplexSolver> VoronoiSimplexSolverPool = new PooledType<VoronoiSimplexSolver>();
public static PooledType<SubSimplexConvexCast> SubSimplexConvexCastPool = new PooledType<SubSimplexConvexCast>();
public static PooledType<ManifoldPoint> ManifoldPointPool = new PooledType<ManifoldPoint>();
public static PooledType<CastResult> CastResultPool = new PooledType<CastResult>();
public static PooledType<SphereShape> SphereShapePool = new PooledType<SphereShape>();
public static PooledType<DbvtNode> DbvtNodePool = new PooledType<DbvtNode>();
public static PooledType<SingleRayCallback> SingleRayCallbackPool = new PooledType<SingleRayCallback>();
public static PooledType<SubSimplexClosestResult> SubSimplexClosestResultPool = new PooledType<SubSimplexClosestResult>();
public static PooledType<GjkPairDetector> GjkPairDetectorPool = new PooledType<GjkPairDetector>();
public static PooledType<DbvtTreeCollider> DbvtTreeColliderPool = new PooledType<DbvtTreeCollider>();
public static PooledType<SingleSweepCallback> SingleSweepCallbackPool = new PooledType<SingleSweepCallback>();
public static PooledType<BroadphaseRayTester> BroadphaseRayTesterPool = new PooledType<BroadphaseRayTester>();
public static PooledType<ClosestNotMeConvexResultCallback> ClosestNotMeConvexResultCallbackPool = new PooledType<ClosestNotMeConvexResultCallback>();
public static PooledType<GjkEpaPenetrationDepthSolver> GjkEpaPenetrationDepthSolverPool = new PooledType<GjkEpaPenetrationDepthSolver>();
public static PooledType<ContinuousConvexCollision> ContinuousConvexCollisionPool = new PooledType<ContinuousConvexCollision>();
public static PooledType<DbvtStackDataBlock> DbvtStackDataBlockPool = new PooledType<DbvtStackDataBlock>();
public static PooledType<BoxBoxCollisionAlgorithm> BoxBoxCollisionAlgorithmPool = new PooledType<BoxBoxCollisionAlgorithm>();
public static PooledType<CompoundCollisionAlgorithm> CompoundCollisionAlgorithmPool = new PooledType<CompoundCollisionAlgorithm>();
public static PooledType<ConvexConcaveCollisionAlgorithm> ConvexConcaveCollisionAlgorithmPool = new PooledType<ConvexConcaveCollisionAlgorithm>();
public static PooledType<ConvexConvexAlgorithm> ConvexConvexAlgorithmPool = new PooledType<ConvexConvexAlgorithm>();
public static PooledType<ConvexPlaneCollisionAlgorithm> ConvexPlaneAlgorithmPool = new PooledType<ConvexPlaneCollisionAlgorithm>();
public static PooledType<SphereBoxCollisionAlgorithm> SphereBoxCollisionAlgorithmPool = new PooledType<SphereBoxCollisionAlgorithm>();
public static PooledType<SphereSphereCollisionAlgorithm> SphereSphereCollisionAlgorithmPool = new PooledType<SphereSphereCollisionAlgorithm>();
public static PooledType<SphereTriangleCollisionAlgorithm> SphereTriangleCollisionAlgorithmPool = new PooledType<SphereTriangleCollisionAlgorithm>();
public static PooledType<GImpactCollisionAlgorithm> GImpactCollisionAlgorithmPool = new PooledType<GImpactCollisionAlgorithm>();
public static PooledType<GjkEpaSolver2MinkowskiDiff> GjkEpaSolver2MinkowskiDiffPool = new PooledType<GjkEpaSolver2MinkowskiDiff>();
public static PooledType<PersistentManifold> PersistentManifoldPool = new PooledType<PersistentManifold>();
public static PooledType<ManifoldResult> ManifoldResultPool = new PooledType<ManifoldResult>();
public static PooledType<GJK> GJKPool = new PooledType<GJK>();
public static PooledType<GIM_ShapeRetriever> GIM_ShapeRetrieverPool = new PooledType<GIM_ShapeRetriever>();
public static PooledType<TriangleShape> TriangleShapePool = new PooledType<TriangleShape>();
public static PooledType<SphereTriangleDetector> SphereTriangleDetectorPool = new PooledType<SphereTriangleDetector>();
public static PooledType<CompoundLeafCallback> CompoundLeafCallbackPool = new PooledType<CompoundLeafCallback>();
public static PooledType<GjkConvexCast> GjkConvexCastPool = new PooledType<GjkConvexCast>();
public static PooledType<LocalTriangleSphereCastCallback> LocalTriangleSphereCastCallbackPool = new PooledType<LocalTriangleSphereCastCallback>();
public static PooledType<BridgeTriangleRaycastCallback> BridgeTriangleRaycastCallbackPool = new PooledType<BridgeTriangleRaycastCallback>();
public static PooledType<BridgeTriangleConcaveRaycastCallback> BridgeTriangleConcaveRaycastCallbackPool = new PooledType<BridgeTriangleConcaveRaycastCallback>();
public static PooledType<BridgeTriangleConvexcastCallback> BridgeTriangleConvexcastCallbackPool = new PooledType<BridgeTriangleConvexcastCallback>();
public static PooledType<MyNodeOverlapCallback> MyNodeOverlapCallbackPool = new PooledType<MyNodeOverlapCallback>();
public static PooledType<ClosestRayResultCallback> ClosestRayResultCallbackPool = new PooledType<ClosestRayResultCallback>();
public static PooledType<DebugDrawcallback> DebugDrawcallbackPool = new PooledType<DebugDrawcallback>();
public const bool debugRigidBody = true;
public const bool debugCollisionWorld = false;
public const bool debugConstraints = false;
public const bool debugDiscreteDynamicsWorld = true;
public const bool debugBoxBoxDetector = false;
public const bool debugIslands = false;
public const bool debugBVHTriangleMesh = false;
public const bool debugConvexHull = false;
public const bool debugConvexShape = false;
public const bool debugShapeHull = false;
public const bool debugStridingMesh = false;
public const bool debugGJK = false;
public const bool debugGJKDetector = false;
public const bool debugPersistentManifold = false;
public const bool debugVoronoiSimplex = false;
public const bool debugSolver = true;
public const bool debugBroadphase = false;
public const bool debugBoxShape = false;
public const bool debugGimpactShape= false;
public const bool debugGimpactAlgo = false;
public const bool debugGimpactBVH = false;
public const bool debugPairCache = false;
public const bool debugDispatcher = false;
public const bool debugManifoldResult = false;
// tracking
public static int s_collisionAlgorithmInstanceCount = 0;
}
}