Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hotstreams committed Aug 30, 2024
1 parent 5870490 commit 959782d
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 53 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ OPTION(BUILD_SAMPLES "Builds samples" ON)
OPTION(BUILD_TESTS "Builds tests" ON)

OPTION(OPENGL_DEBUG "Enables debug mode for OpenGL" ON)
OPTION(OPENGL_NO_EXTENSIONS "Disables all extensions" OFF)
OPTION(OPENGL_NO_EXTENSIONS "Disables all extensions" ON)
OPTION(OPENGL_SHADER_OUTPUT "Outputs all source shaders for GLSLANG testing" OFF)

#########################################
Expand Down Expand Up @@ -175,13 +175,13 @@ set(ENGINE_RENDERER
src/limitless/renderer/translucent_pass.cpp
src/limitless/renderer/bloom_pass.cpp
src/limitless/renderer/composite_pass.cpp
# src/limitless/pipeline/common/ssao_pass.cpp
src/limitless/renderer/ssao_pass.cpp
# src/limitless/pipeline/common/fxaa_pass.cpp
src/limitless/renderer/screen_pass.cpp
src/limitless/renderer/render_debug_pass.cpp
# src/limitless/pipeline/common/dof_pass.cpp
src/limitless/renderer/outline_pass.cpp
# src/limitless/pipeline/common/ssr_pass.cpp
src/limitless/renderer/ssr_pass.cpp
src/limitless/renderer/decal_pass.cpp
src/limitless/postprocessing/blur.cpp
src/limitless/postprocessing/bloom.cpp
Expand Down
4 changes: 2 additions & 2 deletions include/limitless/postprocessing/ssr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace Limitless {
class UniformSetter;
class Assets;
class Camera;
class Renderer;

class SSR {
public:
Expand Down Expand Up @@ -45,8 +46,7 @@ namespace Limitless {
Settings settings;
Blur blur;
public:
SSR(Context &ctx, glm::uvec2 frame_size);
explicit SSR(Context &ctx);
SSR(Renderer& renderer);

std::shared_ptr<Texture> getResult();

Expand Down
4 changes: 2 additions & 2 deletions include/limitless/renderer/renderer_settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ namespace Limitless {
/**
* Screen Space Ambient Occlusion
*/
bool screen_space_ambient_occlusion {false};
bool screen_space_ambient_occlusion {true};
SSAO::Settings ssao_settings;

/**
* Screen Space Reflections
*/
bool screen_space_reflections {false};
bool screen_space_reflections {true};
SSR::Settings ssr_settings;

/**
Expand Down
9 changes: 3 additions & 6 deletions include/limitless/renderer/ssr_pass.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,15 @@ namespace Limitless {
private:
SSR ssr;
public:
SSRPass(Pipeline& pipeline, Context& ctx);
SSRPass(Pipeline& pipeline, Context& ctx, glm::uvec2 frame_size);
SSRPass(Renderer& renderer);

std::shared_ptr<Texture> getResult() override { return ssr.getResult(); }
std::shared_ptr<Texture> getResult() { return ssr.getResult(); }

void addUniformSetter(UniformSetter &setter) override;

// void update(Limitless::Scene &scene, Limitless::Instances &instances, Limitless::Context &ctx, const Limitless::Camera &camera) override;

void
draw(InstanceRenderer &renderer, Scene &scene, Context &ctx, const Assets &assets, const Camera &camera,
UniformSetter &setter) override;
void render(InstanceRenderer &renderer, Scene &scene, Context &ctx, const Assets &assets, const Camera &camera, UniformSetter &setter) override;

void onFramebufferChange(glm::uvec2 size) override;
};
Expand Down
26 changes: 4 additions & 22 deletions src/limitless/postprocessing/ssr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,17 @@
#include <limitless/core/uniform/uniform_setter.hpp>
#include <limitless/assets.hpp>
#include <limitless/camera.hpp>
#include <limitless/renderer/renderer.hpp>

using namespace Limitless;

SSR::SSR(Context& ctx)
: blur {ctx.getSize()} {
SSR::SSR(Renderer& renderer)
: blur {renderer.getResolution()} {
auto ssr = Texture::builder()
.target(Texture::Type::Tex2D)
.internal_format(Texture::InternalFormat::RGB16F)
.data_type(Texture::DataType::Float)
.size(ctx.getSize())
.min_filter(Texture::Filter::Nearest)
.mag_filter(Texture::Filter::Nearest)
.wrap_s(Texture::Wrap::ClampToEdge)
.wrap_t(Texture::Wrap::ClampToEdge)
.build();

framebuffer.bind();
framebuffer << TextureAttachment{FramebufferAttachment::Color0, ssr};
framebuffer.checkStatus();
framebuffer.unbind();
}

SSR::SSR(Context &ctx, glm::uvec2 frame_size)
: blur {frame_size} {
auto ssr = Texture::builder()
.target(Texture::Type::Tex2D)
.internal_format(Texture::InternalFormat::RGB16F)
.data_type(Texture::DataType::Float)
.size(ctx.getSize())
.size(renderer.getResolution())
.min_filter(Texture::Filter::Nearest)
.mag_filter(Texture::Filter::Nearest)
.wrap_s(Texture::Wrap::ClampToEdge)
Expand Down
6 changes: 3 additions & 3 deletions src/limitless/renderer/color_picker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ void ColorPicker::process(Context& ctx) {
}

void ColorPicker::render(InstanceRenderer& renderer, [[maybe_unused]] Scene &scene, Context &ctx, const Assets &assets, [[maybe_unused]] const Camera &camera, UniformSetter &setter) {
// if (data.empty()) {
// return;
// }
if (data.empty()) {
return;
}

framebuffer.bind();

Expand Down
6 changes: 4 additions & 2 deletions src/limitless/renderer/renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include <limitless/renderer/outline_pass.hpp>
#include <limitless/renderer/render_debug_pass.hpp>
#include <limitless/renderer/color_picker.hpp>
#include <limitless/renderer/ssao_pass.hpp>
#include <limitless/renderer/ssr_pass.hpp>

using namespace Limitless;

Expand Down Expand Up @@ -100,12 +102,12 @@ Renderer::Builder &Renderer::Builder::addSkyboxPass() {
}

Renderer::Builder &Renderer::Builder::addSSAOPass() {
// renderer->passes.emplace_back(std::make_unique<SSAOPass>(*renderer));
renderer->passes.emplace_back(std::make_unique<SSAOPass>(*renderer));
return *this;
}

Renderer::Builder &Renderer::Builder::addSSRPass() {
// renderer->passes.emplace_back(std::make_unique<SSRPass>(renderer));
renderer->passes.emplace_back(std::make_unique<SSRPass>(*renderer));
return *this;
}

Expand Down
19 changes: 6 additions & 13 deletions src/limitless/renderer/ssr_pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,22 @@
#include "limitless/core/uniform/uniform.hpp"
#include "limitless/core/shader/shader_program.hpp"
#include <random>
#include <iostream>
#include <limitless/camera.hpp>
#include <limitless/renderer/gbuffer_pass.hpp>
#include <limitless/pipeline/pipeline.hpp>
#include <limitless/renderer/deferred_framebuffer_pass.hpp>
#include <limitless/core/buffer/buffer_builder.hpp>
#include <limitless/core/uniform/uniform_setter.hpp>
#include <limitless/renderer/renderer.hpp>

using namespace Limitless;

SSRPass::SSRPass(Pipeline& pipeline, Context& ctx)
: RendererPass(pipeline)
, ssr {ctx} {
SSRPass::SSRPass(Renderer& renderer)
: RendererPass(renderer)
, ssr {renderer} {
}

SSRPass::SSRPass(Pipeline& pipeline, Context& ctx, glm::uvec2 frame_size)
: RendererPass(pipeline)
, ssr {ctx, frame_size} {
}

void SSRPass::draw(InstanceRenderer &renderer, Scene &scene, Context &ctx, const Assets &assets, const Camera &camera,
UniformSetter &setter) {
auto& gbuffer = pipeline.get<DeferredFramebufferPass>();
void SSRPass::render(InstanceRenderer &instance_renderer, Scene &scene, Context &ctx, const Assets &assets, const Camera &camera, UniformSetter &setter) {
auto& gbuffer = renderer.getPass<DeferredFramebufferPass>();

ssr.draw(ctx, assets, camera, gbuffer.getDepth(), gbuffer.getNormal(), gbuffer.getProperties(), gbuffer.getAlbedo());
}
Expand Down

0 comments on commit 959782d

Please sign in to comment.