Panda3D
config_collide.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_collide.cxx
10  * @author drose
11  * @date 2000-04-24
12  */
13 
14 #include "config_collide.h"
15 #include "collisionBox.h"
16 #include "collisionCapsule.h"
17 #include "collisionEntry.h"
18 #include "collisionHandler.h"
19 #include "collisionHandlerEvent.h"
21 #include "collisionHandlerFloor.h"
24 #include "collisionHandlerPusher.h"
26 #include "collisionHandlerQueue.h"
27 #include "collisionInvSphere.h"
28 #include "collisionLine.h"
30 #include "collisionGeom.h"
31 #include "collisionNode.h"
32 #include "collisionParabola.h"
33 #include "collisionPlane.h"
34 #include "collisionPolygon.h"
35 #include "collisionFloorMesh.h"
36 #include "collisionRay.h"
37 #include "collisionRecorder.h"
38 #include "collisionSegment.h"
39 #include "collisionSolid.h"
40 #include "collisionSphere.h"
41 #include "collisionTraverser.h"
42 #include "collisionVisualizer.h"
43 #include "dconfig.h"
44 
45 #if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_COLLIDE)
46  #error Buildsystem error: BUILDING_PANDA_COLLIDE not defined
47 #endif
48 
49 Configure(config_collide);
50 NotifyCategoryDef(collide, "");
51 
52 ConfigureFn(config_collide) {
54 }
55 
56 ConfigVariableBool respect_prev_transform
57 ("respect-prev-transform", false,
58  PRC_DESC("Set this true to have all CollisionTraversers in the world respect "
59  "the previous frame's transform (position) for a given object when "
60  "determining motion for collision tests. If this is false, you must "
61  "explicitly enable motion detection for a particular traverser. It "
62  "is false by default to force programmers to decide on a "
63  "case-by-case basis whether they really need this feature."));
64 
65 ConfigVariableBool respect_effective_normal
66 ("respect-effective-normal", true,
67  PRC_DESC("This should be true to support the effective_normal interface of "
68  "polygons. Set it false to disable this feature, so that all "
69  "collision solids (including polygons and planes) use their actual "
70  "normal for intersection and physics tests."));
71 
72 ConfigVariableBool allow_collider_multiple
73 ("allow-collider-multiple", false,
74  PRC_DESC("Set this true to enable the use of a DoubleBitMask or QuadBitMask "
75  "to manage many "
76  "colliders added to a single traverser in one pass. If this is "
77  "false, a one-word BitMask is always used instead, which is faster "
78  "per pass, but may require more passes."));
79 
80 ConfigVariableBool flatten_collision_nodes
81 ("flatten-collision-nodes", false,
82  PRC_DESC("Set this true to allow NodePath::flatten_medium() and "
83  "flatten_strong() to combine multiple CollisionNodes "
84  "into a single CollisionNode--but only if they share the "
85  "same name and collide masks. When false, CollisionNodes "
86  "are never combined. This is false by default, since "
87  "collision tests rely heavily on bounding volume tests "
88  "to be efficient, and combining CollisionNodes is likely "
89  "to merge bounding volumes inappropriately."));
90 
91 ConfigVariableDouble collision_parabola_bounds_threshold
92 ("collision-parabola-bounds-threshold", 10.0,
93  PRC_DESC("This is the threshold size for a CollisionParabola to "
94  "make a bounding box (BoundingHexahedron). If the parabola "
95  "is smaller than this, it will make a BoundingSphere instead, "
96  "which is much easier to make and will be good enough for "
97  "small parabolas."));
98 
99 ConfigVariableInt collision_parabola_bounds_sample
100 ("collision-parabola-bounds-sample", 10,
101  PRC_DESC("This is the number of points along a CollisionParabola to "
102  "sample in order to determine an accurate bounding box."));
103 
104 ConfigVariableInt fluid_cap_amount
105 ("fluid-cap-amount", 100,
106  PRC_DESC("ensures that fluid pos doesn't check beyond X feet"));
107 
108 ConfigVariableBool pushers_horizontal
109 ("pushers-horizontal", false,
110  PRC_DESC("Set this true to make all CollisionHandlerPushers have the "
111  "set_horizontal() flag by default, false to let the move "
112  "in three dimensions by default."));
113 
114 /**
115  * Initializes the library. This must be called at least once before any of
116  * the functions or classes in this library can be used. Normally it will be
117  * called by the static initializers and need not be called explicitly, but
118  * special cases exist.
119  */
120 void
122  static bool initialized = false;
123  if (initialized) {
124  return;
125  }
126  initialized = true;
127 
128  CollisionBox::init_type();
129  CollisionCapsule::init_type();
130  CollisionEntry::init_type();
131  CollisionHandler::init_type();
132  CollisionHandlerEvent::init_type();
133  CollisionHandlerHighestEvent::init_type();
134  CollisionHandlerFloor::init_type();
135  CollisionHandlerGravity::init_type();
136  CollisionHandlerPhysical::init_type();
137  CollisionHandlerPusher::init_type();
138  CollisionHandlerFluidPusher::init_type();
139  CollisionHandlerQueue::init_type();
140  CollisionInvSphere::init_type();
141  CollisionLine::init_type();
142  CollisionLevelStateBase::init_type();
143  CollisionGeom::init_type();
144  CollisionNode::init_type();
145  CollisionParabola::init_type();
146  CollisionPlane::init_type();
147  CollisionPolygon::init_type();
148  CollisionFloorMesh::init_type();
149  CollisionRay::init_type();
150  CollisionSegment::init_type();
151  CollisionSolid::init_type();
152  CollisionSphere::init_type();
153  CollisionTraverser::init_type();
154 
155 #ifdef DO_COLLISION_RECORDING
156  CollisionRecorder::init_type();
157  CollisionVisualizer::init_type();
158 #endif
159 
160  // Record the old name for CollisionCapsule for backwards compatibility.
161  BamWriter::record_obsolete_type_name(CollisionCapsule::get_class_type(),
162  "CollisionTube", 6, 44);
163 
176 }
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()
Factory method to generate a CollisionPolygon object.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static void register_with_read_factory()
Factory method to generate a CollisionSphere object.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a convenience class to specialize ConfigVariable as a boolean type.
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.
static void register_with_read_factory()
Tells the BamReader how to create objects of type CollisionCapsule.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static void register_with_read_factory()
Factory method to generate a CollisionBox object.
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.
static void register_with_read_factory()
Tells the BamReader how to create objects of type CollisionSegment.
static void record_obsolete_type_name(TypeHandle type, std::string name, int before_major, int before_minor)
Registers the given type as having an older name in .bam files *before* the indicated version.
Definition: bamWriter.cxx:574
void init_libcollide()
Initializes the library.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static void register_with_read_factory()
Factory method to generate a CollisionInvSphere object.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static void register_with_read_factory()
Tells the BamReader how to create objects of type CollisionRay.
static void register_with_read_factory()
Factory method to generate a CollisionPolygon object.
static void register_with_read_factory()
Factory method to generate a CollisionPlane object.
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.
static void register_with_read_factory()
Tells the BamReader how to create objects of type CollisionNode.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static void register_with_read_factory()
Factory method to generate a CollisionParabola object.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static void register_with_read_factory()
Tells the BamReader how to create objects of type CollisionLine.
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.