GUI updates (#490)
This commit is contained in:
+55
-61
@@ -9,16 +9,31 @@ using namespace wi::scene;
|
||||
void MaterialWindow::Create(EditorComponent* _editor)
|
||||
{
|
||||
editor = _editor;
|
||||
wi::gui::Window::Create("Material Window");
|
||||
SetSize(XMFLOAT2(730, 620));
|
||||
wi::gui::Window::Create(ICON_MATERIAL " Material", wi::gui::Window::WindowControls::COLLAPSE | wi::gui::Window::WindowControls::CLOSE);
|
||||
SetSize(XMFLOAT2(300, 1200));
|
||||
|
||||
closeButton.SetTooltip("Delete MaterialComponent");
|
||||
OnClose([=](wi::gui::EventArgs args) {
|
||||
|
||||
wi::Archive& archive = editor->AdvanceHistory();
|
||||
archive << EditorComponent::HISTORYOP_COMPONENT_DATA;
|
||||
editor->RecordEntity(archive, entity);
|
||||
|
||||
editor->GetCurrentScene().materials.Remove(entity);
|
||||
|
||||
editor->RecordEntity(archive, entity);
|
||||
|
||||
editor->RefreshEntityTree();
|
||||
});
|
||||
|
||||
float hei = 18;
|
||||
float step = hei + 2;
|
||||
float x = 670, y = 0;
|
||||
float x = 150, y = 0;
|
||||
float wid = 130;
|
||||
|
||||
shadowReceiveCheckBox.Create("Receive Shadow: ");
|
||||
shadowReceiveCheckBox.SetTooltip("Receives shadow or not?");
|
||||
shadowReceiveCheckBox.SetPos(XMFLOAT2(540, y));
|
||||
shadowReceiveCheckBox.SetPos(XMFLOAT2(x, y));
|
||||
shadowReceiveCheckBox.SetSize(XMFLOAT2(hei, hei));
|
||||
shadowReceiveCheckBox.OnClick([&](wi::gui::EventArgs args) {
|
||||
MaterialComponent* material = editor->GetCurrentScene().materials.GetComponent(entity);
|
||||
@@ -29,7 +44,7 @@ void MaterialWindow::Create(EditorComponent* _editor)
|
||||
|
||||
shadowCasterCheckBox.Create("Cast Shadow: ");
|
||||
shadowCasterCheckBox.SetTooltip("The subset will contribute to the scene shadows if enabled.");
|
||||
shadowCasterCheckBox.SetPos(XMFLOAT2(670, y));
|
||||
shadowCasterCheckBox.SetPos(XMFLOAT2(x, y += step));
|
||||
shadowCasterCheckBox.SetSize(XMFLOAT2(hei, hei));
|
||||
shadowCasterCheckBox.OnClick([&](wi::gui::EventArgs args) {
|
||||
MaterialComponent* material = editor->GetCurrentScene().materials.GetComponent(entity);
|
||||
@@ -40,7 +55,7 @@ void MaterialWindow::Create(EditorComponent* _editor)
|
||||
|
||||
useVertexColorsCheckBox.Create("Use vertex colors: ");
|
||||
useVertexColorsCheckBox.SetTooltip("Enable if you want to render the mesh with vertex colors (must have appropriate vertex buffer)");
|
||||
useVertexColorsCheckBox.SetPos(XMFLOAT2(670, y += step));
|
||||
useVertexColorsCheckBox.SetPos(XMFLOAT2(x, y += step));
|
||||
useVertexColorsCheckBox.SetSize(XMFLOAT2(hei, hei));
|
||||
useVertexColorsCheckBox.OnClick([&](wi::gui::EventArgs args) {
|
||||
MaterialComponent* material = editor->GetCurrentScene().materials.GetComponent(entity);
|
||||
@@ -49,9 +64,9 @@ void MaterialWindow::Create(EditorComponent* _editor)
|
||||
});
|
||||
AddWidget(&useVertexColorsCheckBox);
|
||||
|
||||
specularGlossinessCheckBox.Create("Specular-glossiness workflow: ");
|
||||
specularGlossinessCheckBox.Create("Spec-gloss workflow: ");
|
||||
specularGlossinessCheckBox.SetTooltip("If enabled, surface map will be viewed like it contains specular color (RGB) and smoothness (A)");
|
||||
specularGlossinessCheckBox.SetPos(XMFLOAT2(670, y += step));
|
||||
specularGlossinessCheckBox.SetPos(XMFLOAT2(x, y += step));
|
||||
specularGlossinessCheckBox.SetSize(XMFLOAT2(hei, hei));
|
||||
specularGlossinessCheckBox.OnClick([&](wi::gui::EventArgs args) {
|
||||
MaterialComponent* material = editor->GetCurrentScene().materials.GetComponent(entity);
|
||||
@@ -61,9 +76,9 @@ void MaterialWindow::Create(EditorComponent* _editor)
|
||||
});
|
||||
AddWidget(&specularGlossinessCheckBox);
|
||||
|
||||
occlusionPrimaryCheckBox.Create("Occlusion - Primary: ");
|
||||
occlusionPrimaryCheckBox.Create("Occlusion 1: ");
|
||||
occlusionPrimaryCheckBox.SetTooltip("If enabled, surface map's RED channel will be used as occlusion map");
|
||||
occlusionPrimaryCheckBox.SetPos(XMFLOAT2(670, y += step));
|
||||
occlusionPrimaryCheckBox.SetPos(XMFLOAT2(x, y += step));
|
||||
occlusionPrimaryCheckBox.SetSize(XMFLOAT2(hei, hei));
|
||||
occlusionPrimaryCheckBox.OnClick([&](wi::gui::EventArgs args) {
|
||||
MaterialComponent* material = editor->GetCurrentScene().materials.GetComponent(entity);
|
||||
@@ -72,9 +87,9 @@ void MaterialWindow::Create(EditorComponent* _editor)
|
||||
});
|
||||
AddWidget(&occlusionPrimaryCheckBox);
|
||||
|
||||
occlusionSecondaryCheckBox.Create("Occlusion - Secondary: ");
|
||||
occlusionSecondaryCheckBox.Create("Occlusion 2: ");
|
||||
occlusionSecondaryCheckBox.SetTooltip("If enabled, occlusion map's RED channel will be used as occlusion map");
|
||||
occlusionSecondaryCheckBox.SetPos(XMFLOAT2(670, y += step));
|
||||
occlusionSecondaryCheckBox.SetPos(XMFLOAT2(x, y += step));
|
||||
occlusionSecondaryCheckBox.SetSize(XMFLOAT2(hei, hei));
|
||||
occlusionSecondaryCheckBox.OnClick([&](wi::gui::EventArgs args) {
|
||||
MaterialComponent* material = editor->GetCurrentScene().materials.GetComponent(entity);
|
||||
@@ -85,7 +100,7 @@ void MaterialWindow::Create(EditorComponent* _editor)
|
||||
|
||||
windCheckBox.Create("Wind: ");
|
||||
windCheckBox.SetTooltip("If enabled, vertex wind weights will affect how much wind offset affects the subset.");
|
||||
windCheckBox.SetPos(XMFLOAT2(670, y += step));
|
||||
windCheckBox.SetPos(XMFLOAT2(x, y += step));
|
||||
windCheckBox.SetSize(XMFLOAT2(hei, hei));
|
||||
windCheckBox.OnClick([&](wi::gui::EventArgs args) {
|
||||
MaterialComponent* material = editor->GetCurrentScene().materials.GetComponent(entity);
|
||||
@@ -96,7 +111,7 @@ void MaterialWindow::Create(EditorComponent* _editor)
|
||||
|
||||
doubleSidedCheckBox.Create("Double sided: ");
|
||||
doubleSidedCheckBox.SetTooltip("Decide whether to render both sides of the material (It's also possible to set this behaviour per mesh).");
|
||||
doubleSidedCheckBox.SetPos(XMFLOAT2(540, y));
|
||||
doubleSidedCheckBox.SetPos(XMFLOAT2(x, y += step));
|
||||
doubleSidedCheckBox.SetSize(XMFLOAT2(hei, hei));
|
||||
doubleSidedCheckBox.OnClick([&](wi::gui::EventArgs args) {
|
||||
MaterialComponent* material = editor->GetCurrentScene().materials.GetComponent(entity);
|
||||
@@ -106,11 +121,6 @@ void MaterialWindow::Create(EditorComponent* _editor)
|
||||
AddWidget(&doubleSidedCheckBox);
|
||||
|
||||
|
||||
|
||||
x = 520;
|
||||
float wid = 170;
|
||||
|
||||
|
||||
shaderTypeComboBox.Create("Shader: ");
|
||||
shaderTypeComboBox.SetTooltip("Select a shader for this material. \nCustom shaders (*) will also show up here (see wi::renderer:RegisterCustomShader() for more info.)\nNote that custom shaders (*) can't select between blend modes, as they are created with an explicit blend mode.");
|
||||
shaderTypeComboBox.SetPos(XMFLOAT2(x, y += step));
|
||||
@@ -133,12 +143,12 @@ void MaterialWindow::Create(EditorComponent* _editor)
|
||||
}
|
||||
});
|
||||
shaderTypeComboBox.AddItem("PBR", MaterialComponent::SHADERTYPE_PBR);
|
||||
shaderTypeComboBox.AddItem("PBR + Planar reflections", MaterialComponent::SHADERTYPE_PBR_PLANARREFLECTION);
|
||||
shaderTypeComboBox.AddItem("PBR + Par. occl. mapping", MaterialComponent::SHADERTYPE_PBR_PARALLAXOCCLUSIONMAPPING);
|
||||
shaderTypeComboBox.AddItem("PBR + Anisotropic", MaterialComponent::SHADERTYPE_PBR_ANISOTROPIC);
|
||||
shaderTypeComboBox.AddItem("PBR + Cloth", MaterialComponent::SHADERTYPE_PBR_CLOTH);
|
||||
shaderTypeComboBox.AddItem("PBR + Clear coat", MaterialComponent::SHADERTYPE_PBR_CLEARCOAT);
|
||||
shaderTypeComboBox.AddItem("PBR + Cloth + Clear coat", MaterialComponent::SHADERTYPE_PBR_CLOTH_CLEARCOAT);
|
||||
shaderTypeComboBox.AddItem("Planar reflections", MaterialComponent::SHADERTYPE_PBR_PLANARREFLECTION);
|
||||
shaderTypeComboBox.AddItem("Par. occl. mapping", MaterialComponent::SHADERTYPE_PBR_PARALLAXOCCLUSIONMAPPING);
|
||||
shaderTypeComboBox.AddItem("Anisotropic", MaterialComponent::SHADERTYPE_PBR_ANISOTROPIC);
|
||||
shaderTypeComboBox.AddItem("Cloth", MaterialComponent::SHADERTYPE_PBR_CLOTH);
|
||||
shaderTypeComboBox.AddItem("Clear coat", MaterialComponent::SHADERTYPE_PBR_CLEARCOAT);
|
||||
shaderTypeComboBox.AddItem("Cloth + Clear coat", MaterialComponent::SHADERTYPE_PBR_CLOTH_CLEARCOAT);
|
||||
shaderTypeComboBox.AddItem("Water", MaterialComponent::SHADERTYPE_WATER);
|
||||
shaderTypeComboBox.AddItem("Cartoon", MaterialComponent::SHADERTYPE_CARTOON);
|
||||
shaderTypeComboBox.AddItem("Unlit", MaterialComponent::SHADERTYPE_UNLIT);
|
||||
@@ -195,7 +205,6 @@ void MaterialWindow::Create(EditorComponent* _editor)
|
||||
|
||||
|
||||
// Sliders:
|
||||
wid = 150;
|
||||
|
||||
normalMapSlider.Create(0, 4, 1, 4000, "Normalmap: ");
|
||||
normalMapSlider.SetTooltip("How much the normal map should distort the face normals (bumpiness).");
|
||||
@@ -285,8 +294,7 @@ void MaterialWindow::Create(EditorComponent* _editor)
|
||||
});
|
||||
AddWidget(&refractionSlider);
|
||||
|
||||
pomSlider.Create(0, 0.1f, 0.0f, 1000, "Parallax Occlusion Mapping: ");
|
||||
pomSlider.SetTooltip("Adjust how much the bump map should modulate the surface parallax effect. \nOnly works with PBR + Parallax shader.");
|
||||
pomSlider.Create(0, 0.1f, 0.0f, 1000, "Par Occl Mapping: ");
|
||||
pomSlider.SetSize(XMFLOAT2(wid, hei));
|
||||
pomSlider.SetPos(XMFLOAT2(x, y += step));
|
||||
pomSlider.OnSlide([&](wi::gui::EventArgs args) {
|
||||
@@ -296,7 +304,7 @@ void MaterialWindow::Create(EditorComponent* _editor)
|
||||
});
|
||||
AddWidget(&pomSlider);
|
||||
|
||||
displacementMappingSlider.Create(0, 0.1f, 0.0f, 1000, "Displacement Mapping: ");
|
||||
displacementMappingSlider.Create(0, 0.1f, 0.0f, 1000, "Displacement: ");
|
||||
displacementMappingSlider.SetTooltip("Adjust how much the bump map should modulate the geometry when using tessellation.");
|
||||
displacementMappingSlider.SetSize(XMFLOAT2(wid, hei));
|
||||
displacementMappingSlider.SetPos(XMFLOAT2(x, y += step));
|
||||
@@ -430,11 +438,10 @@ void MaterialWindow::Create(EditorComponent* _editor)
|
||||
hei = 20;
|
||||
step = hei + 2;
|
||||
x = 10;
|
||||
y = 0;
|
||||
|
||||
materialNameField.Create("MaterialName");
|
||||
materialNameField.SetTooltip("Set a name for the material...");
|
||||
materialNameField.SetPos(XMFLOAT2(10, y));
|
||||
materialNameField.SetPos(XMFLOAT2(10, y += step));
|
||||
materialNameField.SetSize(XMFLOAT2(300, hei));
|
||||
materialNameField.OnInputAccepted([=](wi::gui::EventArgs args) {
|
||||
NameComponent* name = editor->GetCurrentScene().names.GetComponent(entity);
|
||||
@@ -447,28 +454,6 @@ void MaterialWindow::Create(EditorComponent* _editor)
|
||||
});
|
||||
AddWidget(&materialNameField);
|
||||
|
||||
newMaterialButton.Create("New Material");
|
||||
newMaterialButton.SetPos(XMFLOAT2(10 + 5 + 300, y));
|
||||
newMaterialButton.SetSize(XMFLOAT2(100, hei));
|
||||
newMaterialButton.OnClick([=](wi::gui::EventArgs args) {
|
||||
Scene& scene = editor->GetCurrentScene();
|
||||
Entity entity = scene.Entity_CreateMaterial("editorMaterial");
|
||||
|
||||
wi::Archive& archive = editor->AdvanceHistory();
|
||||
archive << EditorComponent::HISTORYOP_ADD;
|
||||
editor->RecordSelection(archive);
|
||||
|
||||
editor->ClearSelected();
|
||||
editor->AddSelected(entity);
|
||||
editor->RefreshEntityTree();
|
||||
|
||||
editor->RecordSelection(archive);
|
||||
editor->RecordAddedEntity(archive, entity);
|
||||
|
||||
SetEntity(entity);
|
||||
});
|
||||
AddWidget(&newMaterialButton);
|
||||
|
||||
colorComboBox.Create("Color picker mode: ");
|
||||
colorComboBox.SetSize(XMFLOAT2(120, hei));
|
||||
colorComboBox.SetPos(XMFLOAT2(x + 150, y += step));
|
||||
@@ -480,7 +465,7 @@ void MaterialWindow::Create(EditorComponent* _editor)
|
||||
colorComboBox.SetTooltip("Choose the destination data of the color picker.");
|
||||
AddWidget(&colorComboBox);
|
||||
|
||||
colorPicker.Create("Color", false);
|
||||
colorPicker.Create("Color", wi::gui::Window::WindowControls::NONE);
|
||||
colorPicker.SetPos(XMFLOAT2(10, y += step));
|
||||
colorPicker.SetVisible(true);
|
||||
colorPicker.SetEnabled(true);
|
||||
@@ -689,7 +674,7 @@ void MaterialWindow::Create(EditorComponent* _editor)
|
||||
AddWidget(&textureSlotUvsetField);
|
||||
|
||||
|
||||
Translate(XMFLOAT3((float)editor->GetLogicalWidth() - 880, 120, 0));
|
||||
SetMinimized(true);
|
||||
SetVisible(false);
|
||||
|
||||
SetEntity(INVALID_ENTITY);
|
||||
@@ -708,9 +693,19 @@ void MaterialWindow::SetEntity(Entity entity)
|
||||
{
|
||||
SetEnabled(true);
|
||||
|
||||
const NameComponent& name = *scene.names.GetComponent(entity);
|
||||
|
||||
materialNameField.SetValue(name.name);
|
||||
const NameComponent* name = scene.names.GetComponent(entity);
|
||||
if (name == nullptr)
|
||||
{
|
||||
materialNameField.SetValue("[no_name] " + std::to_string(entity));
|
||||
}
|
||||
else if (name->name.empty())
|
||||
{
|
||||
materialNameField.SetValue("[name_empty] " + std::to_string(entity));
|
||||
}
|
||||
else
|
||||
{
|
||||
materialNameField.SetValue(name->name);
|
||||
}
|
||||
shadowReceiveCheckBox.SetCheck(material->IsReceiveShadow());
|
||||
shadowCasterCheckBox.SetCheck(material->IsCastingShadow());
|
||||
useVertexColorsCheckBox.SetCheck(material->IsUsingVertexColors());
|
||||
@@ -777,8 +772,8 @@ void MaterialWindow::SetEntity(Entity entity)
|
||||
pomSlider.SetRange(0, 0.99f);
|
||||
break;
|
||||
case MaterialComponent::SHADERTYPE_PBR_PARALLAXOCCLUSIONMAPPING:
|
||||
pomSlider.SetText("Parallax Occlusion Mapping: ");
|
||||
pomSlider.SetTooltip("Adjust how much the bump map should modulate the surface parallax effect. \nOnly works with PBR + Parallax shader.");
|
||||
pomSlider.SetText("Par Occl Mapping: ");
|
||||
pomSlider.SetTooltip("[Parallax Occlusion Mapping] Adjust how much the bump map should modulate the surface parallax effect. \nOnly works with PBR + Parallax shader.");
|
||||
pomSlider.SetRange(0, 0.1f);
|
||||
break;
|
||||
default:
|
||||
@@ -833,5 +828,4 @@ void MaterialWindow::SetEntity(Entity entity)
|
||||
textureSlotUvsetField.SetText("");
|
||||
}
|
||||
|
||||
newMaterialButton.SetEnabled(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user