new material property: receive shadow

This commit is contained in:
Turanszki Janos
2021-02-10 00:10:11 +01:00
parent b937c023f3
commit ff412d7433
8 changed files with 33 additions and 5 deletions
+13 -1
View File
@@ -18,9 +18,20 @@ void MaterialWindow::Create(EditorComponent* editor)
float hei = 18;
float step = hei + 2;
shadowReceiveCheckBox.Create("Receive Shadow: ");
shadowReceiveCheckBox.SetTooltip("Receives shadow or not?");
shadowReceiveCheckBox.SetPos(XMFLOAT2(540, y += step));
shadowReceiveCheckBox.SetSize(XMFLOAT2(hei, hei));
shadowReceiveCheckBox.OnClick([&](wiEventArgs args) {
MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
if (material != nullptr)
material->SetReceiveShadow(args.bValue);
});
AddWidget(&shadowReceiveCheckBox);
shadowCasterCheckBox.Create("Cast Shadow: ");
shadowCasterCheckBox.SetTooltip("The subset will contribute to the scene shadows if enabled.");
shadowCasterCheckBox.SetPos(XMFLOAT2(670, y += step));
shadowCasterCheckBox.SetPos(XMFLOAT2(670, y));
shadowCasterCheckBox.SetSize(XMFLOAT2(hei, hei));
shadowCasterCheckBox.OnClick([&](wiEventArgs args) {
MaterialComponent* material = wiScene::GetScene().materials.GetComponent(entity);
@@ -633,6 +644,7 @@ void MaterialWindow::SetEntity(Entity entity)
const NameComponent& name = *scene.names.GetComponent(entity);
materialNameField.SetValue(name.name);
shadowReceiveCheckBox.SetCheck(material->IsReceiveShadow());
shadowCasterCheckBox.SetCheck(material->IsCastingShadow());
useVertexColorsCheckBox.SetCheck(material->IsUsingVertexColors());
specularGlossinessCheckBox.SetCheck(material->IsUsingSpecularGlossinessWorkflow());