LiquidFun
 All Classes Files Functions Variables Enumerations Enumerator Macros Pages
b2Settings.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 * Copyright (c) 2013 Google, Inc.
4 *
5 * This software is provided 'as-is', without any express or implied
6 * warranty. In no event will the authors be held liable for any damages
7 * arising from the use of this software.
8 * Permission is granted to anyone to use this software for any purpose,
9 * including commercial applications, and to alter it and redistribute it
10 * freely, subject to the following restrictions:
11 * 1. The origin of this software must not be misrepresented; you must not
12 * claim that you wrote the original software. If you use this software
13 * in a product, an acknowledgment in the product documentation would be
14 * appreciated but is not required.
15 * 2. Altered source versions must be plainly marked as such, and must not be
16 * misrepresented as being the original software.
17 * 3. This notice may not be removed or altered from any source distribution.
18 */
19 
20 #ifndef B2_SETTINGS_H
21 #define B2_SETTINGS_H
22 
23 #include <cassert>
24 #include <cmath>
25 
26 #define B2_NOT_USED(x) ((void)(x))
27 #if DEBUG
28 #define b2Assert(A) assert(A)
29 #define B2_ASSERT_ENABLED 1
30 #else
31 #define b2Assert(A)
32 #define B2_ASSERT_ENABLED 0
33 #endif
34 
35 typedef signed char int8;
36 typedef signed short int16;
37 typedef signed int int32;
38 typedef unsigned char uint8;
39 typedef unsigned short uint16;
40 typedef unsigned int uint32;
41 typedef float float32;
42 typedef double float64;
43 
44 #define b2_maxFloat FLT_MAX
45 #define b2_epsilon FLT_EPSILON
46 #define b2_pi 3.14159265359f
47 
51 
52 // Collision
53 
56 #define b2_maxManifoldPoints 2
57 
60 #define b2_maxPolygonVertices 8
61 
65 #define b2_aabbExtension 0.1f
66 
70 #define b2_aabbMultiplier 2.0f
71 
74 #define b2_linearSlop 0.005f
75 
78 #define b2_angularSlop (2.0f / 180.0f * b2_pi)
79 
83 #define b2_polygonRadius (2.0f * b2_linearSlop)
84 
86 #define b2_maxSubSteps 8
87 
88 
89 // Dynamics
90 
92 #define b2_maxTOIContacts 32
93 
96 #define b2_velocityThreshold 1.0f
97 
100 #define b2_maxLinearCorrection 0.2f
101 
104 #define b2_maxAngularCorrection (8.0f / 180.0f * b2_pi)
105 
108 #define b2_maxTranslation 2.0f
109 #define b2_maxTranslationSquared (b2_maxTranslation * b2_maxTranslation)
110 
113 #define b2_maxRotation (0.5f * b2_pi)
114 #define b2_maxRotationSquared (b2_maxRotation * b2_maxRotation)
115 
119 #define b2_baumgarte 0.2f
120 #define b2_toiBaugarte 0.75f
121 
122 
123 // Particle
124 
126 #define b2_invalidParticleIndex (-1)
127 
129 #define b2_particleStride 0.75f
130 
132 #define b2_minParticleWeight 1.0f
133 
135 #define b2_maxParticleWeight 5.0f
136 
138 #define b2_maxTriadDistance 2
139 #define b2_maxTriadDistanceSquared (b2_maxTriadDistance * b2_maxTriadDistance)
140 
142 #define b2_minParticleBufferCapacity 256
143 
144 // Sleep
145 
147 #define b2_timeToSleep 0.5f
148 
150 #define b2_linearSleepTolerance 0.01f
151 
153 #define b2_angularSleepTolerance (2.0f / 180.0f * b2_pi)
154 
155 // Memory Allocation
156 
158 void* b2Alloc(int32 size);
159 
161 void b2Free(void* mem);
162 
164 void b2Log(const char* string, ...);
165 
168 struct b2Version
169 {
170  int32 major;
171  int32 minor;
172  int32 revision;
173 };
174 
177 extern b2Version b2_version;
178 
180 extern const b2Version b2_liquidFunVersion;
189 extern const char *b2_liquidFunVersionString;
190 
191 #endif
void b2Log(const char *string,...)
Logging function.
Definition: b2Settings.cpp:56
int32 minor
incremental changes
Definition: b2Settings.h:171
void b2Free(void *mem)
If you implement b2Alloc, you should also implement this function.
Definition: b2Settings.cpp:50
void * b2Alloc(int32 size)
Implement this function to use your own memory allocator.
Definition: b2Settings.cpp:45
b2Version b2_version
Definition: b2Settings.cpp:25
Definition: b2Settings.h:168
const char * b2_liquidFunVersionString
Definition: b2Settings.cpp:38
int32 major
significant changes
Definition: b2Settings.h:170
const b2Version b2_liquidFunVersion
Global variable is used to identify the version of LiquidFun.
Definition: b2Settings.cpp:33
int32 revision
bug fixes
Definition: b2Settings.h:172