remove default radius
This commit is contained in:
parent
1babc1b406
commit
7bed29df5e
@ -39,7 +39,6 @@ public:
|
|||||||
|
|
||||||
b3ClothDef def;
|
b3ClothDef def;
|
||||||
def.mesh = &m_rectangleClothMesh;
|
def.mesh = &m_rectangleClothMesh;
|
||||||
def.radius = 0.05f;
|
|
||||||
def.density = 0.2f;
|
def.density = 0.2f;
|
||||||
def.structural = 10000.0f;
|
def.structural = 10000.0f;
|
||||||
def.damping = 0.0f;
|
def.damping = 0.0f;
|
||||||
|
@ -53,7 +53,6 @@ public:
|
|||||||
|
|
||||||
// Create cloth
|
// Create cloth
|
||||||
b3ClothDef def;
|
b3ClothDef def;
|
||||||
def.radius = 0.2f;
|
|
||||||
def.mesh = &m_shirtClothMesh;
|
def.mesh = &m_shirtClothMesh;
|
||||||
def.density = 0.2f;
|
def.density = 0.2f;
|
||||||
def.structural = 10000.0f;
|
def.structural = 10000.0f;
|
||||||
|
@ -40,7 +40,6 @@ public:
|
|||||||
|
|
||||||
b3ClothDef def;
|
b3ClothDef def;
|
||||||
def.mesh = &m_rectangleClothMesh;
|
def.mesh = &m_rectangleClothMesh;
|
||||||
def.radius = 0.05f;
|
|
||||||
def.density = 0.2f;
|
def.density = 0.2f;
|
||||||
def.structural = 10000.0f;
|
def.structural = 10000.0f;
|
||||||
def.damping = 0.0f;
|
def.damping = 0.0f;
|
||||||
|
@ -75,7 +75,6 @@ public:
|
|||||||
|
|
||||||
b3ClothDef def;
|
b3ClothDef def;
|
||||||
def.mesh = &m_rectangleClothMesh;
|
def.mesh = &m_rectangleClothMesh;
|
||||||
def.radius = 0.2f;
|
|
||||||
def.density = 0.2f;
|
def.density = 0.2f;
|
||||||
def.structural = 10000.0f;
|
def.structural = 10000.0f;
|
||||||
|
|
||||||
@ -157,16 +156,16 @@ public:
|
|||||||
g_draw->DrawSolidTriangle(n2, v1, v3, v2, color);
|
g_draw->DrawSolidTriangle(n2, v1, v3, v2, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_clothDragger.IsSelected() == true)
|
||||||
|
{
|
||||||
|
g_draw->DrawSegment(m_clothDragger.GetPointA(), m_clothDragger.GetPointB(), b3Color_white);
|
||||||
|
}
|
||||||
|
|
||||||
extern u32 b3_clothSolverIterations;
|
extern u32 b3_clothSolverIterations;
|
||||||
g_draw->DrawString(b3Color_white, "Iterations = %u", b3_clothSolverIterations);
|
g_draw->DrawString(b3Color_white, "Iterations = %u", b3_clothSolverIterations);
|
||||||
|
|
||||||
float32 E = m_cloth->GetEnergy();
|
float32 E = m_cloth->GetEnergy();
|
||||||
g_draw->DrawString(b3Color_white, "E = %f", E);
|
g_draw->DrawString(b3Color_white, "E = %f", E);
|
||||||
|
|
||||||
if (m_clothDragger.IsSelected() == true)
|
|
||||||
{
|
|
||||||
g_draw->DrawSegment(m_clothDragger.GetPointA(), m_clothDragger.GetPointB(), b3Color_white);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Test* Create()
|
static Test* Create()
|
||||||
|
@ -52,7 +52,6 @@ struct b3ClothDef
|
|||||||
{
|
{
|
||||||
mesh = nullptr;
|
mesh = nullptr;
|
||||||
density = 0.0f;
|
density = 0.0f;
|
||||||
radius = 0.05f;
|
|
||||||
structural = 0.0f;
|
structural = 0.0f;
|
||||||
bending = 0.0f;
|
bending = 0.0f;
|
||||||
damping = 0.0f;
|
damping = 0.0f;
|
||||||
@ -61,11 +60,6 @@ struct b3ClothDef
|
|||||||
// Cloth mesh
|
// Cloth mesh
|
||||||
b3ClothMesh* mesh;
|
b3ClothMesh* mesh;
|
||||||
|
|
||||||
// Radius
|
|
||||||
// This should be a small value. It can be used for correcting visual artifacts when
|
|
||||||
// the masses are colliding against a solid.
|
|
||||||
float32 radius;
|
|
||||||
|
|
||||||
// Cloth density in kg/m^3
|
// Cloth density in kg/m^3
|
||||||
float32 density;
|
float32 density;
|
||||||
|
|
||||||
@ -91,13 +85,13 @@ public:
|
|||||||
// Create a particle.
|
// Create a particle.
|
||||||
b3Particle* CreateParticle(const b3ParticleDef& def);
|
b3Particle* CreateParticle(const b3ParticleDef& def);
|
||||||
|
|
||||||
// Destroy a particle
|
// Destroy a given particle.
|
||||||
void DestroyParticle(b3Particle* particle);
|
void DestroyParticle(b3Particle* particle);
|
||||||
|
|
||||||
// Create a force.
|
// Create a force.
|
||||||
b3Force* CreateForce(const b3ForceDef& def);
|
b3Force* CreateForce(const b3ForceDef& def);
|
||||||
|
|
||||||
// Destroy a force.
|
// Destroy a given force.
|
||||||
void DestroyForce(b3Force* force);
|
void DestroyForce(b3Force* force);
|
||||||
|
|
||||||
// Perform a ray cast with the cloth.
|
// Perform a ray cast with the cloth.
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#define B3_FORCE_THRESHOLD 0.005f
|
#define B3_FORCE_THRESHOLD 0.005f
|
||||||
|
|
||||||
#define B3_CLOTH_BENDING 1
|
#define B3_CLOTH_BENDING 0
|
||||||
|
|
||||||
#define B3_CLOTH_FRICTION 1
|
#define B3_CLOTH_FRICTION 1
|
||||||
|
|
||||||
@ -271,6 +271,15 @@ b3Particle* b3Cloth::CreateParticle(const b3ParticleDef& def)
|
|||||||
|
|
||||||
void b3Cloth::DestroyParticle(b3Particle* particle)
|
void b3Cloth::DestroyParticle(b3Particle* particle)
|
||||||
{
|
{
|
||||||
|
for (u32 i = 0; i > m_mesh->vertexCount; ++i)
|
||||||
|
{
|
||||||
|
if (m_mesh->particles[i] == particle)
|
||||||
|
{
|
||||||
|
m_mesh->particles[i] = NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_particleList.Remove(particle);
|
m_particleList.Remove(particle);
|
||||||
particle->~b3Particle();
|
particle->~b3Particle();
|
||||||
m_particleBlocks.Free(particle);
|
m_particleBlocks.Free(particle);
|
||||||
|
@ -94,12 +94,12 @@ void b3SpringForce::Apply(const b3ClothSolverData* data)
|
|||||||
b3SymMat33& dfdx = *data->dfdx;
|
b3SymMat33& dfdx = *data->dfdx;
|
||||||
b3SymMat33& dfdv = *data->dfdv;
|
b3SymMat33& dfdv = *data->dfdv;
|
||||||
|
|
||||||
f[m_p1->m_solverId] += m_f;
|
|
||||||
f[m_p2->m_solverId] -= m_f;
|
|
||||||
|
|
||||||
u32 i1 = m_p1->m_solverId;
|
u32 i1 = m_p1->m_solverId;
|
||||||
u32 i2 = m_p2->m_solverId;
|
u32 i2 = m_p2->m_solverId;
|
||||||
|
|
||||||
|
f[i1] += m_f;
|
||||||
|
f[i2] -= m_f;
|
||||||
|
|
||||||
b3Mat33 Jx11 = m_Jx;
|
b3Mat33 Jx11 = m_Jx;
|
||||||
b3Mat33 Jx12 = -Jx11;
|
b3Mat33 Jx12 = -Jx11;
|
||||||
b3Mat33 Jx21 = Jx12;
|
b3Mat33 Jx21 = Jx12;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user