00001 // Filename: config_physics.cxx 00002 // Created by: charles (17Jul00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #include "config_physics.h" 00020 #include "physicsObject.h" 00021 #include "physicalNode.h" 00022 #include "linearIntegrator.h" 00023 #include "angularIntegrator.h" 00024 #include "forceNode.h" 00025 #include "forces.h" 00026 #include "actorNode.h" 00027 #include "angularForce.h" 00028 #include "angularVectorForce.h" 00029 00030 #include "dconfig.h" 00031 00032 ConfigureDef(config_physics); 00033 NotifyCategoryDef(physics, ""); 00034 00035 ConfigureFn(config_physics) { 00036 init_libphysics(); 00037 } 00038 00039 const float LinearIntegrator::_max_linear_dt = 00040 config_physics.GetFloat("default_max_linear_dt", 1.0f / 30.0f); 00041 00042 const float AngularIntegrator::_max_angular_dt = 00043 config_physics.GetFloat("default_max_angular_dt", 1.0f / 30.0f); 00044 00045 int LinearNoiseForce::_random_seed = 00046 config_physics.GetInt("default_noise_force_seed", 665); 00047 00048 const float PhysicsObject::_default_terminal_velocity = 00049 config_physics.GetFloat("default_terminal_velocity", 400.0f); 00050 00051 //////////////////////////////////////////////////////////////////// 00052 // Function: init_libphysics 00053 // Description: Initializes the library. This must be called at 00054 // least once before any of the functions or classes in 00055 // this library can be used. Normally it will be 00056 // called by the static initializers and need not be 00057 // called explicitly, but special cases exist. 00058 //////////////////////////////////////////////////////////////////// 00059 void 00060 init_libphysics() { 00061 static bool initialized = false; 00062 if (initialized) { 00063 return; 00064 } 00065 initialized = true; 00066 00067 ActorNode::init_type(); 00068 AngularForce::init_type(); 00069 AngularVectorForce::init_type(); 00070 BaseForce::init_type(); 00071 ForceNode::init_type(); 00072 LinearCylinderVortexForce::init_type(); 00073 LinearDistanceForce::init_type(); 00074 LinearForce::init_type(); 00075 LinearFrictionForce::init_type(); 00076 LinearJitterForce::init_type(); 00077 LinearNoiseForce::init_type(); 00078 LinearRandomForce::init_type(); 00079 LinearSinkForce::init_type(); 00080 LinearSourceForce::init_type(); 00081 LinearUserDefinedForce::init_type(); 00082 LinearVectorForce::init_type(); 00083 Physical::init_type(); 00084 PhysicalNode::init_type(); 00085 PhysicsObject::init_type(); 00086 }