From fe05e5e11aa85b2a09c033d59ac77c9b15de99bc Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Wed, 4 Jul 2012 20:52:32 +0000 Subject: [PATCH] test: activate the Bullet Physics test on all Unix platforms. --- .gitignore | 3 ++- test/BtPhysTest.cpp | 17 +++++++++++------ test/BtPhysTest.h | 2 +- test/Makefile.am | 7 ++++++- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 0d22b6e4..7ca394c1 100644 --- a/.gitignore +++ b/.gitignore @@ -60,9 +60,10 @@ build/vs2010/*.XGD !contrib/*/*/*/*/*/* !contrib/*/*/*/*/*/*/* # Our binaries -test/testsuite test/benchsuite +test/btphystest test/quad +test/testsuite test/sandbox/sample test/math/pi test/math/poly diff --git a/test/BtPhysTest.cpp b/test/BtPhysTest.cpp index e6af3e89..8c37da1b 100644 --- a/test/BtPhysTest.cpp +++ b/test/BtPhysTest.cpp @@ -120,7 +120,9 @@ BtPhysTest::BtPhysTest(bool editor) //create a few dynamic rigidbodies // Re-using the same collision is better for memory usage and performance btCollisionShape* colShape = new btBoxShape(btVector3(1,1,1)); - m_rigid_mesh.Compile("[sc#ada afcb2 2 2 -.1]"); + m_rigid_mesh[0].Compile("[sc#daa afcb2 2 2 -.1]"); + m_rigid_mesh[1].Compile("[sc#ada afcb2 2 2 -.1]"); + m_rigid_mesh[2].Compile("[sc#aad afcb2 2 2 -.1]"); m_bt_collision_shapes << colShape; m_bt_dynamic_shapes << colShape; @@ -156,8 +158,9 @@ BtPhysTest::BtPhysTest(bool editor) row2 |=1; } - btVector3 pos(col*2*CUBE_HALF_EXTENTS + (row2%2)*CUBE_HALF_EXTENTS, 20.0f + - row*2*CUBE_HALF_EXTENTS+CUBE_HALF_EXTENTS+EXTRA_HEIGHT,0); + btVector3 pos(((row+col+row2) % 4)*CUBE_HALF_EXTENTS, + 20.0f + row*4*CUBE_HALF_EXTENTS+CUBE_HALF_EXTENTS+EXTRA_HEIGHT, + col*3*CUBE_HALF_EXTENTS + (row2%2)*CUBE_HALF_EXTENTS); trans.setOrigin(pos); @@ -218,7 +221,9 @@ void BtPhysTest::TickDraw(float seconds) if (!m_ready) { m_ground_mesh.MeshConvert(); - m_rigid_mesh.MeshConvert(); + m_rigid_mesh[0].MeshConvert(); + m_rigid_mesh[1].MeshConvert(); + m_rigid_mesh[2].MeshConvert(); /* FIXME: this object never cleans up */ m_ready = true; } @@ -252,14 +257,14 @@ void BtPhysTest::TickDraw(float seconds) if (i == 0) m_ground_mesh.Render(m); else - m_rigid_mesh.Render(m); + m_rigid_mesh[i % 3].Render(m); } if (BarycenterFactor > .0f) { BarycenterLocation /= BarycenterFactor; m_camera->SetTarget(BarycenterLocation); - m_camera->SetPosition(BarycenterLocation + vec3(-20.0f, 5.0f, .0f)); + m_camera->SetPosition(BarycenterLocation + vec3(-15.0f, 8.0f, .0f)); } } diff --git a/test/BtPhysTest.h b/test/BtPhysTest.h index 834e98d3..7e0767da 100644 --- a/test/BtPhysTest.h +++ b/test/BtPhysTest.h @@ -24,7 +24,7 @@ private: Camera* m_camera; bool m_ready; EasyMesh m_ground_mesh; - EasyMesh m_rigid_mesh; + EasyMesh m_rigid_mesh[3]; //Bullet Physics Datas enum diff --git a/test/Makefile.am b/test/Makefile.am index b9707622..46b58d56 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -17,7 +17,7 @@ CLEANFILES = $(noinst_PROGRAMS:%$(EXEEXT)=%.self) \ EXTRA_DIST = data/gradient.png -noinst_PROGRAMS = quad benchsuite testsuite +noinst_PROGRAMS = quad benchsuite testsuite btphystest TESTS = testsuite @@ -41,3 +41,8 @@ quad_CPPFLAGS = @LOL_CFLAGS@ @PIPI_CFLAGS@ quad_LDFLAGS = $(top_builddir)/src/liblol.a @LOL_LIBS@ @PIPI_LIBS@ quad_DEPENDENCIES = $(top_builddir)/src/liblol.a +btphystest_SOURCES = BtPhysTest.cpp BtPhysTest.h +btphystest_CPPFLAGS = @LOL_CFLAGS@ @PIPI_CFLAGS@ -I$(top_builddir)/src/bullet +btphystest_LDFLAGS = $(top_builddir)/src/liblol.a @LOL_LIBS@ @PIPI_LIBS@ +btphystest_DEPENDENCIES = $(top_builddir)/src/liblol.a +