![]() |
Box2D
2.2.1
A 2D Physics Engine for Games
|
00001 /* 00002 * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org 00003 * 00004 * This software is provided 'as-is', without any express or implied 00005 * warranty. In no event will the authors be held liable for any damages 00006 * arising from the use of this software. 00007 * Permission is granted to anyone to use this software for any purpose, 00008 * including commercial applications, and to alter it and redistribute it 00009 * freely, subject to the following restrictions: 00010 * 1. The origin of this software must not be misrepresented; you must not 00011 * claim that you wrote the original software. If you use this software 00012 * in a product, an acknowledgment in the product documentation would be 00013 * appreciated but is not required. 00014 * 2. Altered source versions must be plainly marked as such, and must not be 00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ 00018 00019 #ifndef B2_SETTINGS_H 00020 #define B2_SETTINGS_H 00021 00022 #include <cassert> 00023 #include <cmath> 00024 00025 #define B2_NOT_USED(x) ((void)(x)) 00026 #define b2Assert(A) assert(A) 00027 00028 typedef signed char int8; 00029 typedef signed short int16; 00030 typedef signed int int32; 00031 typedef unsigned char uint8; 00032 typedef unsigned short uint16; 00033 typedef unsigned int uint32; 00034 typedef float float32; 00035 typedef double float64; 00036 00037 #define b2_maxFloat FLT_MAX 00038 #define b2_epsilon FLT_EPSILON 00039 #define b2_pi 3.14159265359f 00040 00044 00045 // Collision 00046 00049 #define b2_maxManifoldPoints 2 00050 00053 #define b2_maxPolygonVertices 8 00054 00058 #define b2_aabbExtension 0.1f 00059 00063 #define b2_aabbMultiplier 2.0f 00064 00067 #define b2_linearSlop 0.005f 00068 00071 #define b2_angularSlop (2.0f / 180.0f * b2_pi) 00072 00076 #define b2_polygonRadius (2.0f * b2_linearSlop) 00077 00079 #define b2_maxSubSteps 8 00080 00081 00082 // Dynamics 00083 00085 #define b2_maxTOIContacts 32 00086 00089 #define b2_velocityThreshold 1.0f 00090 00093 #define b2_maxLinearCorrection 0.2f 00094 00097 #define b2_maxAngularCorrection (8.0f / 180.0f * b2_pi) 00098 00101 #define b2_maxTranslation 2.0f 00102 #define b2_maxTranslationSquared (b2_maxTranslation * b2_maxTranslation) 00103 00106 #define b2_maxRotation (0.5f * b2_pi) 00107 #define b2_maxRotationSquared (b2_maxRotation * b2_maxRotation) 00108 00112 #define b2_baumgarte 0.2f 00113 #define b2_toiBaugarte 0.75f 00114 00115 00116 // Sleep 00117 00119 #define b2_timeToSleep 0.5f 00120 00122 #define b2_linearSleepTolerance 0.01f 00123 00125 #define b2_angularSleepTolerance (2.0f / 180.0f * b2_pi) 00126 00127 // Memory Allocation 00128 00130 void* b2Alloc(int32 size); 00131 00133 void b2Free(void* mem); 00134 00136 void b2Log(const char* string, ...); 00137 00140 struct b2Version 00141 { 00142 int32 major; 00143 int32 minor; 00144 int32 revision; 00145 }; 00146 00148 extern b2Version b2_version; 00149 00150 #endif