You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

626 lines
17 KiB

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