From 8485ceb2e40f7b2a92af9e4a0d01efd4e081f4b8 Mon Sep 17 00:00:00 2001 From: "re.kovalev" Date: Sun, 15 Jan 2023 03:10:37 +0300 Subject: [PATCH] =?UTF-8?q?=D0=93=D0=B5=D0=BD=D0=B5=D1=80=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=B1=D1=83=D1=84=D0=B5=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 95e6038..609a02d 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,6 +17,7 @@ Texture* pgNormal = NULL; Texture* pgDiffuseP = NULL; Texture* pgAmbientSpecular = NULL; RBO* pgrbo = NULL; +Texture* pssaoTexture = NULL; // Размеры окна int WINDOW_WIDTH = 800; int WINDOW_HEIGHT = 600; @@ -38,6 +39,9 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // И буфера глубины if (pgrbo) pgrbo->reallocate(width, height); + // SSAO + if (pssaoTexture) + pssaoTexture->reallocate(width, height, 6, GL_RED, GL_RED); // Запомним новые размеры окна WINDOW_WIDTH = width; @@ -242,6 +246,15 @@ int main(void) pointShadowShader.load(GL_FRAGMENT_SHADER, "shaders/point_shadow.frag"); pointShadowShader.link(); + // Создадим буфер для вычисления SSAO + GLuint attachments_ssao[] = { GL_COLOR_ATTACHMENT0 }; + FBO ssaoBuffer(attachments_ssao, sizeof(attachments_ssao) / sizeof(GLuint)); + // Создадим текстуры для буфера кадра + Texture ssaoTexture(WINDOW_WIDTH, WINDOW_HEIGHT, GL_COLOR_ATTACHMENT0, 6, GL_RED, GL_RED); + pssaoTexture = &ssaoTexture; + // Активируем базовый буфер кадра + FBO::useDefault(); + // Модель прямоугольника Model rectangle;