mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-09 20:08:57 +03:00
Added toggle for SSAO
This commit is contained in:
@@ -761,6 +761,21 @@ namespace Nuake {
|
||||
ImGui::TableSetupColumn("set", 0, 0.6);
|
||||
ImGui::TableSetupColumn("reset", 0, 0.1);
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
{
|
||||
// Title
|
||||
ImGui::Text("SSAO");
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
ImGui::Checkbox("##SSAOEnabled", &env->SSAOEnabled);
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
// Reset button
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1, 1, 1, 0));
|
||||
std::string resetSSAO = ICON_FA_UNDO + std::string("##resetSSAO");
|
||||
if (ImGui::Button(resetSSAO.c_str())) env->SSAOEnabled = false;
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
ImGui::TableNextColumn();
|
||||
{
|
||||
// Title
|
||||
|
||||
@@ -40,6 +40,16 @@ namespace Nuake
|
||||
_ssaoBlurFramebuffer->QueueResize(size);
|
||||
}
|
||||
|
||||
void SSAO::Clear()
|
||||
{
|
||||
_ssaoBlurFramebuffer->Bind();
|
||||
{
|
||||
RenderCommand::SetClearColor({ 1, 1, 1, 1});
|
||||
_ssaoBlurFramebuffer->Clear();
|
||||
}
|
||||
_ssaoBlurFramebuffer->Unbind();
|
||||
}
|
||||
|
||||
void SSAO::GenerateKernel()
|
||||
{
|
||||
std::uniform_real_distribution<float> randomFloats(0.0, 1.0); // random floats between [0.0, 1.0]
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace Nuake
|
||||
float Falloff = 0.002f;
|
||||
float Strength = 0.2f;
|
||||
void Resize(const Vector2& size);
|
||||
void Clear();
|
||||
SSAO();
|
||||
void Draw(FrameBuffer* gBuffer, const Matrix4& projection, const Matrix4& view);
|
||||
Ref<FrameBuffer> GetOuput() const;
|
||||
|
||||
@@ -56,8 +56,15 @@ namespace Nuake
|
||||
|
||||
// SSAO
|
||||
const auto& sceneEnv = scene.GetEnvironment();
|
||||
sceneEnv->mSSAO->Resize(framebuffer.GetSize());
|
||||
sceneEnv->mSSAO->Draw(mGBuffer.get(), mProjection, mView);
|
||||
if (sceneEnv->SSAOEnabled)
|
||||
{
|
||||
sceneEnv->mSSAO->Resize(framebuffer.GetSize());
|
||||
sceneEnv->mSSAO->Draw(mGBuffer.get(), mProjection, mView);
|
||||
}
|
||||
else
|
||||
{
|
||||
sceneEnv->mSSAO->Clear();
|
||||
}
|
||||
|
||||
mShadingBuffer->QueueResize(framebuffer.GetSize());
|
||||
ShadingPass(scene);
|
||||
|
||||
Reference in New Issue
Block a user