From 2af8cff3899dab09ad2da6c7e7ce40c5ce660171 Mon Sep 17 00:00:00 2001 From: Irlan <-> Date: Fri, 29 Jun 2018 22:52:21 -0300 Subject: [PATCH] consistency --- examples/testbed/framework/test.h | 2 +- examples/testbed/tests/ray_cast.h | 2 +- include/bounce/controllers/body_dragger.h | 2 +- include/bounce/controllers/cloth_dragger.h | 2 +- include/bounce/dynamics/cloth/cloth.h | 6 +++--- include/bounce/dynamics/cloth/particle.h | 14 +++----------- include/bounce/dynamics/world.h | 8 ++++---- src/bounce/dynamics/cloth/cloth.cpp | 8 ++++---- src/bounce/dynamics/world.cpp | 10 +++++----- 9 files changed, 23 insertions(+), 31 deletions(-) diff --git a/examples/testbed/framework/test.h b/examples/testbed/framework/test.h index baeb29c..481c2ea 100644 --- a/examples/testbed/framework/test.h +++ b/examples/testbed/framework/test.h @@ -51,7 +51,7 @@ public: return 1.0f; } - b3ShapeRayCastSingleOutput hit; + b3RayCastSingleShapeOutput hit; }; class Test : public b3ContactListener diff --git a/examples/testbed/tests/ray_cast.h b/examples/testbed/tests/ray_cast.h index 5417ff2..3b7e7ed 100644 --- a/examples/testbed/tests/ray_cast.h +++ b/examples/testbed/tests/ray_cast.h @@ -178,7 +178,7 @@ public: void CastRay(const b3Vec3 p1, const b3Vec3 p2) const { - b3ShapeRayCastSingleOutput out; + b3RayCastSingleShapeOutput out; if (m_world.RayCastSingleShape(&out, p1, p2)) { g_draw->DrawSegment(p1, out.point, b3Color_green); diff --git a/include/bounce/controllers/body_dragger.h b/include/bounce/controllers/body_dragger.h index ca86fa1..13af726 100644 --- a/include/bounce/controllers/body_dragger.h +++ b/include/bounce/controllers/body_dragger.h @@ -48,7 +48,7 @@ public: { B3_ASSERT(m_mouseJoint == nullptr); - b3ShapeRayCastSingleOutput out; + b3RayCastSingleShapeOutput out; if (m_world->RayCastSingleShape(&out, m_ray->A(), m_ray->B()) == false) { return false; diff --git a/include/bounce/controllers/cloth_dragger.h b/include/bounce/controllers/cloth_dragger.h index e8d5ac8..9786c49 100644 --- a/include/bounce/controllers/cloth_dragger.h +++ b/include/bounce/controllers/cloth_dragger.h @@ -52,7 +52,7 @@ public: { B3_ASSERT(IsDragging() == false); - b3ClothRayCastSingleOutput rayOut; + b3RayCastSingleClothOutput rayOut; if (m_world->RayCastSingleCloth(&rayOut, m_ray->A(), m_ray->B()) == false) { return false; diff --git a/include/bounce/dynamics/cloth/cloth.h b/include/bounce/dynamics/cloth/cloth.h index fd9a99d..42b09d2 100644 --- a/include/bounce/dynamics/cloth/cloth.h +++ b/include/bounce/dynamics/cloth/cloth.h @@ -37,7 +37,7 @@ struct b3ClothMesh; class b3RayCastListener; struct b3RayCastInput; -struct b3ClothRayCastSingleOutput; +struct b3RayCastSingleClothOutput; // Cloth definition // This requires defining a cloth mesh which is typically bound to a render mesh @@ -90,13 +90,13 @@ public: void DestroyForce(b3Force* force); // Perform a ray cast with a given cloth mesh triangle. - bool RayCast(b3ClothRayCastSingleOutput* output, const b3RayCastInput* input, u32 triangleIndex) const; + bool RayCast(b3RayCastSingleClothOutput* output, const b3RayCastInput* input, u32 triangleIndex) const; // Perform a ray cast with the cloth. void RayCast(b3RayCastListener* listener, const b3RayCastInput* input) const; // Perform a ray cast with the cloth. - bool RayCastSingle(b3ClothRayCastSingleOutput* output, const b3Vec3& p1, const b3Vec3& p2) const; + bool RayCastSingle(b3RayCastSingleClothOutput* output, const b3Vec3& p1, const b3Vec3& p2) const; // Return the cloth mesh proxy. b3ClothMesh* GetMesh() const; diff --git a/include/bounce/dynamics/cloth/particle.h b/include/bounce/dynamics/cloth/particle.h index 894537c..f2025d9 100644 --- a/include/bounce/dynamics/cloth/particle.h +++ b/include/bounce/dynamics/cloth/particle.h @@ -58,32 +58,24 @@ struct b3ParticleDef void* userData; }; +// class b3FrictionForce : public b3Force { public: b3FrictionForce() { } - ~b3FrictionForce() { } void Apply(const b3ClothSolverData* data); b3Particle* m_p; - float32 m_kd; }; // A contact between a particle and a solid class b3BodyContact { public: - b3BodyContact() - { - - } - - ~b3BodyContact() - { - - } + b3BodyContact() { } + ~b3BodyContact() { } b3Particle* p1; b3Shape* s2; diff --git a/include/bounce/dynamics/world.h b/include/bounce/dynamics/world.h index 569fc8f..2d30247 100644 --- a/include/bounce/dynamics/world.h +++ b/include/bounce/dynamics/world.h @@ -36,7 +36,7 @@ class b3RayCastListener; class b3ContactListener; class b3ContactFilter; -struct b3ShapeRayCastSingleOutput +struct b3RayCastSingleShapeOutput { b3Shape* shape; // shape b3Vec3 point; // intersection point on surface @@ -44,7 +44,7 @@ struct b3ShapeRayCastSingleOutput float32 fraction; // time of intersection on segment }; -struct b3ClothRayCastSingleOutput +struct b3RayCastSingleClothOutput { b3Cloth* cloth; // cloth u32 triangle; // triangle @@ -115,7 +115,7 @@ public: // The ray cast output is the intercepted shape, the intersection // point in world space, the face normal on the shape associated with the point, // and the intersection fraction. - bool RayCastSingleShape(b3ShapeRayCastSingleOutput* output, const b3Vec3& p1, const b3Vec3& p2) const; + bool RayCastSingleShape(b3RayCastSingleShapeOutput* output, const b3Vec3& p1, const b3Vec3& p2) const; // Perform a ray cast with the world. // The given ray cast listener will be notified when a ray intersects a shape @@ -130,7 +130,7 @@ public: // The ray cast output is the intercepted cloth, the intersection // point in world space, the face normal on the cloth associated with the point, // and the intersection fraction. - bool RayCastSingleCloth(b3ClothRayCastSingleOutput* output, const b3Vec3& p1, const b3Vec3& p2) const; + bool RayCastSingleCloth(b3RayCastSingleClothOutput* output, const b3Vec3& p1, const b3Vec3& p2) const; // Perform a AABB query with the world. // The query listener will be notified when two shape AABBs are overlapping. diff --git a/src/bounce/dynamics/cloth/cloth.cpp b/src/bounce/dynamics/cloth/cloth.cpp index 4420aed..354466e 100644 --- a/src/bounce/dynamics/cloth/cloth.cpp +++ b/src/bounce/dynamics/cloth/cloth.cpp @@ -352,7 +352,7 @@ void b3Cloth::RayCast(b3RayCastListener* listener, const b3RayCastInput* input) { for (u32 i = 0; i < m_mesh->triangleCount; ++i) { - b3ClothRayCastSingleOutput subOutput; + b3RayCastSingleClothOutput subOutput; if (RayCast(&subOutput, input, i)) { float32 newFraction = listener->ReportCloth(subOutput.cloth, subOutput.point, subOutput.normal, subOutput.fraction, subOutput.triangle); @@ -366,7 +366,7 @@ void b3Cloth::RayCast(b3RayCastListener* listener, const b3RayCastInput* input) } } -bool b3Cloth::RayCastSingle(b3ClothRayCastSingleOutput* output, const b3Vec3& p1, const b3Vec3& p2) const +bool b3Cloth::RayCastSingle(b3RayCastSingleClothOutput* output, const b3Vec3& p1, const b3Vec3& p2) const { b3RayCastInput input; input.p1 = p1; @@ -378,7 +378,7 @@ bool b3Cloth::RayCastSingle(b3ClothRayCastSingleOutput* output, const b3Vec3& p1 for (u32 i = 0; i < m_mesh->triangleCount; ++i) { - b3ClothRayCastSingleOutput subOutput; + b3RayCastSingleClothOutput subOutput; if (RayCast(&subOutput, &input, i)) { if (subOutput.fraction < output->fraction) @@ -396,7 +396,7 @@ bool b3Cloth::RayCastSingle(b3ClothRayCastSingleOutput* output, const b3Vec3& p1 return false; } -bool b3Cloth::RayCast(b3ClothRayCastSingleOutput* output, const b3RayCastInput* input, u32 triangleIndex) const +bool b3Cloth::RayCast(b3RayCastSingleClothOutput* output, const b3RayCastInput* input, u32 triangleIndex) const { B3_ASSERT(triangleIndex < m_mesh->triangleCount); b3ClothMeshTriangle* triangle = m_mesh->triangles + triangleIndex; diff --git a/src/bounce/dynamics/world.cpp b/src/bounce/dynamics/world.cpp index d2c704d..dfb9660 100644 --- a/src/bounce/dynamics/world.cpp +++ b/src/bounce/dynamics/world.cpp @@ -426,7 +426,7 @@ void b3World::RayCastShape(b3RayCastListener* listener, const b3Vec3& p1, const m_contactMan.m_broadPhase.RayCast(&callback, input); } -struct b3ShapeRayCastSingleCallback +struct b3RayCastSingleShapeCallback { float32 Report(const b3RayCastInput& input, u32 proxyId) { @@ -458,14 +458,14 @@ struct b3ShapeRayCastSingleCallback const b3BroadPhase* broadPhase; }; -bool b3World::RayCastSingleShape(b3ShapeRayCastSingleOutput* output, const b3Vec3& p1, const b3Vec3& p2) const +bool b3World::RayCastSingleShape(b3RayCastSingleShapeOutput* output, const b3Vec3& p1, const b3Vec3& p2) const { b3RayCastInput input; input.p1 = p1; input.p2 = p2; input.maxFraction = 1.0f; - b3ShapeRayCastSingleCallback callback; + b3RayCastSingleShapeCallback callback; callback.shape0 = NULL; callback.output0.fraction = B3_MAX_FLOAT; callback.broadPhase = &m_contactMan.m_broadPhase; @@ -504,7 +504,7 @@ void b3World::RayCastCloth(b3RayCastListener* listener, const b3Vec3& p1, const } } -bool b3World::RayCastSingleCloth(b3ClothRayCastSingleOutput* output, const b3Vec3& p1, const b3Vec3& p2) const +bool b3World::RayCastSingleCloth(b3RayCastSingleClothOutput* output, const b3Vec3& p1, const b3Vec3& p2) const { output->cloth = NULL; output->triangle = ~0; @@ -512,7 +512,7 @@ bool b3World::RayCastSingleCloth(b3ClothRayCastSingleOutput* output, const b3Vec for (b3Cloth* c = m_clothList.m_head; c; c = c->m_next) { - b3ClothRayCastSingleOutput subOutput; + b3RayCastSingleClothOutput subOutput; if (c->RayCastSingle(&subOutput, p1, p2)) { if (subOutput.fraction < output->fraction)