mirror of
https://github.com/barkeser2002/flower.git
synced 2026-09-25 20:17:06 +03:00
171 lines
5.2 KiB
C++
171 lines
5.2 KiB
C++
#include "component_draw.h"
|
|
#include <imgui/ui.h>
|
|
#include <scene/scene.h>
|
|
#include "../editor/editor.h"
|
|
#include "../editor/widgets/project_content.h"
|
|
#include <scene/component/postprocess.h>
|
|
|
|
using namespace engine;
|
|
using namespace engine::ui;
|
|
|
|
void ComponentDrawer::drawPostprocess(std::shared_ptr<engine::SceneNode> node)
|
|
{
|
|
std::shared_ptr<PostprocessVolumeComponent> comp = node->getComponent<PostprocessVolumeComponent>();
|
|
auto copySetting = comp->getSetting();
|
|
|
|
if (ImGui::CollapsingHeader("Exposure setting"))
|
|
{
|
|
ImGui::PushID("ExposureSetting");
|
|
ImGui::Spacing();
|
|
ImGui::Indent();
|
|
ImGui::PushItemWidth(100.0f);
|
|
|
|
// TODO: Change to physic camera parameters.
|
|
ImGui::Checkbox("Auto Exposure", ©Setting.bAutoExposure);
|
|
if (copySetting.bAutoExposure)
|
|
{
|
|
ImGui::DragFloat("Low Percent", ©Setting.autoExposureLowPercent, 1e-3f, 0.01f, 0.5f);
|
|
ImGui::DragFloat("High Percent", ©Setting.autoExposureHighPercent, 1e-3f, 0.5f, 0.99f);
|
|
|
|
ImGui::DragFloat("Min Brightness", ©Setting.autoExposureMinBrightness, 0.5f, -9.0f, 9.0f);
|
|
ImGui::DragFloat("Max Brightness", ©Setting.autoExposureMaxBrightness, 0.5f, -9.0f, 9.0f);
|
|
|
|
ImGui::DragFloat("Speed Down", ©Setting.autoExposureSpeedDown, 0.1f, 0.0f);
|
|
ImGui::DragFloat("Speed Up", ©Setting.autoExposureSpeedUp, 0.1f, 0.0f);
|
|
|
|
ImGui::DragFloat("Exposure Compensation", ©Setting.autoExposureExposureCompensation, 1.0f, 0.0f);
|
|
}
|
|
else
|
|
{
|
|
ImGui::DragFloat("Fix exposure", ©Setting.fixExposure, 0.1f, 0.1f, 100.0f);
|
|
}
|
|
|
|
ImGui::PopItemWidth();
|
|
ImGui::Unindent();
|
|
ImGui::Spacing();
|
|
ImGui::PopID();
|
|
}
|
|
|
|
if (ImGui::CollapsingHeader("Exposure Fusioon"))
|
|
{
|
|
ImGui::PushID("ExposureFusioon");
|
|
ImGui::Spacing();
|
|
ImGui::Indent();
|
|
ImGui::PushItemWidth(100.0f);
|
|
|
|
ImGui::Checkbox("Exposure Fusioon", ©Setting.bEnableExposureFusion);
|
|
if (copySetting.bEnableExposureFusion)
|
|
{
|
|
ImGui::DragFloat("Black", ©Setting.exposureFusionBlack, 1e-3f, 1e-4f, 1.0f);
|
|
ImGui::DragFloat("Shadows", ©Setting.exposureFusionShadows, 1e-3f, 1e-4f, 1.0f);
|
|
ImGui::DragFloat("Highlights", ©Setting.exposureFusionHighlights, 1e-3f, 1.0f, 10.0f);
|
|
|
|
ImGui::Spacing();
|
|
ImGui::DragFloat("Sigma", ©Setting.exposureFusionSigma, 0.1f, 0.0f, 1.0f);
|
|
ImGui::DragFloat("Midtone", ©Setting.exposureFusionWellExposureValue, 0.1f, 0.0f, 1.0f);
|
|
|
|
ImGui::Spacing();
|
|
ImGui::DragFloat("Contrast", ©Setting.exposureFusionContrastPow, 0.1f, 0.0f);
|
|
ImGui::DragFloat("Saturation", ©Setting.exposureFusionSaturationPow, 0.1f, 0.0f);
|
|
ImGui::DragFloat("Exposure", ©Setting.exposureFusionExposurePow, 0.1f, 0.0f);
|
|
}
|
|
|
|
ImGui::PopItemWidth();
|
|
ImGui::Unindent();
|
|
ImGui::Spacing();
|
|
ImGui::PopID();
|
|
}
|
|
|
|
if (ImGui::CollapsingHeader("Bloom Setting"))
|
|
{
|
|
ImGui::PushID("BloomSetting");
|
|
ImGui::Spacing();
|
|
ImGui::Indent();
|
|
ImGui::PushItemWidth(100.0f);
|
|
|
|
ImGui::DragFloat("Intensity", ©Setting.bloomIntensity, 0.01f, 0.0f, 1.0);
|
|
ImGui::DragFloat("Radius", ©Setting.bloomRadius, 0.01f, 0.0f, 1.0);
|
|
|
|
ImGui::DragFloat("Threshold", ©Setting.bloomThreshold, 0.01f, 0.0f, 1.0);
|
|
ImGui::DragFloat("Threshold soft", ©Setting.bloomThresholdSoft, 0.01f, 0.0f, 1.0);
|
|
|
|
ImGui::PopItemWidth();
|
|
ImGui::Unindent();
|
|
ImGui::Spacing();
|
|
ImGui::PopID();
|
|
}
|
|
|
|
#if 0
|
|
if (ImGui::CollapsingHeader("GTAO Setting"))
|
|
{
|
|
ImGui::PushID("GTAO");
|
|
ImGui::Spacing();
|
|
ImGui::Indent();
|
|
ImGui::PushItemWidth(100.0f);
|
|
|
|
ImGui::DragInt("slice num", ©Setting.gtaoSliceNum, 1, 1, 8);
|
|
if (copySetting.gtaoSliceNum >= 1)
|
|
{
|
|
copySetting.gtaoSliceNum = glm::clamp(getNextPOT(copySetting.gtaoSliceNum), 1, 8);
|
|
}
|
|
else
|
|
{
|
|
copySetting.gtaoSliceNum = 1;
|
|
}
|
|
|
|
ImGui::DragInt("step times", ©Setting.gtaoStepNum, 1, 1, 12);
|
|
ImGui::DragFloat("radius", ©Setting.gtaoRadius, 0.1f, 0.5f, 4.0f);
|
|
ImGui::DragFloat("thickness", ©Setting.gtaoThickness, 0.1f, 0.1f, 1.0f);
|
|
|
|
ImGui::DragFloat("ao power", ©Setting.gtaoPower, 0.1f, 0.1f, 3.0f);
|
|
ImGui::DragFloat("ao intensity", ©Setting.gtaoIntensity, 0.01f, 0.0f, 1.0f);
|
|
|
|
ImGui::PopItemWidth();
|
|
ImGui::Unindent();
|
|
ImGui::Spacing();
|
|
ImGui::PopID();
|
|
}
|
|
#endif
|
|
|
|
if (ImGui::CollapsingHeader("SSGI Setting"))
|
|
{
|
|
ImGui::PushID("SSGI");
|
|
ImGui::Spacing();
|
|
ImGui::Indent();
|
|
ImGui::PushItemWidth(100.0f);
|
|
|
|
ImGui::DragInt("slice num", ©Setting.ssgiSliceCount, 1, 1, 8);
|
|
|
|
ImGui::DragInt("step times", ©Setting.ssgiStepCount, 1, 1, 12);
|
|
ImGui::DragFloat("radius", ©Setting.ssgiViewRadius, 0.1f, 0.5f, 4.0f);
|
|
|
|
ImGui::DragFloat("falloff", ©Setting.ssgiFalloff, 0.1f, 0.1f, 1.0f);
|
|
|
|
ImGui::DragFloat("ao power", ©Setting.ssgiPower, 0.1f, 0.1f, 3.0f);
|
|
ImGui::DragFloat("ao intensity", ©Setting.ssgiIntensity, 0.01f, 0.0f, 1.0f);
|
|
|
|
ImGui::PopItemWidth();
|
|
ImGui::Unindent();
|
|
ImGui::Spacing();
|
|
ImGui::PopID();
|
|
}
|
|
|
|
if (ImGui::CollapsingHeader("SSSS"))
|
|
{
|
|
ImGui::PushID("SSSS");
|
|
ImGui::Spacing();
|
|
ImGui::Indent();
|
|
ImGui::PushItemWidth(100.0f);
|
|
|
|
|
|
ImGui::DragFloat("width", ©Setting.ssss_width, 0.01f, 0.00f, 0.06f);
|
|
ImGui::DragFloat("max width", ©Setting.ssss_maxScale, 0.1f, 1.0f, 5.0f);
|
|
ImGui::PopItemWidth();
|
|
ImGui::Unindent();
|
|
ImGui::Spacing();
|
|
ImGui::PopID();
|
|
}
|
|
|
|
|
|
comp->changeSetting(copySetting);
|
|
} |