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  bullet_cat.debug() << "initialize module" << std::endl;
211 
212  // Register the Bullet system
214  ps->add_system("Bullet");
215 }
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static PandaSystem * get_global_ptr()
Returns the global PandaSystem object.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class is used as a namespace to group several global properties of Panda.
Definition: pandaSystem.h:26
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletShape.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletShape.
This is a convenience class to specialize ConfigVariable as a boolean type.
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletTriangleMesh.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void init_libbullet()
Initializes the library.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletShape.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a convenience class to specialize ConfigVariable as a floating- point type.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletDebugNode.
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletShape.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class specializes ConfigVariable as an enumerated type.
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletShape.
void add_system(const std::string &system)
Intended for use by each subsystem to register itself at startup.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletShape.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletShape.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletTriangleMeshShape.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a convenience class to specialize ConfigVariable as an integer type.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletShape.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletShape.
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletShape.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static void register_with_read_factory()
Tells the BamReader how to create objects of type BulletRigidBodyNode.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.