00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "config_collide.h"
00016 #include "collisionBox.h"
00017 #include "collisionEntry.h"
00018 #include "collisionHandler.h"
00019 #include "collisionHandlerEvent.h"
00020 #include "collisionHandlerHighestEvent.h"
00021 #include "collisionHandlerFloor.h"
00022 #include "collisionHandlerGravity.h"
00023 #include "collisionHandlerPhysical.h"
00024 #include "collisionHandlerPusher.h"
00025 #include "collisionHandlerFluidPusher.h"
00026 #include "collisionHandlerQueue.h"
00027 #include "collisionInvSphere.h"
00028 #include "collisionLine.h"
00029 #include "collisionLevelStateBase.h"
00030 #include "collisionGeom.h"
00031 #include "collisionNode.h"
00032 #include "collisionParabola.h"
00033 #include "collisionPlane.h"
00034 #include "collisionPolygon.h"
00035 #include "collisionFloorMesh.h"
00036 #include "collisionRay.h"
00037 #include "collisionRecorder.h"
00038 #include "collisionSegment.h"
00039 #include "collisionSolid.h"
00040 #include "collisionSphere.h"
00041 #include "collisionTraverser.h"
00042 #include "collisionTube.h"
00043 #include "collisionVisualizer.h"
00044 #include "dconfig.h"
00045
00046 Configure(config_collide);
00047 NotifyCategoryDef(collide, "");
00048
00049 ConfigureFn(config_collide) {
00050 init_libcollide();
00051 }
00052
00053 ConfigVariableBool respect_prev_transform
00054 ("respect-prev-transform", false,
00055 PRC_DESC("Set this true to have all CollisionTraversers in the world respect "
00056 "the previous frame's transform (position) for a given object when "
00057 "determining motion for collision tests. If this is false, you must "
00058 "explicitly enable motion detection for a particular traverser. It "
00059 "is false by default to force programmers to decide on a "
00060 "case-by-case basis whether they really need this feature."));
00061
00062 ConfigVariableBool respect_effective_normal
00063 ("respect-effective-normal", true,
00064 PRC_DESC("This should be true to support the effective_normal interface of "
00065 "polygons. Set it false to disable this feature, so that all "
00066 "collision solids (including polygons and planes) use their actual "
00067 "normal for intersection and physics tests."));
00068
00069 ConfigVariableBool allow_collider_multiple
00070 ("allow-collider-multiple", false,
00071 PRC_DESC("Set this true to enable the use of a DoubleBitMask or QuadBitMask "
00072 "to manage many "
00073 "colliders added to a single traverser in one pass. If this is "
00074 "false, a one-word BitMask is always used instead, which is faster "
00075 "per pass, but may require more passes."));
00076
00077 ConfigVariableBool flatten_collision_nodes
00078 ("flatten-collision-nodes", false,
00079 PRC_DESC("Set this true to allow NodePath::flatten_medium() and "
00080 "flatten_strong() to combine multiple CollisionNodes "
00081 "into a single CollisionNode--but only if they share the "
00082 "same name and collide masks. When false, CollisionNodes "
00083 "are never combined. This is false by default, since "
00084 "collision tests rely heavily on bounding volume tests "
00085 "to be efficient, and combining CollisionNodes is likely "
00086 "to merge bounding volumes inappropriately."));
00087
00088 ConfigVariableDouble collision_parabola_bounds_threshold
00089 ("collision-parabola-bounds-threshold", 10.0,
00090 PRC_DESC("This is the threshold size for a CollisionParabola to "
00091 "make a bounding box (BoundingHexahedron). If the parabola "
00092 "is smaller than this, it will make a BoundingSphere instead, "
00093 "which is much easier to make and will be good enough for "
00094 "small parabolas."));
00095
00096 ConfigVariableInt collision_parabola_bounds_sample
00097 ("collision-parabola-bounds-sample", 10,
00098 PRC_DESC("This is the number of points along a CollisionParabola to "
00099 "sample in order to determine an accurate bounding box."));
00100
00101 ConfigVariableInt fluid_cap_amount
00102 ("fluid-cap-amount", 100,
00103 PRC_DESC("ensures that fluid pos doesn't check beyond X feet"));
00104
00105 ConfigVariableBool pushers_horizontal
00106 ("pushers-horizontal", false,
00107 PRC_DESC("Set this true to make all CollisionHandlerPushers have the "
00108 "set_horizontal() flag by default, false to let the move "
00109 "in three dimensions by default."));
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119 void
00120 init_libcollide() {
00121 static bool initialized = false;
00122 if (initialized) {
00123 return;
00124 }
00125 initialized = true;
00126
00127 CollisionBox::init_type();
00128 CollisionEntry::init_type();
00129 CollisionHandler::init_type();
00130 CollisionHandlerEvent::init_type();
00131 CollisionHandlerHighestEvent::init_type();
00132 CollisionHandlerFloor::init_type();
00133 CollisionHandlerGravity::init_type();
00134 CollisionHandlerPhysical::init_type();
00135 CollisionHandlerPusher::init_type();
00136 CollisionHandlerFluidPusher::init_type();
00137 CollisionHandlerQueue::init_type();
00138 CollisionInvSphere::init_type();
00139 CollisionLine::init_type();
00140 CollisionLevelStateBase::init_type();
00141 CollisionGeom::init_type();
00142 CollisionNode::init_type();
00143 CollisionParabola::init_type();
00144 CollisionPlane::init_type();
00145 CollisionPolygon::init_type();
00146 CollisionFloorMesh::init_type();
00147 CollisionRay::init_type();
00148 CollisionSegment::init_type();
00149 CollisionSolid::init_type();
00150 CollisionSphere::init_type();
00151 CollisionTraverser::init_type();
00152 CollisionTube::init_type();
00153
00154 #ifdef DO_COLLISION_RECORDING
00155 CollisionRecorder::init_type();
00156 CollisionVisualizer::init_type();
00157 #endif
00158
00159 CollisionBox::register_with_read_factory();
00160 CollisionInvSphere::register_with_read_factory();
00161 CollisionLine::register_with_read_factory();
00162 CollisionNode::register_with_read_factory();
00163 CollisionParabola::register_with_read_factory();
00164 CollisionPlane::register_with_read_factory();
00165 CollisionPolygon::register_with_read_factory();
00166 CollisionFloorMesh::register_with_read_factory();
00167 CollisionRay::register_with_read_factory();
00168 CollisionSegment::register_with_read_factory();
00169 CollisionSphere::register_with_read_factory();
00170 CollisionTube::register_with_read_factory();
00171 }