Panda3D

config_collide.cxx

00001 // Filename: config_collide.cxx
00002 // Created by:  drose (24Apr00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #include "config_collide.h"
00016 #include "collisionEntry.h"
00017 #include "collisionHandler.h"
00018 #include "collisionHandlerEvent.h"
00019 #include "collisionHandlerHighestEvent.h"
00020 #include "collisionHandlerFloor.h"
00021 #include "collisionHandlerGravity.h"
00022 #include "collisionHandlerPhysical.h"
00023 #include "collisionHandlerPusher.h"
00024 #include "collisionHandlerFluidPusher.h"
00025 #include "collisionHandlerQueue.h"
00026 #include "collisionDSSolid.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 "collisionBox.h"
00044 #include "collisionVisualizer.h"
00045 #include "dconfig.h"
00046 
00047 Configure(config_collide);
00048 NotifyCategoryDef(collide, "");
00049 
00050 ConfigureFn(config_collide) {
00051   init_libcollide();
00052 }
00053 
00054 ConfigVariableBool respect_prev_transform
00055 ("respect-prev-transform", false,
00056  PRC_DESC("Set this true to have all CollisionTraversers in the world respect "
00057           "the previous frame's transform (position) for a given object when "
00058           "determining motion for collision tests.  If this is false, you must "
00059           "explicitly enable motion detection for a particular traverser.  It "
00060           "is false by default to force programmers to decide on a "
00061           "case-by-case basis whether they really need this feature."));
00062 
00063 ConfigVariableBool respect_effective_normal
00064 ("respect-effective-normal", true,
00065  PRC_DESC("This should be true to support the effective_normal interface of "
00066           "polygons.  Set it false to disable this feature, so that all "
00067           "collision solids (including polygons and planes) use their actual "
00068           "normal for intersection and physics tests."));
00069 
00070 ConfigVariableBool allow_collider_multiple
00071 ("allow-collider-multiple", false,
00072  PRC_DESC("Set this true to enable the use of a DoubleBitMask or QuadBitMask "
00073           "to manage many "
00074           "colliders added to a single traverser in one pass.  If this is "
00075           "false, a one-word BitMask is always used instead, which is faster "
00076           "per pass, but may require more passes."));
00077 
00078 ConfigVariableBool flatten_collision_nodes
00079 ("flatten-collision-nodes", false,
00080  PRC_DESC("Set this true to allow NodePath::flatten_medium() and "
00081           "flatten_strong() to combine multiple CollisionNodes "
00082           "into a single CollisionNode--but only if they share the "
00083           "same name and collide masks.  When false, CollisionNodes "
00084           "are never combined.  This is false by default, since "
00085           "collision tests rely heavily on bounding volume tests "
00086           "to be efficient, and combining CollisionNodes is likely "
00087           "to merge bounding volumes inappropriately."));
00088 
00089 ConfigVariableDouble collision_parabola_bounds_threshold
00090 ("collision-parabola-bounds-threshold", 10.0,
00091  PRC_DESC("This is the threshold size for a CollisionParabola to "
00092           "make a bounding box (BoundingHexahedron).  If the parabola "
00093           "is smaller than this, it will make a BoundingSphere instead, "
00094           "which is much easier to make and will be good enough for "
00095           "small parabolas."));
00096 
00097 ConfigVariableInt collision_parabola_bounds_sample
00098 ("collision-parabola-bounds-sample", 10,
00099  PRC_DESC("This is the number of points along a CollisionParabola to "
00100           "sample in order to determine an accurate bounding box."));
00101 
00102 ConfigVariableInt fluid_cap_amount 
00103 ("fluid-cap-amount", 100,
00104  PRC_DESC("ensures that fluid pos doesn't check beyond X feet"));
00105 
00106 ////////////////////////////////////////////////////////////////////
00107 //     Function: init_libcollide
00108 //  Description: Initializes the library.  This must be called at
00109 //               least once before any of the functions or classes in
00110 //               this library can be used.  Normally it will be
00111 //               called by the static initializers and need not be
00112 //               called explicitly, but special cases exist.
00113 ////////////////////////////////////////////////////////////////////
00114 void
00115 init_libcollide() {
00116   static bool initialized = false;
00117   if (initialized) {
00118     return;
00119   }
00120   initialized = true;
00121 
00122   CollisionEntry::init_type();
00123   CollisionHandler::init_type();
00124   CollisionHandlerEvent::init_type();
00125   CollisionHandlerHighestEvent::init_type();
00126   CollisionHandlerFloor::init_type();
00127   CollisionHandlerGravity::init_type();
00128   CollisionHandlerPhysical::init_type();
00129   CollisionHandlerPusher::init_type();
00130   CollisionHandlerFluidPusher::init_type();
00131   CollisionHandlerQueue::init_type();
00132   CollisionDSSolid::init_type();
00133   CollisionInvSphere::init_type();
00134   CollisionLine::init_type();
00135   CollisionLevelStateBase::init_type();
00136   CollisionGeom::init_type();
00137   CollisionNode::init_type();
00138   CollisionParabola::init_type();
00139   CollisionPlane::init_type();
00140   CollisionPolygon::init_type();
00141   CollisionFloorMesh::init_type();
00142   CollisionRay::init_type();
00143   CollisionSegment::init_type();
00144   CollisionSolid::init_type();
00145   CollisionSphere::init_type();
00146   CollisionTraverser::init_type();
00147   CollisionTube::init_type();
00148   CollisionBox::init_type();
00149 
00150 #ifdef DO_COLLISION_RECORDING
00151   CollisionRecorder::init_type();
00152   CollisionVisualizer::init_type();
00153 #endif
00154 
00155   CollisionDSSolid::register_with_read_factory();
00156   CollisionInvSphere::register_with_read_factory();
00157   CollisionLine::register_with_read_factory();
00158   CollisionNode::register_with_read_factory();
00159   CollisionParabola::register_with_read_factory();
00160   CollisionPlane::register_with_read_factory();
00161   CollisionPolygon::register_with_read_factory();
00162   CollisionFloorMesh::register_with_read_factory();
00163   CollisionRay::register_with_read_factory();
00164   CollisionSegment::register_with_read_factory();
00165   CollisionSphere::register_with_read_factory();
00166   CollisionTube::register_with_read_factory();
00167   CollisionBox::register_with_read_factory();
00168 }
 All Classes Functions Variables Enumerations