Revert previous change, add NewtonianGravity element property instead
This commit is contained in:
parent
6b85231f23
commit
5f7dd033ec
@ -3805,34 +3805,38 @@ void Simulation::UpdateParticles(int start, int end)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (elements[t].Gravity || !(elements[t].Properties & TYPE_SOLID))
|
||||
|
||||
pGravX = pGravY = 0;
|
||||
if (!(elements[t].Properties & TYPE_SOLID))
|
||||
{
|
||||
//Gravity mode by Moach
|
||||
switch (gravityMode)
|
||||
if (elements[t].Gravity)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
pGravX = 0.0f;
|
||||
pGravY = elements[t].Gravity;
|
||||
break;
|
||||
case 1:
|
||||
pGravX = pGravY = 0.0f;
|
||||
break;
|
||||
case 2:
|
||||
pGravD = 0.01f - hypotf((x - XCNTR), (y - YCNTR));
|
||||
pGravX = elements[t].Gravity * ((float)(x - XCNTR) / pGravD);
|
||||
pGravY = elements[t].Gravity * ((float)(y - YCNTR) / pGravD);
|
||||
break;
|
||||
//Gravity mode by Moach
|
||||
switch (gravityMode)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
pGravX = 0.0f;
|
||||
pGravY = elements[t].Gravity;
|
||||
break;
|
||||
case 1:
|
||||
pGravX = pGravY = 0.0f;
|
||||
break;
|
||||
case 2:
|
||||
pGravD = 0.01f - hypotf((x - XCNTR), (y - YCNTR));
|
||||
pGravX = elements[t].Gravity * ((float)(x - XCNTR) / pGravD);
|
||||
pGravY = elements[t].Gravity * ((float)(y - YCNTR) / pGravD);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//Get some gravity from the gravity map
|
||||
if(t!=PT_STKM && t!=PT_STKM2 && t!=PT_FIGH && !(elements[t].Properties & TYPE_SOLID))
|
||||
if (elements[t].NewtonianGravity)
|
||||
{
|
||||
pGravX += elements[t].Gravity * gravx[(y/CELL)*(XRES/CELL)+(x/CELL)];
|
||||
pGravY += elements[t].Gravity * gravy[(y/CELL)*(XRES/CELL)+(x/CELL)];
|
||||
//Get some gravity from the gravity map
|
||||
pGravX += elements[t].NewtonianGravity * gravx[(y/CELL)*(XRES/CELL)+(x/CELL)];
|
||||
pGravY += elements[t].NewtonianGravity * gravy[(y/CELL)*(XRES/CELL)+(x/CELL)];
|
||||
}
|
||||
}
|
||||
else
|
||||
pGravX = pGravY = 0;
|
||||
|
||||
//velocity updates for the particle
|
||||
if (t != PT_SPNG || !(parts[i].flags&FLAG_MOVABLE))
|
||||
{
|
||||
|
@ -15,6 +15,7 @@ Element_ANAR::Element_ANAR()
|
||||
Loss = 0.80f;
|
||||
Collision = 0.1f;
|
||||
Gravity = -0.1f;
|
||||
NewtonianGravity = -1.f;
|
||||
Diffusion = 0.00f;
|
||||
HotAir = 0.000f * CFDS;
|
||||
Falldown = 1;
|
||||
|
@ -15,6 +15,7 @@ Element::Element():
|
||||
Loss(1.0f),
|
||||
Collision(0.0f),
|
||||
Gravity(0.0f),
|
||||
NewtonianGravity(1.0f),
|
||||
Diffusion(0.0f),
|
||||
HotAir(0.0f * CFDS),
|
||||
Falldown(0),
|
||||
@ -64,6 +65,7 @@ std::vector<StructProperty> const &Element::GetProperties()
|
||||
{ "Loss", StructProperty::Float, offsetof(Element, Loss ) },
|
||||
{ "Collision", StructProperty::Float, offsetof(Element, Collision ) },
|
||||
{ "Gravity", StructProperty::Float, offsetof(Element, Gravity ) },
|
||||
{ "NewtonianGravity", StructProperty::Float, offsetof(Element, NewtonianGravity ) },
|
||||
{ "Diffusion", StructProperty::Float, offsetof(Element, Diffusion ) },
|
||||
{ "HotAir", StructProperty::Float, offsetof(Element, HotAir ) },
|
||||
{ "Falldown", StructProperty::Integer, offsetof(Element, Falldown ) },
|
||||
|
@ -25,6 +25,7 @@ public:
|
||||
float Loss;
|
||||
float Collision;
|
||||
float Gravity;
|
||||
float NewtonianGravity;
|
||||
float Diffusion;
|
||||
float HotAir;
|
||||
int Falldown;
|
||||
|
@ -15,6 +15,7 @@ Element_FIGH::Element_FIGH()
|
||||
Loss = 1.0f;
|
||||
Collision = 0.0f;
|
||||
Gravity = 0.0f;
|
||||
NewtonianGravity = 0.0f;
|
||||
Diffusion = 0.0f;
|
||||
HotAir = 0.00f * CFDS;
|
||||
Falldown = 0;
|
||||
|
@ -15,6 +15,7 @@ Element_STKM::Element_STKM()
|
||||
Loss = 1.0f;
|
||||
Collision = 0.0f;
|
||||
Gravity = 0.0f;
|
||||
NewtonianGravity = 0.0f;
|
||||
Diffusion = 0.0f;
|
||||
HotAir = 0.00f * CFDS;
|
||||
Falldown = 0;
|
||||
|
@ -15,6 +15,7 @@ Element_STKM2::Element_STKM2()
|
||||
Loss = 1.0f;
|
||||
Collision = 0.0f;
|
||||
Gravity = 0.0f;
|
||||
NewtonianGravity = 0.0f;
|
||||
Diffusion = 0.0f;
|
||||
HotAir = 0.00f * CFDS;
|
||||
Falldown = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user