remove function
This commit is contained in:
@@ -270,13 +270,9 @@ b3Particle* b3Cloth::CreateParticle(const b3ParticleDef& def)
|
||||
|
||||
void b3Cloth::DestroyParticle(b3Particle* particle)
|
||||
{
|
||||
for (u32 i = 0; i > m_mesh->vertexCount; ++i)
|
||||
if (particle->m_vertex != ~0)
|
||||
{
|
||||
if (m_mesh->particles[i] == particle)
|
||||
{
|
||||
m_mesh->particles[i] = NULL;
|
||||
break;
|
||||
}
|
||||
m_mesh->particles[particle->m_vertex] = NULL;
|
||||
}
|
||||
|
||||
m_particleList.Remove(particle);
|
||||
@@ -417,9 +413,9 @@ bool b3Cloth::RayCast(b3RayCastOutput* output, const b3RayCastInput* input, u32
|
||||
B3_ASSERT(triangleIndex < m_mesh->triangleCount);
|
||||
b3ClothMeshTriangle* triangle = m_mesh->triangles + triangleIndex;
|
||||
|
||||
b3Vec3 v1 = m_mesh->vertices[triangle->v1];
|
||||
b3Vec3 v2 = m_mesh->vertices[triangle->v2];
|
||||
b3Vec3 v3 = m_mesh->vertices[triangle->v3];
|
||||
b3Vec3 v1 = m_mesh->particles[triangle->v1]->m_position;
|
||||
b3Vec3 v2 = m_mesh->particles[triangle->v2]->m_position;
|
||||
b3Vec3 v3 = m_mesh->particles[triangle->v3]->m_position;
|
||||
|
||||
b3Vec3 p1 = input->p1;
|
||||
b3Vec3 p2 = input->p2;
|
||||
@@ -738,17 +734,6 @@ void b3Cloth::Step(float32 dt, const b3Vec3& gravity)
|
||||
}
|
||||
}
|
||||
|
||||
void b3Cloth::Apply() const
|
||||
{
|
||||
for (b3Particle* p = m_particleList.m_head; p; p = p->m_next)
|
||||
{
|
||||
if (p->m_vertex != ~0)
|
||||
{
|
||||
m_mesh->vertices[p->m_vertex] = p->m_position;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void b3Cloth::Draw() const
|
||||
{
|
||||
for (b3Particle* p = m_particleList.m_head; p; p = p->m_next)
|
||||
|
@@ -91,7 +91,10 @@ void b3ClothSolver::ApplyForces()
|
||||
|
||||
void b3AccelerationConstraint::Apply(const b3ClothSolverData* data)
|
||||
{
|
||||
(*data->z)[i1] = z;
|
||||
b3DiagMat33& sS = *data->S;
|
||||
b3DenseVec3& sz = *data->z;
|
||||
|
||||
sz[i1] = z;
|
||||
|
||||
b3Mat33 I; I.SetIdentity();
|
||||
|
||||
@@ -99,22 +102,22 @@ void b3AccelerationConstraint::Apply(const b3ClothSolverData* data)
|
||||
{
|
||||
case 3:
|
||||
{
|
||||
(*data->S)[i1] = I;
|
||||
sS[i1] = I;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
(*data->S)[i1] = I - b3Outer(p, p);
|
||||
sS[i1] = I - b3Outer(p, p);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
(*data->S)[i1] = I - b3Outer(p, p) - b3Outer(q, q);
|
||||
sS[i1] = I - b3Outer(p, p) - b3Outer(q, q);
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
(*data->S)[i1].SetZero();
|
||||
sS[i1].SetZero();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -129,6 +132,7 @@ void b3ClothSolver::ApplyConstraints()
|
||||
{
|
||||
b3DiagMat33& S = *m_solverData.S;
|
||||
b3DenseVec3& z = *m_solverData.z;
|
||||
float32 h = m_solverData.dt;
|
||||
|
||||
S.SetIdentity();
|
||||
z.SetZero();
|
||||
|
@@ -31,6 +31,7 @@ b3Particle::b3Particle(const b3ParticleDef& def, b3Cloth* cloth)
|
||||
{
|
||||
m_cloth = cloth;
|
||||
m_type = def.type;
|
||||
|
||||
m_position = def.position;
|
||||
m_velocity = def.velocity;
|
||||
m_force = def.force;
|
||||
@@ -42,13 +43,10 @@ b3Particle::b3Particle(const b3ParticleDef& def, b3Cloth* cloth)
|
||||
m_x.SetZero();
|
||||
m_vertex = ~0;
|
||||
|
||||
m_contact.f_active = false;
|
||||
m_contact.n_active = false;
|
||||
m_contact.t1_active = false;
|
||||
m_contact.t2_active = false;
|
||||
m_contact.Fn = 0.0f;
|
||||
m_contact.Ft1 = 0.0f;
|
||||
m_contact.Ft2 = 0.0f;
|
||||
m_contact.f_active = false;
|
||||
}
|
||||
|
||||
b3Particle::~b3Particle()
|
||||
|
Reference in New Issue
Block a user