00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "config_bullet.h"
00016
00017 #include "bulletBaseCharacterControllerNode.h"
00018 #include "bulletBodyNode.h"
00019 #include "bulletBoxShape.h"
00020 #include "bulletCapsuleShape.h"
00021 #include "bulletCharacterControllerNode.h"
00022 #include "bulletConeShape.h"
00023 #include "bulletConeTwistConstraint.h"
00024 #include "bulletConstraint.h"
00025 #include "bulletConvexHullShape.h"
00026 #include "bulletConvexPointCloudShape.h"
00027 #include "bulletCylinderShape.h"
00028 #include "bulletDebugNode.h"
00029 #include "bulletGenericConstraint.h"
00030 #include "bulletGhostNode.h"
00031 #include "bulletHeightfieldShape.h"
00032 #include "bulletHingeConstraint.h"
00033 #include "bulletMultiSphereShape.h"
00034 #include "bulletPlaneShape.h"
00035 #include "bulletRigidBodyNode.h"
00036 #include "bulletShape.h"
00037 #include "bulletSliderConstraint.h"
00038 #include "bulletSphereShape.h"
00039 #include "bulletSphericalConstraint.h"
00040 #include "bulletSoftBodyNode.h"
00041 #include "bulletSoftBodyShape.h"
00042 #include "bulletTriangleMesh.h"
00043 #include "bulletTriangleMeshShape.h"
00044 #include "bulletVehicle.h"
00045 #include "bulletWorld.h"
00046
00047 #include "bulletContactCallbacks.h"
00048
00049 extern ContactAddedCallback gContactAddedCallback;
00050 extern ContactProcessedCallback gContactProcessedCallback;
00051 extern ContactDestroyedCallback gContactDestroyedCallback;
00052
00053 #include "dconfig.h"
00054 #include "pandaSystem.h"
00055
00056 Configure(config_bullet);
00057 NotifyCategoryDef(bullet, "");
00058
00059 ConfigureFn(config_bullet) {
00060 init_libbullet();
00061 }
00062
00063 ConfigVariableInt bullet_max_objects
00064 ("bullet-max-objects", 1024,
00065 PRC_DESC("Specifies the maximum number of individual objects within a "
00066 "bullet physics world. Default value is 1024."));
00067
00068 ConfigVariableInt bullet_gc_lifetime
00069 ("bullet-gc-lifetime", 256,
00070 PRC_DESC("Specifies the lifetime of data clean up be the soft body world "
00071 "info garbage collector. Default value is 256."));
00072
00073 ConfigVariableEnum<BulletWorld::BroadphaseAlgorithm> bullet_broadphase_algorithm
00074 ("bullet-broadphase-algorithm", BulletWorld::BA_dynamic_aabb_tree,
00075 PRC_DESC("Specifies the broadphase algorithm to be used by the physics "
00076 "engine. Default value is 'aabb' (dynamic aabb tree)."));
00077
00078 ConfigVariableEnum<BulletWorld::FilterAlgorithm> bullet_filter_algorithm
00079 ("bullet-filter-algorithm", BulletWorld::FA_mask,
00080 PRC_DESC("Specifies the algorithm to be used by the physics engine for "
00081 "collision filtering. Default value is 'mask'."));
00082
00083 ConfigVariableDouble bullet_sap_extents
00084 ("bullet-sap-extents", 1000.0,
00085 PRC_DESC("Specifies the world extent in all directions. The config variable "
00086 "is only used if bullet-broadphase-algorithm is set to 'sap' "
00087 "(sweep and prune). Default value is 1000.0."));
00088
00089 ConfigVariableBool bullet_enable_contact_events
00090 ("bullet-enable-contact-events", false,
00091 PRC_DESC("Specifies if events should be send when new contacts are "
00092 "created or existing contacts get remove. Warning: enabling "
00093 "contact events might create more load on the event queue "
00094 "then you might want! Default value is FALSE."));
00095
00096 ConfigVariableInt bullet_solver_iterations
00097 ("bullet-solver-iterations", 10,
00098 PRC_DESC("Specifies the number of iterations for the Bullet contact "
00099 "solver. This is the native Bullet property "
00100 "btContactSolverInfo::m_numIterations. Default value is 10."));
00101
00102 ConfigVariableBool bullet_additional_damping
00103 ("bullet-additional-damping", false,
00104 PRC_DESC("Enables additional damping on eachrigid body, in order to reduce "
00105 "jitter. Default value is FALSE. Additional damping is an "
00106 "experimental feature of the Bullet physics engine. Use with "
00107 "care."));
00108
00109 ConfigVariableDouble bullet_additional_damping_linear_factor
00110 ("bullet-additional-damping-linear-factor", 0.005,
00111 PRC_DESC("Only used when bullet-additional-damping is set to TRUE. "
00112 "Default value is 0.005"));
00113
00114 ConfigVariableDouble bullet_additional_damping_angular_factor
00115 ("bullet-additional-damping-angular-factor", 0.01,
00116 PRC_DESC("Only used when bullet-additional-damping is set to TRUE. "
00117 "Default value is 0.01"));
00118
00119 ConfigVariableDouble bullet_additional_damping_linear_threshold
00120 ("bullet-additional-damping-linear-threshold", 0.01,
00121 PRC_DESC("Only used when bullet-additional-damping is set to TRUE. "
00122 "Default value is 0.01"));
00123
00124 ConfigVariableDouble bullet_additional_damping_angular_threshold
00125 ("bullet-additional-damping-angular-threshold", 0.01,
00126 PRC_DESC("Only used when bullet-additional-damping is set to TRUE. "
00127 "Default value is 0.01."));
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137 void
00138 init_libbullet() {
00139
00140 static bool initialized = false;
00141 if (initialized) {
00142 return;
00143 }
00144 initialized = true;
00145
00146
00147
00148 BulletBaseCharacterControllerNode::init_type();
00149 BulletBodyNode::init_type();
00150 BulletBoxShape::init_type();
00151 BulletCapsuleShape::init_type();
00152 BulletCharacterControllerNode::init_type();
00153 BulletConeShape::init_type();
00154 BulletConeTwistConstraint::init_type();
00155 BulletConstraint::init_type();
00156 BulletConvexHullShape::init_type();
00157 BulletConvexPointCloudShape::init_type();
00158 BulletCylinderShape::init_type();
00159 BulletDebugNode::init_type();
00160 BulletSphericalConstraint::init_type();
00161 BulletGenericConstraint::init_type();
00162 BulletGhostNode::init_type();
00163 BulletHeightfieldShape::init_type();
00164 BulletHingeConstraint::init_type();
00165 BulletMultiSphereShape::init_type();
00166 BulletPlaneShape::init_type();
00167 BulletRigidBodyNode::init_type();
00168 BulletShape::init_type();
00169 BulletSliderConstraint::init_type();
00170 BulletSphereShape::init_type();
00171 BulletSoftBodyNode::init_type();
00172 BulletSoftBodyShape::init_type();
00173 BulletTriangleMesh::init_type();
00174 BulletTriangleMeshShape::init_type();
00175 BulletVehicle::init_type();
00176 BulletWorld::init_type();
00177
00178
00179
00180 gContactAddedCallback = contact_added_callback;
00181 gContactProcessedCallback = contact_processed_callback;
00182 gContactDestroyedCallback = contact_destroyed_callback;
00183
00184
00185
00186 bullet_cat.init();
00187 bullet_cat.debug() << "initialize module" << endl;
00188
00189
00190
00191 PandaSystem *ps = PandaSystem::get_global_ptr();
00192 ps->add_system("Bullet");
00193 }
00194