Skip to content

Commit

Permalink
Moved SSAO settings out of scene
Browse files Browse the repository at this point in the history
  • Loading branch information
AEspinosaDev committed Oct 9, 2024
1 parent 93b088b commit 6bc62fb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 55 deletions.
31 changes: 0 additions & 31 deletions include/engine/core/scene/scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ class Scene : public Object3D
Vec3 m_ambientColor{0.7f, 0.5f, 0.5f};
float m_ambientIntensity{0.2f};

// SSAO
bool m_ssao{true};
float m_occRadius{0.5};
float m_occBias{0.025};

// FOG
bool m_fog{true};
Vec3 m_fogColor{0.2f, 0.2f, 0.2f};
Expand Down Expand Up @@ -145,32 +140,6 @@ class Scene : public Object3D
return m_fogIntensity;
}

inline void enable_ssao(bool op)
{
m_ssao = op;
}
inline bool is_ssao_enabled() const
{
return m_ssao;
}

inline void set_ssao_radius(float i)
{
m_occRadius = i;
}
inline float get_ssao_radius() const
{
return m_occRadius;
}

inline void set_ssao_bias(float i)
{
m_occBias = i;
}
inline float get_ssao_bias()
{
return m_occBias;
}
};

VULKAN_ENGINE_NAMESPACE_END
Expand Down
11 changes: 6 additions & 5 deletions src/core/renderer_data_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void Renderer::update_global_data(Scene *const scene)
SceneUniforms sceneParams;
sceneParams.fogParams = {camera->get_near(), camera->get_far(), scene->get_fog_intensity(),
scene->is_fog_enabled()};
sceneParams.fogColorAndSSAO = Vec4(scene->get_fog_color(), scene->is_ssao_enabled());
sceneParams.fogColorAndSSAO = Vec4(scene->get_fog_color(), 0.0f);
sceneParams.SSAOtype = 0;
sceneParams.emphasizeAO = false;
sceneParams.ambientColor = Vec4(scene->get_ambient_color(), scene->get_ambient_intensity());
Expand Down Expand Up @@ -125,10 +125,11 @@ void Renderer::update_object_data(Scene *const scene)

ObjectUniforms objectData;
objectData.model = m->get_model_matrix();
objectData.otherParams1 = {m->is_affected_by_fog(), m->get_recive_shadows(),
m->get_cast_shadows(), false}; objectData.otherParams2 = {m->is_selected(), 0.0, 0.0, 0.0};
m_context.frames[m_currentFrame].uniformBuffers[1].upload_data(m_context.memory, &objectData,
sizeof(ObjectUniforms), objectOffset);
objectData.otherParams1 = {m->is_affected_by_fog(), m->get_recive_shadows(), m->get_cast_shadows(),
false};
objectData.otherParams2 = {m->is_selected(), 0.0, 0.0, 0.0};
m_context.frames[m_currentFrame].uniformBuffers[1].upload_data(
m_context.memory, &objectData, sizeof(ObjectUniforms), objectOffset);

// void *meshData = nullptr;
// size_t size = 0;
Expand Down
19 changes: 0 additions & 19 deletions src/utilities/widgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,25 +242,6 @@ void SceneExplorerWidget::render()
}
ImGui::Separator();
ImGui::Spacing();
ImGui::SeparatorText("Ambient Occlusion");
ImGui::Spacing();
bool enableSSAO = m_scene->is_ssao_enabled();
if (ImGui::Checkbox("Enable", &enableSSAO))
{
m_scene->enable_ssao(enableSSAO);
}

float ssaoRad = m_scene->get_ssao_radius();
if (ImGui::DragFloat("Radius", &ssaoRad, .1f, 0.0f, 5.0f))
{
m_scene->set_ssao_radius(ssaoRad);
}
float ssaoBias = m_scene->get_ssao_bias();
if (ImGui::DragFloat("Bias", &ssaoBias, .01f, 0.0f, 5.0f))
{
m_scene->set_ssao_bias(ssaoBias);
}

ImGui::Separator();
}
void Profiler::render()
Expand Down

0 comments on commit 6bc62fb

Please sign in to comment.