This commit is contained in:
turanszkij
2018-09-23 20:43:36 +01:00
parent c9767425be
commit 30e71881ff
4 changed files with 38 additions and 4 deletions
+29 -1
View File
@@ -16,7 +16,7 @@ MeshWindow::MeshWindow(wiGUI* gui) : GUI(gui)
meshWindow = new wiWindow(GUI, "Mesh Window");
meshWindow->SetSize(XMFLOAT2(800, 600));
meshWindow->SetSize(XMFLOAT2(800, 640));
meshWindow->SetEnabled(false);
GUI->AddWidget(meshWindow);
@@ -43,6 +43,34 @@ MeshWindow::MeshWindow(wiGUI* gui) : GUI(gui)
});
meshWindow->AddWidget(doubleSidedCheckBox);
softbodyCheckBox = new wiCheckBox("Soft body: ");
softbodyCheckBox->SetTooltip("Enable soft body simulation.");
softbodyCheckBox->SetPos(XMFLOAT2(x, y += step));
softbodyCheckBox->OnClick([&](wiEventArgs args) {
Scene& scene = wiRenderer::GetScene();
SoftBodyPhysicsComponent* physicscomponent = scene.softbodies.GetComponent(entity);
if (args.bValue)
{
if (physicscomponent == nullptr)
{
SoftBodyPhysicsComponent& softbody = scene.softbodies.Create(entity);
softbody.friction = frictionSlider->GetValue();
softbody.mass = massSlider->GetValue();
}
}
else
{
if (physicscomponent != nullptr)
{
scene.softbodies.Remove(entity);
}
}
});
meshWindow->AddWidget(softbodyCheckBox);
massSlider = new wiSlider(0, 5000, 0, 100000, "Mass: ");
massSlider->SetTooltip("Set the mass amount for the physics engine.");
massSlider->SetSize(XMFLOAT2(100, 30));