decal slopeBlendPower

This commit is contained in:
Turánszki János
2023-03-16 17:38:55 +01:00
parent 615a064f20
commit 892bbf0e13
13 changed files with 66 additions and 9 deletions
+17 -2
View File
@@ -10,7 +10,7 @@ void DecalWindow::Create(EditorComponent* _editor)
{
editor = _editor;
wi::gui::Window::Create(ICON_DECAL " Decal", wi::gui::Window::WindowControls::COLLAPSE | wi::gui::Window::WindowControls::CLOSE);
SetSize(XMFLOAT2(300, 180));
SetSize(XMFLOAT2(300, 200));
closeButton.SetTooltip("Delete DecalComponent");
OnClose([=](wi::gui::EventArgs args) {
@@ -53,6 +53,19 @@ void DecalWindow::Create(EditorComponent* _editor)
});
AddWidget(&onlyalphaCheckBox);
slopeBlendPowerSlider.Create(0, 8, 0, 1000, "Slope Blend: ");
slopeBlendPowerSlider.SetSize(XMFLOAT2(100, hei));
slopeBlendPowerSlider.SetTooltip("Set a power factor for blending on surface slopes. 0 = no slope blend, increasing = more slope blend");
slopeBlendPowerSlider.OnSlide([=](wi::gui::EventArgs args) {
Scene& scene = editor->GetCurrentScene();
DecalComponent* decal = scene.decals.GetComponent(entity);
if (decal != nullptr)
{
decal->slopeBlendPower = args.fValue;
}
});
AddWidget(&slopeBlendPowerSlider);
y += step;
infoLabel.Create("");
@@ -80,6 +93,7 @@ void DecalWindow::SetEntity(Entity entity)
{
SetEnabled(true);
onlyalphaCheckBox.SetCheck(decal->IsBaseColorOnlyAlpha());
slopeBlendPowerSlider.SetValue(decal->slopeBlendPower);
}
else
{
@@ -98,7 +112,7 @@ void DecalWindow::ResizeLayout()
auto add = [&](wi::gui::Widget& widget) {
if (!widget.IsVisible())
return;
const float margin_left = 80;
const float margin_left = 100;
const float margin_right = 40;
widget.SetPos(XMFLOAT2(margin_left, y));
widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y));
@@ -127,5 +141,6 @@ void DecalWindow::ResizeLayout()
add_fullwidth(infoLabel);
add_right(placementCheckBox);
add_right(onlyalphaCheckBox);
add(slopeBlendPowerSlider);
}