瀏覽代碼

test: activate the Bullet Physics test on all Unix platforms.

legacy
Sam Hocevar sam 12 年之前
父節點
當前提交
fe05e5e11a
共有 4 個檔案被更改,包括 20 行新增9 行删除
  1. +2
    -1
      .gitignore
  2. +11
    -6
      test/BtPhysTest.cpp
  3. +1
    -1
      test/BtPhysTest.h
  4. +6
    -1
      test/Makefile.am

+ 2
- 1
.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


+ 11
- 6
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));
}
}



+ 1
- 1
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


+ 6
- 1
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


Loading…
取消
儲存