summaryrefslogtreecommitdiffstats
path: root/src/RenderConfigs.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/RenderConfigs.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/RenderConfigs.cpp b/src/RenderConfigs.cpp
index ebdbaef..86418c2 100644
--- a/src/RenderConfigs.cpp
+++ b/src/RenderConfigs.cpp
@@ -5,24 +5,44 @@
Gbuffer::Gbuffer(size_t geomW, size_t geomH, size_t lightW, size_t lightH) {
auto gal = Gal::GetImplementation();
- auto colorConf = gal->CreateTexture2DConfig(geomW, geomH, Gal::Format::R8G8B8A8);
+ auto colorConf = gal->CreateTexture2DConfig(geomW, geomH, Gal::Format::R8G8B8);
+ colorConf->SetMinFilter(Gal::Filtering::Bilinear);
+ colorConf->SetMaxFilter(Gal::Filtering::Bilinear);
color = gal->BuildTexture(colorConf);
- auto normalConf = gal->CreateTexture2DConfig(geomW, geomH, Gal::Format::R8G8B8A8);
+ auto normalConf = gal->CreateTexture2DConfig(geomW, geomH, Gal::Format::R8G8B8);
+ normalConf->SetMinFilter(Gal::Filtering::Bilinear);
+ normalConf->SetMaxFilter(Gal::Filtering::Bilinear);
normal = gal->BuildTexture(normalConf);
+ auto addColorConf = gal->CreateTexture2DConfig(geomW, geomH, Gal::Format::R8G8B8);
+ addColorConf->SetMinFilter(Gal::Filtering::Bilinear);
+ addColorConf->SetMaxFilter(Gal::Filtering::Bilinear);
+ addColor = gal->BuildTexture(addColorConf);
+
+ auto lightConf = gal->CreateTexture2DConfig(geomW, geomH, Gal::Format::R8G8B8);
+ lightConf->SetMinFilter(Gal::Filtering::Bilinear);
+ lightConf->SetMaxFilter(Gal::Filtering::Bilinear);
+ light = gal->BuildTexture(lightConf);
+
auto dsConf = gal->CreateTexture2DConfig(geomW, geomH, Gal::Format::D24S8);
+ dsConf->SetMinFilter(Gal::Filtering::Bilinear);
+ dsConf->SetMaxFilter(Gal::Filtering::Bilinear);
depthStencil = gal->BuildTexture(dsConf);
auto geomFbConf = gal->CreateFramebufferConfig();
geomFbConf->SetTexture(0, color);
geomFbConf->SetTexture(1, normal);
+ geomFbConf->SetTexture(2, addColor);
+ geomFbConf->SetTexture(3, light);
geomFbConf->SetDepthStencil(depthStencil);
geomFramebuffer = gal->BuildFramebuffer(geomFbConf);
geomFramebuffer->SetViewport(0, 0, geomW, geomH);
auto finalColorConf = gal->CreateTexture2DConfig(lightW, lightH, Gal::Format::R8G8B8A8);
+ finalColorConf->SetMinFilter(Gal::Filtering::Bilinear);
+ finalColorConf->SetMaxFilter(Gal::Filtering::Bilinear);
finalColor = gal->BuildTexture(finalColorConf);
auto lightFbConf = gal->CreateFramebufferConfig();
@@ -43,8 +63,11 @@ Gbuffer::Gbuffer(size_t geomW, size_t geomH, size_t lightW, size_t lightH) {
auto lightPPC = gal->CreatePipelineConfig();
lightPPC->SetTarget(lightFramebuffer);
lightPPC->AddStaticTexture("color", color);
+ lightPPC->AddStaticTexture("addColor", addColor);
lightPPC->AddStaticTexture("normal", normal);
+ lightPPC->AddStaticTexture("light", light);
lightPPC->AddStaticTexture("depthStencil", depthStencil);
+ lightPPC->AddShaderParameter("dayTime", Gal::Type::Float);
lightPPC->SetVertexShader(gal->LoadVertexShader(vertexSource));
lightPPC->SetPixelShader(gal->LoadPixelShader(pixelSource));