summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLaG1924 <lag1924@gmail.com>2021-12-11 16:44:40 +0100
committerLaG1924 <lag1924@gmail.com>2021-12-11 16:44:40 +0100
commitbe808181b2c84358b232e4a32d1a6dd9dd6659ed (patch)
tree5a0089532532a52fc307d836e2b1e90eced06779 /src
parentRemoved unnecessary framebuffers copying (diff)
downloadAltCraft-be808181b2c84358b232e4a32d1a6dd9dd6659ed.tar
AltCraft-be808181b2c84358b232e4a32d1a6dd9dd6659ed.tar.gz
AltCraft-be808181b2c84358b232e4a32d1a6dd9dd6659ed.tar.bz2
AltCraft-be808181b2c84358b232e4a32d1a6dd9dd6659ed.tar.lz
AltCraft-be808181b2c84358b232e4a32d1a6dd9dd6659ed.tar.xz
AltCraft-be808181b2c84358b232e4a32d1a6dd9dd6659ed.tar.zst
AltCraft-be808181b2c84358b232e4a32d1a6dd9dd6659ed.zip
Diffstat (limited to 'src')
-rw-r--r--src/RenderConfigs.cpp13
-rw-r--r--src/RenderConfigs.hpp2
-rw-r--r--src/RendererWorld.cpp2
3 files changed, 6 insertions, 11 deletions
diff --git a/src/RenderConfigs.cpp b/src/RenderConfigs.cpp
index af1cde9..d399818 100644
--- a/src/RenderConfigs.cpp
+++ b/src/RenderConfigs.cpp
@@ -198,18 +198,12 @@ Gbuffer::Gbuffer(size_t geomW, size_t geomH, size_t lightW, size_t lightH, int s
dsConf->SetMaxFilter(Gal::Filtering::Bilinear);
depthStencil = gal->BuildTexture(dsConf);
- auto worldPosConf = gal->CreateTexture2DConfig(geomW, geomH, Gal::Format::R32G32B32A32F);
- worldPosConf->SetMinFilter(Gal::Filtering::Bilinear);
- worldPosConf->SetMaxFilter(Gal::Filtering::Bilinear);
- worldPos = gal->BuildTexture(worldPosConf);
-
auto geomFbConf = gal->CreateFramebufferConfig();
geomFbConf->SetDepthStencil(depthStencil);
geomFbConf->SetTexture(0, color);
geomFbConf->SetTexture(1, normal);
- geomFbConf->SetTexture(2, worldPos);
- geomFbConf->SetTexture(3, addColor);
- geomFbConf->SetTexture(4, light);
+ geomFbConf->SetTexture(2, addColor);
+ geomFbConf->SetTexture(3, light);
geomFramebuffer = gal->BuildFramebuffer(geomFbConf);
geomFramebuffer->SetViewport(0, 0, geomW, geomH);
@@ -234,7 +228,7 @@ Gbuffer::Gbuffer(size_t geomW, size_t geomH, size_t lightW, size_t lightH, int s
std::vector<std::pair<std::string_view, std::shared_ptr<Gal::Texture>>> ssaoTextures = {
{"normal", normal},
- {"worldPos", worldPos},
+ {"depthStencil", depthStencil},
{"ssaoNoise", ssaoNoise},
};
@@ -280,7 +274,6 @@ Gbuffer::Gbuffer(size_t geomW, size_t geomH, size_t lightW, size_t lightH, int s
{"depthStencil", depthStencil},
{"color", color},
{"normal", normal},
- {"worldPos", worldPos},
{"addColor", addColor},
{"light", light},
};
diff --git a/src/RenderConfigs.hpp b/src/RenderConfigs.hpp
index 8ca5a9e..92ce90c 100644
--- a/src/RenderConfigs.hpp
+++ b/src/RenderConfigs.hpp
@@ -5,6 +5,7 @@
struct GlobalShaderParameters {
glm::mat4 projView;
glm::mat4 proj;
+ glm::mat4 invProj;
glm::mat4 view;
glm::uvec2 viewportSize;
glm::uint32 paddingFA = 0xFAAFFAFA;
@@ -95,7 +96,6 @@ class Gbuffer {
std::shared_ptr<Gal::Texture> depthStencil;
std::shared_ptr<Gal::Texture> color; //RGB - color
std::shared_ptr<Gal::Texture> normal; //RGB - normal
- std::shared_ptr<Gal::Texture> worldPos; //RGB - viewSpaceWorldPos
std::shared_ptr<Gal::Texture> addColor; //RGB - addColor
std::shared_ptr<Gal::Texture> light; //R - faceLight, G - skyLight, B - unused
std::shared_ptr<Gal::Framebuffer> geomFramebuffer;
diff --git a/src/RendererWorld.cpp b/src/RendererWorld.cpp
index b5120c2..b6e504d 100644
--- a/src/RendererWorld.cpp
+++ b/src/RendererWorld.cpp
@@ -287,6 +287,8 @@ void RendererWorld::Render(float screenRatio) {
0.1f, 10000000.0f
);
+ globalSpb->Get<GlobalShaderParameters>()->invProj = glm::inverse(projection);
+
auto& view = globalSpb->Get<GlobalShaderParameters>()->view;
view = GetGameState()->GetViewMatrix();