consistency

This commit is contained in:
Irlan
2018-06-29 22:43:35 -03:00
parent f5e20589eb
commit db54750a87
14 changed files with 226 additions and 167 deletions

View File

@ -22,14 +22,9 @@
class ClothTest : public Test
{
public:
ClothTest() : m_clothDragger(&m_clothRay, m_cloth)
ClothTest()
{
m_world.SetGravity(b3Vec3(0.0f, -10.0f, 0.0f));
m_clothRay.origin.SetZero();
m_clothRay.direction.Set(0.0f, 0.0f, -1.0f);
m_clothRay.fraction = g_camera->m_zFar;
m_cloth = nullptr;
}
@ -47,41 +42,13 @@ public:
float32 E = m_cloth->GetEnergy();
g_draw->DrawString(b3Color_white, "E = %f", E);
if (m_clothDragger.IsSelected() == true)
if (m_clothDragger.IsDragging() == true)
{
g_draw->DrawSegment(m_clothDragger.GetPointA(), m_clothDragger.GetPointB(), b3Color_white);
}
}
void MouseMove(const b3Ray3& pw)
{
m_clothRay = pw;
if (m_clothDragger.IsSelected() == true)
{
m_clothDragger.Drag();
}
}
void MouseLeftDown(const b3Ray3& pw)
{
if (m_clothDragger.IsSelected() == false)
{
m_clothDragger.StartDragging();
}
}
void MouseLeftUp(const b3Ray3& pw)
{
if (m_clothDragger.IsSelected() == true)
{
m_clothDragger.StopDragging();
}
}
b3Ray3 m_clothRay;
b3Cloth* m_cloth;
b3ClothDragger m_clothDragger;
};
#endif

View File

@ -69,7 +69,7 @@ public:
void Step()
{
if (m_bodyDragger.IsSelected())
if (m_bodyDragger.IsDragging())
{
if (m_bodyDragger.GetBody() != m_character)
{

View File

@ -178,8 +178,8 @@ public:
void CastRay(const b3Vec3 p1, const b3Vec3 p2) const
{
b3RayCastSingleOutput out;
if (m_world.RayCastSingle(&out, p1, p2))
b3ShapeRayCastSingleOutput out;
if (m_world.RayCastSingleShape(&out, p1, p2))
{
g_draw->DrawSegment(p1, out.point, b3Color_green);

View File

@ -156,7 +156,7 @@ public:
g_draw->DrawSolidTriangle(n2, v1, v3, v2, color);
}
if (m_clothDragger.IsSelected() == true)
if (m_clothDragger.IsDragging() == true)
{
g_draw->DrawSegment(m_clothDragger.GetPointA(), m_clothDragger.GetPointB(), b3Color_white);
}