Files
WickedEngine/Editor/DecalWindow.cpp
T
Turánszki János 180ddc3586 0.49 (#160)
* renderer updates: material shadertype, customshaders

* custom shader updates

* hologram fix

* editor windows refactor

* major gui update:
- gui no longer lifetime manager
- window no longer needs gui to construct
- removed gui constructors/destructors
- rewritten every editor window

* renderer update

* gui hasfocus fix

* editor fix

* renderpath upgrades: hybrid forward-deferred

* fix

* water ripple refactor

* cmake fix

* cmake fix

* renderer fix

* volumetric light fix

* customshader stencilref

* cmake fix

* rtdeferred fix

* editor update

* raytraced shadows denoise

* anisotropic shader

* sss stencil greater

* added cartoon shader

* using precomputed tangents

* added unlit object shader

* importer update

* editor update

* editor fix

* vulkan envmap rendering fix

* terrain shader simplification (normal texture mapping instead of triplanar)

* added subsurface profiles, reduced gbuffer

* denoise disocclusion fallback

* editor fix

* more sorting priority for blend than instancing

* hairparticle culling

* particle updates; font update instancing instead of index buffer; vulkan/dx12 fixes;

* shader fixes

* hairparticle trianglestrip and no cross section

* editor fix

* cam wnd update

* terrain shader fix
2020-10-17 13:17:07 +02:00

74 lines
1.8 KiB
C++

#include "stdafx.h"
#include "DecalWindow.h"
#include "Editor.h"
using namespace wiECS;
using namespace wiScene;
void DecalWindow::Create(EditorComponent* editor)
{
wiWindow::Create("Decal Window");
SetSize(XMFLOAT2(400, 200));
float x = 200;
float y = 5;
float hei = 18;
float step = hei + 2;
placementCheckBox.Create("Decal Placement Enabled: ");
placementCheckBox.SetPos(XMFLOAT2(x, y += step));
placementCheckBox.SetSize(XMFLOAT2(hei, hei));
placementCheckBox.SetCheck(false);
placementCheckBox.SetTooltip("Enable decal placement. Use the left mouse button to place decals to the scene.");
AddWidget(&placementCheckBox);
y += step;
infoLabel.Create("");
infoLabel.SetText("Selecting decals will select the according material. Set decal properties (texture, color, etc.) in the Material window.");
infoLabel.SetSize(XMFLOAT2(400 - 20, 100));
infoLabel.SetPos(XMFLOAT2(10, y));
infoLabel.SetColor(wiColor::Transparent());
AddWidget(&infoLabel);
y += infoLabel.GetScale().y - step + 5;
decalNameField.Create("Decal Name");
decalNameField.SetPos(XMFLOAT2(10, y+=step));
decalNameField.SetSize(XMFLOAT2(300, hei));
decalNameField.OnInputAccepted([&](wiEventArgs args) {
NameComponent* name = wiScene::GetScene().names.GetComponent(entity);
if (name != nullptr)
{
*name = args.sValue;
}
});
AddWidget(&decalNameField);
Translate(XMFLOAT3(30, 30, 0));
SetVisible(false);
SetEntity(INVALID_ENTITY);
}
void DecalWindow::SetEntity(Entity entity)
{
this->entity = entity;
Scene& scene = wiScene::GetScene();
const DecalComponent* decal = scene.decals.GetComponent(entity);
if (decal != nullptr)
{
const NameComponent& name = *scene.names.GetComponent(entity);
decalNameField.SetValue(name.name);
decalNameField.SetEnabled(true);
}
else
{
decalNameField.SetValue("No decal selected");
decalNameField.SetEnabled(false);
}
}