diff --git a/examples/testbed/framework/test_entries.cpp b/examples/testbed/framework/test_entries.cpp index ca3e394..708aa6c 100644 --- a/examples/testbed/framework/test_entries.cpp +++ b/examples/testbed/framework/test_entries.cpp @@ -61,7 +61,7 @@ #include #include #include -#include +#include #include #include #include @@ -111,7 +111,7 @@ TestEntry g_tests[] = { "Cloth", &Cloth::Create }, { "Spring Cloth", &SpringCloth::Create }, { "Spring Cloth Collision", &SpringClothCollision::Create }, - { "Spring Cloth Dragging", &ClothDraggerTest::Create }, + { "Spring Cloth Dragging", &SpringClothDraggerTest::Create }, { "Rope", &Rope::Create }, { "Mass-Spring System", &MassSpring::Create }, { "Shift Center", &ShiftCenter::Create }, diff --git a/examples/testbed/tests/cloth_test.h b/examples/testbed/tests/cloth_test.h index 0945569..70f26a7 100644 --- a/examples/testbed/tests/cloth_test.h +++ b/examples/testbed/tests/cloth_test.h @@ -41,13 +41,14 @@ public: m_cloth.Initialize(def); - m_aabb.m_lower.Set(-5.0f, -1.0f, -6.0f); - m_aabb.m_upper.Set(5.0f, 1.0f, -4.0f); + b3AABB3 aabb; + aabb.m_lower.Set(-5.0f, -1.0f, -6.0f); + aabb.m_upper.Set(5.0f, 1.0f, -4.0f); b3Particle* vs = m_cloth.GetVertices(); for (u32 i = 0; i < m_cloth.GetVertexCount(); ++i) { - if (m_aabb.Contains(vs[i].p)) + if (aabb.Contains(vs[i].p)) { vs[i].im = 0.0f; } @@ -72,8 +73,6 @@ public: m_cloth.Step(dt, g_settings.positionIterations); m_cloth.Draw(g_debugDraw); - - //g_debugDraw->DrawAABB(m_aabb, b3Color_black); } static Test* Create() @@ -83,7 +82,6 @@ public: b3GridMesh<10, 10> m_clothMesh; b3Cloth m_cloth; - b3AABB3 m_aabb; }; #endif \ No newline at end of file diff --git a/examples/testbed/tests/cloth_dragger.h b/examples/testbed/tests/spring_cloth_dragger.h similarity index 94% rename from examples/testbed/tests/cloth_dragger.h rename to examples/testbed/tests/spring_cloth_dragger.h index 1481e8f..fd10220 100644 --- a/examples/testbed/tests/cloth_dragger.h +++ b/examples/testbed/tests/spring_cloth_dragger.h @@ -16,8 +16,8 @@ * 3. This notice may not be removed or altered from any source distribution. */ -#ifndef CLOTH_DRAGGER_TESH_H -#define CLOTH_DRAGGER_TESH_H +#ifndef SPRING_CLOTH_DRAGGER_TESH_H +#define SPRING_CLOTH_DRAGGER_TESH_H extern DebugDraw* g_debugDraw; extern Camera g_camera; @@ -203,10 +203,10 @@ private: b3MassType m_t1, m_t2, m_t3; }; -class ClothDraggerTest : public Test +class SpringClothDraggerTest : public Test { public: - ClothDraggerTest() : m_clothDragger(&m_clothRay, &m_cloth) + SpringClothDraggerTest() : m_clothDragger(&m_clothRay, &m_cloth) { g_camera.m_zoom = 25.0f; @@ -214,18 +214,14 @@ public: def.allocator = &m_clothAllocator; def.mesh = &m_clothMesh; def.density = 0.2f; - def.ks = 10000.0f; - def.gravity.Set(0.0f, -10.0f, 0.0f); + def.ks = 100000.0f; + def.gravity.Set(2.5f, 5.0f, -10.0f); m_cloth.Initialize(def); - m_clothRay.origin.SetZero(); - m_clothRay.direction.Set(0.0f, 0.0f, -1.0f); - m_clothRay.fraction = g_camera.m_zFar; - b3AABB3 aabb; - aabb.m_lower.Set(-5.0f, -1.0f, -4.0f); - aabb.m_upper.Set(5.0f, 1.0f, -2.0f); + aabb.m_lower.Set(-5.0f, -1.0f, -6.0f); + aabb.m_upper.Set(5.0f, 1.0f, -4.0f); for (u32 i = 0; i < def.mesh->vertexCount; ++i) { @@ -234,6 +230,10 @@ public: m_cloth.SetType(i, b3MassType::e_staticMass); } } + + m_clothRay.origin.SetZero(); + m_clothRay.direction.Set(0.0f, 0.0f, -1.0f); + m_clothRay.fraction = g_camera.m_zFar; } void Step() @@ -308,7 +308,7 @@ public: static Test* Create() { - return new ClothDraggerTest(); + return new SpringClothDraggerTest(); } Ray3 m_clothRay; diff --git a/examples/testbed/tests/spring_cloth_test.h b/examples/testbed/tests/spring_cloth_test.h index 496554b..b0fd18a 100644 --- a/examples/testbed/tests/spring_cloth_test.h +++ b/examples/testbed/tests/spring_cloth_test.h @@ -35,18 +35,17 @@ public: def.mesh = &m_clothMesh; def.density = 0.2f; def.ks = 100000.0f; - def.kb = 1000000.0f; - def.kd = 100.0f; def.gravity.Set(2.5f, 5.0f, -10.0f); m_cloth.Initialize(def); - m_aabb.m_lower.Set(-5.0f, -1.0f, -6.0f); - m_aabb.m_upper.Set(5.0f, 1.0f, -4.0f); + b3AABB3 aabb; + aabb.m_lower.Set(-5.0f, -1.0f, -6.0f); + aabb.m_upper.Set(5.0f, 1.0f, -4.0f); for (u32 i = 0; i < def.mesh->vertexCount; ++i) { - if (m_aabb.Contains(def.mesh->vertices[i])) + if (aabb.Contains(def.mesh->vertices[i])) { m_cloth.SetType(i, b3MassType::e_staticMass); } @@ -87,7 +86,6 @@ public: b3GridMesh<10, 10> m_clothMesh; b3StackAllocator m_clothAllocator; b3SpringCloth m_cloth; - b3AABB3 m_aabb; }; #endif \ No newline at end of file