Panda3D
 All Classes Functions Variables Enumerations
bulletWorld.I
00001 // Filename: bulletWorld.I
00002 // Created by:  enn0x (23Jan10)
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 
00016 ////////////////////////////////////////////////////////////////////
00017 //     Function: BulletWorld::Destructor
00018 //       Access: Published
00019 //  Description:
00020 ////////////////////////////////////////////////////////////////////
00021 INLINE BulletWorld::
00022 ~BulletWorld() {
00023 
00024   while (get_num_characters() > 0) {
00025     remove_character(get_character(0));
00026   }
00027 
00028   while (get_num_vehicles() > 0) {
00029     remove_vehicle(get_vehicle(0));
00030   }
00031 
00032   while (get_num_constraints() > 0) {
00033     remove_constraint(get_constraint(0));
00034   }
00035 
00036   while (get_num_rigid_bodies() > 0) {
00037     remove_rigid_body(get_rigid_body(0));
00038   }
00039 
00040   while (get_num_soft_bodies() > 0) {
00041     remove_soft_body(get_soft_body(0));
00042   }
00043 
00044   while (get_num_ghosts() > 0) {
00045     remove_ghost(get_ghost(0));
00046   }
00047 
00048   _info.m_sparsesdf.Reset();
00049 
00050   delete _world;
00051   delete _solver;
00052   delete _configuration;
00053   delete _dispatcher;
00054   delete _broadphase;
00055 }
00056 
00057 ////////////////////////////////////////////////////////////////////
00058 //     Function: BulletWorld::get_world
00059 //       Access: Public
00060 //  Description:
00061 ////////////////////////////////////////////////////////////////////
00062 INLINE btDynamicsWorld *BulletWorld::
00063 get_world() const {
00064 
00065   return _world;
00066 }
00067 
00068 ////////////////////////////////////////////////////////////////////
00069 //     Function: BulletWorld::get_broadphase
00070 //       Access: Public
00071 //  Description:
00072 ////////////////////////////////////////////////////////////////////
00073 INLINE btBroadphaseInterface *BulletWorld::
00074 get_broadphase() const {
00075 
00076   return _broadphase;
00077 }
00078 
00079 ////////////////////////////////////////////////////////////////////
00080 //     Function: BulletWorld::get_dispatcher
00081 //       Access: Public
00082 //  Description:
00083 ////////////////////////////////////////////////////////////////////
00084 INLINE btDispatcher *BulletWorld::
00085 get_dispatcher() const {
00086 
00087   return _dispatcher;
00088 }
00089 
00090 ////////////////////////////////////////////////////////////////////
00091 //     Function: BulletWorld::get_num_rigid_bodies
00092 //       Access: Published
00093 //  Description:
00094 ////////////////////////////////////////////////////////////////////
00095 INLINE int BulletWorld::
00096 get_num_rigid_bodies() const {
00097 
00098   return _bodies.size();
00099 }
00100 
00101 ////////////////////////////////////////////////////////////////////
00102 //     Function: BulletWorld::get_rigid_body
00103 //       Access: Published
00104 //  Description:
00105 ////////////////////////////////////////////////////////////////////
00106 INLINE BulletRigidBodyNode *BulletWorld::
00107 get_rigid_body(int idx) const {
00108 
00109   nassertr(idx >= 0 && idx < (int)_bodies.size(), NULL);
00110   return _bodies[idx];
00111 }
00112 
00113 ////////////////////////////////////////////////////////////////////
00114 //     Function: BulletWorld::get_num_soft_bodies
00115 //       Access: Published
00116 //  Description:
00117 ////////////////////////////////////////////////////////////////////
00118 INLINE int BulletWorld::
00119 get_num_soft_bodies() const {
00120 
00121   return _softbodies.size();
00122 }
00123 
00124 ////////////////////////////////////////////////////////////////////
00125 //     Function: BulletWorld::get_soft_body
00126 //       Access: Published
00127 //  Description:
00128 ////////////////////////////////////////////////////////////////////
00129 INLINE BulletSoftBodyNode *BulletWorld::
00130 get_soft_body(int idx) const {
00131 
00132   nassertr(idx >= 0 && idx < (int)_softbodies.size(), NULL);
00133   return _softbodies[idx];
00134 }
00135 
00136 ////////////////////////////////////////////////////////////////////
00137 //     Function: BulletWorld::get_num_ghosts
00138 //       Access: Published
00139 //  Description:
00140 ////////////////////////////////////////////////////////////////////
00141 INLINE int BulletWorld::
00142 get_num_ghosts() const {
00143 
00144   return _ghosts.size();
00145 }
00146 
00147 ////////////////////////////////////////////////////////////////////
00148 //     Function: BulletWorld::get_ghost
00149 //       Access: Published
00150 //  Description:
00151 ////////////////////////////////////////////////////////////////////
00152 INLINE BulletGhostNode *BulletWorld::
00153 get_ghost(int idx) const {
00154 
00155   nassertr(idx >= 0 && idx < (int)_ghosts.size(), NULL);
00156   return _ghosts[idx];
00157 }
00158 
00159 ////////////////////////////////////////////////////////////////////
00160 //     Function: BulletWorld::get_num_characters
00161 //       Access: Published
00162 //  Description:
00163 ////////////////////////////////////////////////////////////////////
00164 INLINE int BulletWorld::
00165 get_num_characters() const {
00166 
00167   return _characters.size();
00168 }
00169 
00170 ////////////////////////////////////////////////////////////////////
00171 //     Function: BulletWorld::get_character
00172 //       Access: Published
00173 //  Description:
00174 ////////////////////////////////////////////////////////////////////
00175 INLINE BulletBaseCharacterControllerNode *BulletWorld::
00176 get_character(int idx) const {
00177 
00178   nassertr(idx >= 0 && idx < (int)_characters.size(), NULL);
00179   return _characters[idx];
00180 }
00181 
00182 ////////////////////////////////////////////////////////////////////
00183 //     Function: BulletWorld::get_num_vehicles
00184 //       Access: Published
00185 //  Description:
00186 ////////////////////////////////////////////////////////////////////
00187 INLINE int BulletWorld::
00188 get_num_vehicles() const {
00189 
00190   return _vehicles.size();
00191 }
00192 
00193 ////////////////////////////////////////////////////////////////////
00194 //     Function: BulletWorld::get_vehicle
00195 //       Access: Published
00196 //  Description:
00197 ////////////////////////////////////////////////////////////////////
00198 INLINE BulletVehicle *BulletWorld::
00199 get_vehicle(int idx) const {
00200 
00201   nassertr(idx >= 0 && idx < (int)_vehicles.size(), NULL);
00202   return _vehicles[idx];
00203 }
00204 
00205 ////////////////////////////////////////////////////////////////////
00206 //     Function: BulletWorld::get_num_constraints
00207 //       Access: Published
00208 //  Description:
00209 ////////////////////////////////////////////////////////////////////
00210 INLINE int BulletWorld::
00211 get_num_constraints() const {
00212 
00213   return _constraints.size();
00214 }
00215 
00216 ////////////////////////////////////////////////////////////////////
00217 //     Function: BulletWorld::get_constraint
00218 //       Access: Published
00219 //  Description:
00220 ////////////////////////////////////////////////////////////////////
00221 INLINE BulletConstraint *BulletWorld::
00222 get_constraint(int idx) const {
00223 
00224   nassertr(idx >= 0 && idx < (int)_constraints.size(), NULL);
00225   return _constraints[idx];
00226 }
00227 
00228 ////////////////////////////////////////////////////////////////////
00229 //     Function: BulletWorld::get_num_manifolds
00230 //       Access: Published
00231 //  Description: 
00232 ////////////////////////////////////////////////////////////////////
00233 INLINE int BulletWorld::
00234 get_num_manifolds() const {
00235 
00236   return _world->getDispatcher()->getNumManifolds();
00237 }
00238 
00239 
 All Classes Functions Variables Enumerations