Use a local grid mesh

This commit is contained in:
Irlan 2019-05-13 16:23:46 -03:00
parent 31cac5aacd
commit 6f50645601

View File

@ -24,6 +24,8 @@ class MeshContactTest : public Test
public: public:
MeshContactTest() MeshContactTest()
{ {
m_gridMesh.BuildTree();
// Transform grid into a terrain // Transform grid into a terrain
for (u32 i = 0; i < m_terrainMesh.vertexCount; ++i) for (u32 i = 0; i < m_terrainMesh.vertexCount; ++i)
{ {
@ -37,7 +39,7 @@ public:
m_ground = m_world.CreateBody(bd); m_ground = m_world.CreateBody(bd);
b3MeshShape ms; b3MeshShape ms;
ms.m_mesh = &m_groundMesh; ms.m_mesh = &m_gridMesh;
b3ShapeDef sd; b3ShapeDef sd;
sd.shape = &ms; sd.shape = &ms;
@ -138,7 +140,7 @@ public:
if (key == GLFW_KEY_G) if (key == GLFW_KEY_G)
{ {
b3MeshShape ms; b3MeshShape ms;
ms.m_mesh = &m_groundMesh; ms.m_mesh = &m_gridMesh;
b3ShapeDef sd; b3ShapeDef sd;
sd.shape = &ms; sd.shape = &ms;
@ -176,7 +178,8 @@ public:
} }
b3GridMesh<25, 25> m_terrainMesh; b3GridMesh<25, 25> m_terrainMesh;
b3GridMesh<25, 25> m_gridMesh;
b3Body* m_ground; b3Body* m_ground;
b3Body* m_body; b3Body* m_body;
}; };