Panda3D
config_bullet.cxx
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file config_bullet.cxx
10  * @author enn0x
11  * @date 2010-01-23
12  */
13 
14 #include "config_bullet.h"
15 
17 #include "bulletBodyNode.h"
18 #include "bulletBoxShape.h"
19 #include "bulletCapsuleShape.h"
21 #include "bulletConeShape.h"
24 #include "bulletConstraint.h"
25 #include "bulletConvexHullShape.h"
27 #include "bulletCylinderShape.h"
29 #include "bulletDebugNode.h"
32 #include "bulletGhostNode.h"
33 #include "bulletHeightfieldShape.h"
34 #include "bulletHingeConstraint.h"
35 #include "bulletMultiSphereShape.h"
36 #include "bulletPlaneShape.h"
37 #include "bulletRigidBodyNode.h"
38 #include "bulletShape.h"
39 #include "bulletSliderConstraint.h"
40 #include "bulletSphereShape.h"
42 #include "bulletSoftBodyNode.h"
43 #include "bulletSoftBodyShape.h"
44 #include "bulletTickCallbackData.h"
45 #include "bulletTriangleMesh.h"
47 #include "bulletVehicle.h"
48 #include "bulletWorld.h"
49 
50 #include "bulletContactCallbacks.h"
51 
52 extern ContactAddedCallback gContactAddedCallback;
53 extern ContactProcessedCallback gContactProcessedCallback;
54 extern ContactDestroyedCallback gContactDestroyedCallback;
55 
56 #include "dconfig.h"
57 #include "pandaSystem.h"
58 
59 #if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDABULLET)
60  #error Buildsystem error: BUILDING_PANDABULLET not defined
61 #endif
62 
63 Configure(config_bullet);
64 NotifyCategoryDef(bullet, "");
65 
66 ConfigureFn(config_bullet) {
68 }
69 
70 ConfigVariableInt bullet_max_objects
71 ("bullet-max-objects", 1024,
72 PRC_DESC("Specifies the maximum number of individual objects within a "
73  "bullet physics world. Default value is 1024."));
74 
75 ConfigVariableInt bullet_gc_lifetime
76 ("bullet-gc-lifetime", 256,
77 PRC_DESC("Specifies the lifetime of data clean up be the soft body world "
78  "info garbage collector. Default value is 256."));
79 
81 ("bullet-broadphase-algorithm", BulletWorld::BA_dynamic_aabb_tree,
82 PRC_DESC("Specifies the broadphase algorithm to be used by the physics "
83  "engine. Default value is 'aabb' (dynamic aabb tree)."));
84 
86 ("bullet-filter-algorithm", BulletWorld::FA_mask,
87 PRC_DESC("Specifies the algorithm to be used by the physics engine for "
88  "collision filtering. Default value is 'mask'."));
89 
90 ConfigVariableDouble bullet_sap_extents
91 ("bullet-sap-extents", 1000.0,
92 PRC_DESC("Specifies the world extent in all directions. The config variable "
93  "is only used if bullet-broadphase-algorithm is set to 'sap' "
94  "(sweep and prune). Default value is 1000.0."));
95 
96 ConfigVariableBool bullet_enable_contact_events
97 ("bullet-enable-contact-events", false,
98 PRC_DESC("Specifies if events should be send when new contacts are "
99  "created or existing contacts get remove. Warning: enabling "
100  "contact events might create more load on the event queue "
101  "then you might want! Default value is FALSE."));
102 
103 ConfigVariableInt bullet_solver_iterations
104 ("bullet-solver-iterations", 10,
105 PRC_DESC("Specifies the number of iterations for the Bullet contact "
106  "solver. This is the native Bullet property "
107  "btContactSolverInfo::m_numIterations. Default value is 10."));
108 
109 ConfigVariableBool bullet_additional_damping
110 ("bullet-additional-damping", false,
111 PRC_DESC("Enables additional damping on eachrigid body, in order to reduce "
112  "jitter. Default value is FALSE. Additional damping is an "
113  "experimental feature of the Bullet physics engine. Use with "
114  "care."));
115 
116 ConfigVariableDouble bullet_additional_damping_linear_factor
117 ("bullet-additional-damping-linear-factor", 0.005,
118 PRC_DESC("Only used when bullet-additional-damping is set to TRUE. "
119  "Default value is 0.005"));
120 
121 ConfigVariableDouble bullet_additional_damping_angular_factor
122 ("bullet-additional-damping-angular-factor", 0.01,
123 PRC_DESC("Only used when bullet-additional-damping is set to TRUE. "
124  "Default value is 0.01"));
125 
126 ConfigVariableDouble bullet_additional_damping_linear_threshold
127 ("bullet-additional-damping-linear-threshold", 0.01,
128 PRC_DESC("Only used when bullet-additional-damping is set to TRUE. "
129  "Default value is 0.01"));
130 
131 ConfigVariableDouble bullet_additional_damping_angular_threshold
132 ("bullet-additional-damping-angular-threshold", 0.01,
133 PRC_DESC("Only used when bullet-additional-damping is set to TRUE. "
134  "Default value is 0.01."));
135 
136 /**
137  * Initializes the library. This must be called at least once before any of
138  * the functions or classes in this library can be used. Normally it will be
139  * called by the static initializers and need not be called explicitly, but
140  * special cases exist.
141  */
142 void
144 
145  static bool initialized = false;
146  if (initialized) {
147  return;
148  }
149  initialized = true;
150 
151  // Initialize types
152  BulletBaseCharacterControllerNode::init_type();
153  BulletBodyNode::init_type();
154  BulletBoxShape::init_type();
155  BulletCapsuleShape::init_type();
156  BulletCharacterControllerNode::init_type();
157  BulletConeShape::init_type();
158  BulletConeTwistConstraint::init_type();
159  BulletContactCallbackData::init_type();
160  BulletConstraint::init_type();
161  BulletConvexHullShape::init_type();
162  BulletConvexPointCloudShape::init_type();
163  BulletCylinderShape::init_type();
164  BulletMinkowskiSumShape::init_type();
165  BulletDebugNode::init_type();
166  BulletFilterCallbackData::init_type();
167  BulletGenericConstraint::init_type();
168  BulletGhostNode::init_type();
169  BulletHeightfieldShape::init_type();
170  BulletHingeConstraint::init_type();
171  BulletMultiSphereShape::init_type();
172  BulletPlaneShape::init_type();
173  BulletRigidBodyNode::init_type();
174  BulletShape::init_type();
175  BulletSliderConstraint::init_type();
176  BulletSphereShape::init_type();
177  BulletSphericalConstraint::init_type();
178  BulletSoftBodyNode::init_type();
179  BulletSoftBodyShape::init_type();
180  BulletTickCallbackData::init_type();
181  BulletTriangleMesh::init_type();
182  BulletTriangleMeshShape::init_type();
183  BulletVehicle::init_type();
184  BulletWorld::init_type();
185 
186  // Register factory functions for constructing objects from .bam files
200  BulletMinkowskiSumShape::register_with_read_factory();
202 
203  // Custom contact callbacks
204  gContactAddedCallback = contact_added_callback;
205  gContactProcessedCallback = contact_processed_callback;
206  gContactDestroyedCallback = contact_destroyed_callback;
207 
208  // Initialize notification category
209  bullet_cat.init();
210  if (bullet_cat.is_debug()) {
211  bullet_cat.debug() << "initialize module" << std::endl;
212  }
213 
214  // Register the Bullet system
216  ps->add_system("Bullet");
217 }
bulletSphereShape.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bulletContactCallbacks.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
ConfigVariableBool
This is a convenience class to specialize ConfigVariable as a boolean type.
Definition: configVariableBool.h:23
bulletHingeConstraint.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
BulletHeightfieldShape::register_with_read_factory
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletShape.
Definition: bulletHeightfieldShape.cxx:141
bulletBaseCharacterControllerNode.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bulletVehicle.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
BulletCapsuleShape::register_with_read_factory
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletShape.
Definition: bulletCapsuleShape.cxx:107
BulletDebugNode::register_with_read_factory
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletDebugNode.
Definition: bulletDebugNode.cxx:435
bulletFilterCallbackData.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bulletConstraint.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PandaSystem::get_global_ptr
static PandaSystem * get_global_ptr()
Returns the global PandaSystem object.
Definition: pandaSystem.cxx:442
bulletCharacterControllerNode.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bulletCylinderShape.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bulletMinkowskiSumShape.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
BulletSphereShape::register_with_read_factory
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletShape.
Definition: bulletSphereShape.cxx:66
bulletGhostNode.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bulletCapsuleShape.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bulletConeShape.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bulletSphericalConstraint.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bulletTriangleMeshShape.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bulletPlaneShape.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
ConfigVariableEnum
This class specializes ConfigVariable as an enumerated type.
Definition: configVariableEnum.h:31
bulletContactCallbackData.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
BulletPlaneShape::register_with_read_factory
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletShape.
Definition: bulletPlaneShape.cxx:114
bulletMultiSphereShape.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bulletConvexHullShape.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PandaSystem
This class is used as a namespace to group several global properties of Panda.
Definition: pandaSystem.h:26
bulletHeightfieldShape.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bulletTickCallbackData.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PandaSystem::add_system
void add_system(const std::string &system)
Intended for use by each subsystem to register itself at startup.
Definition: pandaSystem.cxx:365
bulletBoxShape.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bulletBodyNode.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandaSystem.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
BulletBoxShape::register_with_read_factory
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletShape.
Definition: bulletBoxShape.cxx:97
bulletSoftBodyShape.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
BulletConvexPointCloudShape::register_with_read_factory
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletShape.
Definition: bulletConvexPointCloudShape.cxx:122
BulletTriangleMesh::register_with_read_factory
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletTriangleMesh.
Definition: bulletTriangleMesh.cxx:407
dconfig.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bulletSoftBodyNode.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
BulletMultiSphereShape::register_with_read_factory
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletShape.
Definition: bulletMultiSphereShape.cxx:112
BulletConeShape::register_with_read_factory
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletShape.
Definition: bulletConeShape.cxx:93
bulletShape.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
BulletConvexHullShape::register_with_read_factory
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletShape.
Definition: bulletConvexHullShape.cxx:149
bulletSliderConstraint.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
BulletTriangleMeshShape::register_with_read_factory
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletTriangleMeshShape.
Definition: bulletTriangleMeshShape.cxx:147
bulletWorld.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
ConfigVariableDouble
This is a convenience class to specialize ConfigVariable as a floating- point type.
Definition: configVariableDouble.h:24
bulletRigidBodyNode.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bulletGenericConstraint.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
BulletCylinderShape::register_with_read_factory
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletShape.
Definition: bulletCylinderShape.cxx:154
bulletConeTwistConstraint.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
BulletRigidBodyNode::register_with_read_factory
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletRigidBodyNode.
Definition: bulletRigidBodyNode.cxx:725
config_bullet.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bulletTriangleMesh.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
ConfigVariableInt
This is a convenience class to specialize ConfigVariable as an integer type.
Definition: configVariableInt.h:24
bulletDebugNode.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bulletConvexPointCloudShape.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
init_libbullet
void init_libbullet()
Initializes the library.
Definition: config_bullet.cxx:143