選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

BtPhysTest.cpp 16 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. //
  2. // BtPhysTest
  3. //
  4. // Copyright: (c) 2009-2012 Benjamin Huet <huet.benjamin@gmail.com>
  5. // (c) 2012 Sam Hocevar <sam@hocevar.net>
  6. //
  7. #if defined HAVE_CONFIG_H
  8. # include "config.h"
  9. #endif
  10. #if defined _WIN32
  11. # include <direct.h>
  12. #endif
  13. #if defined _XBOX
  14. # define _USE_MATH_DEFINES /* for M_PI */
  15. # include <xtl.h>
  16. # undef near /* Fuck Microsoft */
  17. # undef far /* Fuck Microsoft again */
  18. #elif defined _WIN32
  19. # define _USE_MATH_DEFINES /* for M_PI */
  20. # define WIN32_LEAN_AND_MEAN
  21. # include <windows.h>
  22. # undef near /* Fuck Microsoft */
  23. # undef far /* Fuck Microsoft again */
  24. #else
  25. # include <cmath>
  26. #endif
  27. #include "core.h"
  28. #include "loldebug.h"
  29. using namespace lol;
  30. #ifndef HAVE_PHYS_USE_BULLET
  31. #define HAVE_PHYS_USE_BULLET
  32. #endif /* HAVE_PHYS_USE_BULLET */
  33. #include "Physics/LolPhysics.h"
  34. #include "Physics/EasyPhysics.h"
  35. #include "PhysicObject.h"
  36. #include "BtPhysTest.h"
  37. using namespace lol::phys;
  38. #define CUBE_HALF_EXTENTS .5f
  39. #define EXTRA_HEIGHT 1.f
  40. int gNumObjects = 64;
  41. #define USE_WALL 1
  42. #define USE_PLATFORM 1
  43. #define USE_ROPE 0
  44. #define USE_BODIES 0
  45. #define USE_ROTATION 0
  46. #define USE_CHARACTER 1
  47. BtPhysTest::BtPhysTest(bool editor)
  48. {
  49. /* Create a camera that matches the settings of XNA BtPhysTest */
  50. m_camera = new Camera(vec3(0.f, 600.f, 0.f),
  51. vec3(0.f, 0.f, 0.f),
  52. vec3(0, 1, 0));
  53. m_camera->SetRotation(quat::fromeuler_xyz(0.f, 0.f, 0.f));
  54. m_camera->SetPerspective(45.f, 1280.f, 960.f, .1f, 1000.f);
  55. //m_camera->SetOrtho(1280.f / 6, 960.f / 6, -1000.f, 1000.f);
  56. Ticker::Ref(m_camera);
  57. m_ready = false;
  58. m_simulation = new Simulation();
  59. m_simulation->Init();
  60. vec3 NewGravity = vec3(.0f, -10.0f, .0f);
  61. m_simulation->SetGravity(NewGravity);
  62. m_simulation->SetContinuousDetection(true);
  63. m_simulation->SetTimestep(1.f / 120.f);
  64. Ticker::Ref(m_simulation);
  65. float offset = 29.5f;
  66. vec3 pos_offset = vec3(.0f, 30.f, .0f);
  67. if (USE_WALL)
  68. {
  69. for (int i=0; i < 6; i++)
  70. {
  71. vec3 NewPosition = vec3(.0f);
  72. quat NewRotation = quat(1.f);
  73. PhysicsObject* NewPhyobj = new PhysicsObject(m_simulation, NewPosition, NewRotation);
  74. int idx = i/2;
  75. NewPosition = pos_offset;
  76. NewPosition[idx] += offset;
  77. offset *= -1.f;
  78. if (idx != 1)
  79. {
  80. vec3 axis = vec3(.0f);
  81. axis[2 - idx] = 1;
  82. NewRotation = quat::rotate(90.f, axis);
  83. }
  84. NewPhyobj->SetTransform(NewPosition, NewRotation);
  85. Ticker::Ref(NewPhyobj);
  86. m_ground_list << NewPhyobj;
  87. }
  88. }
  89. if (USE_PLATFORM)
  90. {
  91. quat NewRotation = quat::fromeuler_xyz(5.f, 0.f, 0.f);
  92. vec3 NewPosition = pos_offset + vec3(5.0f, -20.0f, -15.0f);
  93. PhysicsObject* NewPhyobj = new PhysicsObject(m_simulation, NewPosition, NewRotation, 1);
  94. m_platform_list << NewPhyobj;
  95. Ticker::Ref(NewPhyobj);
  96. NewPosition = pos_offset + vec3(-20.0f, -25.0f, 5.0f);
  97. NewPhyobj = new PhysicsObject(m_simulation, NewPosition, NewRotation, 1);
  98. m_platform_list << NewPhyobj;
  99. Ticker::Ref(NewPhyobj);
  100. }
  101. if (USE_CHARACTER)
  102. {
  103. quat NewRotation = quat::fromeuler_xyz(0.f, 0.f, 0.f);
  104. vec3 NewPosition = pos_offset + vec3(.0f, 40.0f, .0f);
  105. PhysicsObject* NewPhyobj = new PhysicsObject(m_simulation, NewPosition, NewRotation, 2);
  106. m_character_list << NewPhyobj;
  107. Ticker::Ref(NewPhyobj);
  108. }
  109. if (USE_BODIES)
  110. {
  111. for (int x=0; x < 6; x++)
  112. {
  113. for (int y=0; y < 6; y++)
  114. {
  115. for (int z=0; z < 5; z++)
  116. {
  117. PhysicsObject* new_physobj = new PhysicsObject(m_simulation, 1000.f,
  118. vec3(-20.f, 15.f, -20.f) +
  119. vec3(8.f * (float)x, 8.f * (float)y, 8.f * (float)z));
  120. m_physobj_list << new_physobj;
  121. Ticker::Ref(new_physobj);
  122. }
  123. }
  124. }
  125. }
  126. if (USE_ROPE)
  127. {
  128. Array<PhysicsObject*> RopeElements;
  129. for (int i = 0; i < 14; i++)
  130. {
  131. PhysicsObject* new_physobj = new PhysicsObject(m_simulation, 1000.f,
  132. vec3(0.f, 15.f, -20.f) +
  133. vec3(0.f, 0.f, 2.f * (float)i), 1);
  134. RopeElements << new_physobj;
  135. m_physobj_list << new_physobj;
  136. Ticker::Ref(new_physobj);
  137. if (RopeElements.Count() > 1)
  138. {
  139. EasyConstraint* new_constraint = new EasyConstraint();
  140. vec3 A2B = .5f * (RopeElements[i]->GetPhysic()->GetTransform().v3.xyz -
  141. RopeElements[i - 1]->GetPhysic()->GetTransform().v3.xyz);
  142. new_constraint->SetPhysObjA(RopeElements[i - 1]->GetPhysic(), lol::mat4::translate(A2B));
  143. new_constraint->SetPhysObjB(RopeElements[i]->GetPhysic(), lol::mat4::translate(-A2B));
  144. new_constraint->InitConstraintToPoint2Point();
  145. new_constraint->DisableCollisionBetweenObjs(true);
  146. new_constraint->AddToSimulation(m_simulation);
  147. m_constraint_list << new_constraint;
  148. }
  149. }
  150. }
  151. #if 0
  152. //init Physics
  153. {
  154. m_bt_ccd_mode = USE_CCD;
  155. //collision configuration contains default setup for memory, collision setup
  156. m_bt_collision_config = new btDefaultCollisionConfiguration();
  157. //use the default collision dispatcher. For parallel processing you can use a diffent dispatcher (see Extras/BulletMultiThreaded)
  158. m_bt_dispatcher = new btCollisionDispatcher(m_bt_collision_config);
  159. m_bt_dispatcher->registerCollisionCreateFunc(BOX_SHAPE_PROXYTYPE,
  160. BOX_SHAPE_PROXYTYPE,
  161. m_bt_collision_config->getCollisionAlgorithmCreateFunc(CONVEX_SHAPE_PROXYTYPE,
  162. CONVEX_SHAPE_PROXYTYPE));
  163. m_bt_broadphase = new btDbvtBroadphase();
  164. ///the default constraint solver. For parallel processing you can use a different solver (see Extras/BulletMultiThreaded)
  165. m_bt_solver = new btSequentialImpulseConstraintSolver;
  166. m_bt_world = new btDiscreteDynamicsWorld(m_bt_dispatcher, m_bt_broadphase, m_bt_solver, m_bt_collision_config);
  167. //m_bt_world->setDebugDrawer(&sDebugDrawer);
  168. m_bt_world->getSolverInfo().m_splitImpulse = true;
  169. m_bt_world->getSolverInfo().m_numIterations = 20;
  170. m_bt_world->getDispatchInfo().m_useContinuous = (m_bt_ccd_mode == USE_CCD);
  171. m_bt_world->setGravity(btVector3(0,-10,0));
  172. ///create a few basic rigid bodies
  173. btBoxShape* box = new btBoxShape(btVector3(btScalar(110.),btScalar(1.),btScalar(110.)));
  174. btCollisionShape* groundShape = box;
  175. m_bt_collision_shapes << groundShape;
  176. m_ground_mesh.Compile("[sc#ddd afcb220 2 220 -1]");
  177. //m_bt_collision_shapes << new btCylinderShape(btVector3(.5f,.5f,.5f));
  178. btTransform groundTransform;
  179. groundTransform.setIdentity();
  180. //We can also use DemoApplication::localCreateRigidBody, but for clarity it is provided here:
  181. {
  182. btScalar mass(0.);
  183. //rigidbody is dynamic if and only if mass is non zero, otherwise static
  184. bool isDynamic = (mass != 0.f);
  185. btVector3 localInertia(0,0,0);
  186. if (isDynamic)
  187. groundShape->calculateLocalInertia(mass,localInertia);
  188. //using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects
  189. btDefaultMotionState* myMotionState = new btDefaultMotionState(groundTransform);
  190. btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,groundShape,localInertia);
  191. btRigidBody* body = new btRigidBody(rbInfo);
  192. //add the body to the dynamics world
  193. m_bt_world->addRigidBody(body);
  194. }
  195. //Adding Shapes
  196. {
  197. //create a few dynamic rigidbodies
  198. // Re-using the same collision is better for memory usage and performance
  199. btCollisionShape* colShape = new btBoxShape(btVector3(1,1,1));
  200. m_rigid_mesh[0].Compile("[sc#add afcb2 2 2 -.1]");
  201. m_rigid_mesh[1].Compile("[sc#dad afcb2 2 2 -.1]");
  202. m_rigid_mesh[2].Compile("[sc#dda afcb2 2 2 -.1]");
  203. m_rigid_mesh[3].Compile("[sc#daa afcb2 2 2 -.1]");
  204. m_rigid_mesh[4].Compile("[sc#ada afcb2 2 2 -.1]");
  205. m_rigid_mesh[5].Compile("[sc#aad afcb2 2 2 -.1]");
  206. m_bt_collision_shapes << colShape;
  207. m_bt_dynamic_shapes << colShape;
  208. /// Create Dynamic Objects
  209. btTransform startTransform;
  210. startTransform.setIdentity();
  211. btScalar mass(1.f);
  212. //rigidbody is dynamic if and only if mass is non zero, otherwise static
  213. bool isDynamic = (mass != 0.f);
  214. btVector3 localInertia(0,0,0);
  215. if (isDynamic)
  216. colShape->calculateLocalInertia(mass,localInertia);
  217. int i;
  218. for (i=0;i<gNumObjects;i++)
  219. {
  220. btCollisionShape* shape = colShape;
  221. btTransform trans;
  222. trans.setIdentity();
  223. //stack them
  224. int colsize = 10;
  225. int row = int(((float)i*CUBE_HALF_EXTENTS*2.0f)/((float)colsize*2.0f*CUBE_HALF_EXTENTS));
  226. int row2 = row;
  227. int col = (i)%(colsize)-colsize/2;
  228. if (col>3)
  229. {
  230. col=11;
  231. row2 |=1;
  232. }
  233. btVector3 pos(((row+col+row2) % 4)*CUBE_HALF_EXTENTS,
  234. 20.0f + row*8*CUBE_HALF_EXTENTS+CUBE_HALF_EXTENTS+EXTRA_HEIGHT,
  235. col*8*CUBE_HALF_EXTENTS + 2 * (row2%2)*CUBE_HALF_EXTENTS);
  236. trans.setOrigin(pos);
  237. float mass = 1.f;
  238. btAssert((!shape || shape->getShapeType() != INVALID_SHAPE_PROXYTYPE));
  239. //rigidbody is dynamic if and only if mass is non zero, otherwise static
  240. bool isDynamic = (mass != 0.f);
  241. btVector3 localInertia(0,0,0);
  242. if (isDynamic)
  243. shape->calculateLocalInertia(mass,localInertia);
  244. //using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects
  245. btDefaultMotionState* myMotionState = new btDefaultMotionState(trans);
  246. btRigidBody::btRigidBodyConstructionInfo cInfo(mass,myMotionState,shape,localInertia);
  247. btRigidBody* body = new btRigidBody(cInfo);
  248. body->setContactProcessingThreshold(BT_LARGE_FLOAT);
  249. m_bt_world->addRigidBody(body);
  250. ///when using m_ccdMode
  251. if (m_bt_ccd_mode == USE_CCD)
  252. {
  253. body->setCcdMotionThreshold(CUBE_HALF_EXTENTS);
  254. body->setCcdSweptSphereRadius(0.9*CUBE_HALF_EXTENTS);
  255. }
  256. }
  257. }
  258. }
  259. #endif
  260. }
  261. void BtPhysTest::TickGame(float seconds)
  262. {
  263. WorldEntity::TickGame(seconds);
  264. if (Input::GetButtonState(27 /*SDLK_ESCAPE*/))
  265. Ticker::Shutdown();
  266. vec3 GroundBarycenter = vec3(.0f);
  267. vec3 PhysObjBarycenter = vec3(.0f);
  268. float factor = .0f;
  269. if (USE_WALL)
  270. {
  271. for (int i = 0; i < m_ground_list.Count(); i++)
  272. {
  273. PhysicsObject* PhysObj = m_ground_list[i];
  274. mat4 GroundMat = PhysObj->GetTransform();
  275. GroundBarycenter += GroundMat.v3.xyz;
  276. factor += 1.f;
  277. }
  278. GroundBarycenter /= factor;
  279. for (int i = 0; i < m_ground_list.Count(); i++)
  280. {
  281. PhysicsObject* PhysObj = m_ground_list[i];
  282. mat4 GroundMat = PhysObj->GetTransform();
  283. vec3 CenterToGround = GroundMat.v3.xyz - GroundBarycenter;
  284. vec3 CenterToCam = m_camera->m_position - GroundBarycenter;
  285. if (dot(normalize(CenterToCam - CenterToGround),
  286. normalize(CenterToGround)) > 0.f)
  287. PhysObj->SetRender(false);
  288. else
  289. PhysObj->SetRender(true);
  290. }
  291. }
  292. if (USE_ROTATION)
  293. {
  294. for (int i = 0; i < m_ground_list.Count(); i++)
  295. {
  296. PhysicsObject* PhysObj = m_ground_list[i];
  297. mat4 GroundMat = PhysObj->GetTransform();
  298. mat4 CenterMx = mat4::translate(GroundBarycenter);
  299. GroundMat = inverse(CenterMx) * GroundMat;
  300. GroundMat = CenterMx *
  301. mat4(quat::fromeuler_xyz(vec3(.0f, 20.f, 20.0f) * seconds))
  302. * GroundMat;
  303. PhysObj->SetTransform(GroundMat.v3.xyz, quat(GroundMat));
  304. }
  305. }
  306. if (USE_PLATFORM)
  307. {
  308. for (int i = 0; i < m_platform_list.Count(); i++)
  309. {
  310. PhysicsObject* PhysObj = m_platform_list[i];
  311. mat4 GroundMat = PhysObj->GetTransform();
  312. if (i == 0)
  313. {
  314. GroundMat = GroundMat * mat4(quat::fromeuler_xyz(vec3(20.f, .0f, .0f) * seconds));
  315. PhysObj->SetTransform(GroundMat.v3.xyz, quat(GroundMat));
  316. }
  317. else
  318. {
  319. GroundMat = GroundMat * mat4::translate(vec3(.0f, .0f, 10.0f) * seconds);
  320. if (GroundMat.v3.z > 40.0f)
  321. GroundMat = GroundMat * mat4::translate(vec3(.0f, .0f, -80.0f));
  322. PhysObj->SetTransform(GroundMat.v3.xyz, quat(GroundMat));
  323. }
  324. }
  325. }
  326. if (USE_CHARACTER)
  327. {
  328. for (int i = 0; i < m_character_list.Count(); i++)
  329. {
  330. PhysicsObject* PhysObj = m_character_list[i];
  331. mat4 GroundMat = PhysObj->GetTransform();
  332. PhysObjBarycenter += GroundMat.v3.xyz;
  333. factor += 1.f;
  334. }
  335. PhysObjBarycenter /= factor;
  336. m_camera->SetTarget(PhysObjBarycenter);
  337. m_camera->SetPosition(PhysObjBarycenter + vec3(-80.0f, 80.0f, .0f));
  338. }
  339. else
  340. {
  341. PhysObjBarycenter = vec3(.0f);
  342. for (int i = 0; i < m_physobj_list.Count(); i++)
  343. {
  344. PhysicsObject* PhysObj = m_physobj_list[i];
  345. mat4 GroundMat = PhysObj->GetTransform();
  346. PhysObjBarycenter += GroundMat.v3.xyz;
  347. factor += 1.f;
  348. }
  349. PhysObjBarycenter /= factor;
  350. m_camera->SetTarget(PhysObjBarycenter);
  351. m_camera->SetPosition(GroundBarycenter + normalize(GroundBarycenter - PhysObjBarycenter) * 60.0f);
  352. }
  353. #if 0
  354. ///step the simulation
  355. if (m_bt_world)
  356. {
  357. //int steps = (int)(seconds / 0.005f);
  358. //for (int i = 0; i < steps; i++)
  359. m_bt_world->stepSimulation(seconds /*/ steps*/);
  360. //optional but useful: debug drawing
  361. //m_bt_world->debugDrawWorld();
  362. }
  363. #endif
  364. }
  365. void BtPhysTest::TickDraw(float seconds)
  366. {
  367. WorldEntity::TickDraw(seconds);
  368. if (!m_ready)
  369. {
  370. #if 0
  371. m_ground_mesh.MeshConvert();
  372. m_rigid_mesh[0].MeshConvert();
  373. m_rigid_mesh[1].MeshConvert();
  374. m_rigid_mesh[2].MeshConvert();
  375. m_rigid_mesh[3].MeshConvert();
  376. m_rigid_mesh[4].MeshConvert();
  377. m_rigid_mesh[5].MeshConvert();
  378. #endif
  379. /* FIXME: this object never cleans up */
  380. m_ready = true;
  381. }
  382. //Video::SetClearColor(vec4(0.0f, 0.0f, 0.12f, 1.0f));
  383. #if 0
  384. vec3 BarycenterLocation = vec3(.0f);
  385. float BarycenterFactor = 0.0f;
  386. for(int i=0;i<gNumObjects;i++)
  387. {
  388. mat4 m(1.0f);
  389. btMatrix3x3 rot; rot.setIdentity();
  390. btCollisionObject* colObj = m_bt_world->getCollisionObjectArray()[i];
  391. btRigidBody* body = btRigidBody::upcast(colObj);
  392. if(body && body->getMotionState())
  393. {
  394. btDefaultMotionState* myMotionState = (btDefaultMotionState*)body->getMotionState();
  395. myMotionState->m_graphicsWorldTrans.getOpenGLMatrix(&m[0][0]);
  396. rot = myMotionState->m_graphicsWorldTrans.getBasis();
  397. }
  398. else
  399. {
  400. colObj->getWorldTransform().getOpenGLMatrix(&m[0][0]);
  401. rot = colObj->getWorldTransform().getBasis();
  402. }
  403. if (i > 0)
  404. {
  405. BarycenterLocation += m.v3.xyz;
  406. BarycenterFactor += 1.0f;
  407. }
  408. if (i == 0)
  409. m_ground_mesh.Render(m);
  410. else
  411. m_rigid_mesh[i % 6].Render(m);
  412. }
  413. if (BarycenterFactor > .0f)
  414. {
  415. BarycenterLocation /= BarycenterFactor;
  416. m_camera->SetTarget(BarycenterLocation);
  417. m_camera->SetPosition(BarycenterLocation + vec3(-20.0f, 8.0f, .0f));
  418. }
  419. #endif
  420. }
  421. BtPhysTest::~BtPhysTest()
  422. {
  423. Ticker::Unref(m_camera);
  424. while (m_constraint_list.Count())
  425. {
  426. EasyConstraint* CurPop = m_constraint_list.Last();
  427. m_constraint_list.Pop();
  428. CurPop->RemoveFromSimulation(m_simulation);
  429. delete CurPop;
  430. }
  431. while (m_ground_list.Count())
  432. {
  433. PhysicsObject* CurPop = m_ground_list.Last();
  434. m_ground_list.Pop();
  435. CurPop->GetPhysic()->RemoveFromSimulation(m_simulation);
  436. Ticker::Unref(CurPop);
  437. }
  438. while (m_character_list.Count())
  439. {
  440. PhysicsObject* CurPop = m_character_list.Last();
  441. m_character_list.Pop();
  442. CurPop->GetCharacter()->RemoveFromSimulation(m_simulation);
  443. Ticker::Unref(CurPop);
  444. }
  445. while (m_platform_list.Count())
  446. {
  447. PhysicsObject* CurPop = m_platform_list.Last();
  448. m_platform_list.Pop();
  449. CurPop->GetPhysic()->RemoveFromSimulation(m_simulation);
  450. Ticker::Unref(CurPop);
  451. }
  452. while (m_physobj_list.Count())
  453. {
  454. PhysicsObject* CurPop = m_physobj_list.Last();
  455. m_physobj_list.Pop();
  456. CurPop->GetPhysic()->RemoveFromSimulation(m_simulation);
  457. Ticker::Unref(CurPop);
  458. }
  459. Ticker::Unref(m_simulation);
  460. #if 0
  461. //Exit Physics
  462. {
  463. //cleanup in the reverse order of creation/initialization
  464. //remove the rigidbodies from the dynamics world and delete them
  465. for (int i = m_bt_world->getNumCollisionObjects() - 1; i >= 0 ;i--)
  466. {
  467. btCollisionObject* obj = m_bt_world->getCollisionObjectArray()[i];
  468. btRigidBody* body = btRigidBody::upcast(obj);
  469. if (body && body->getMotionState())
  470. delete body->getMotionState();
  471. m_bt_world->removeCollisionObject(obj);
  472. delete obj;
  473. }
  474. //delete collision shapes
  475. for (int j = 0; j < m_bt_collision_shapes.Count(); j++)
  476. {
  477. btCollisionShape* shape = m_bt_collision_shapes[j];
  478. delete shape;
  479. }
  480. m_bt_collision_shapes.Empty();
  481. delete m_bt_world;
  482. delete m_bt_solver;
  483. delete m_bt_broadphase;
  484. delete m_bt_dispatcher;
  485. delete m_bt_collision_config;
  486. }
  487. #endif
  488. }
  489. int main(int argc, char **argv)
  490. {
  491. Application app("BtPhysTest", ivec2(1280, 720), 60.0f);
  492. #if defined _MSC_VER && !defined _XBOX
  493. _chdir("..");
  494. #elif defined _WIN32 && !defined _XBOX
  495. _chdir("../..");
  496. #endif
  497. new BtPhysTest(argc > 1);
  498. app.ShowPointer(false);
  499. app.Run();
  500. return EXIT_SUCCESS;
  501. }