From 0703da0f1ff836939ed867f82ab3e406d2a456c7 Mon Sep 17 00:00:00 2001 From: "re.kovalev" Date: Fri, 3 Feb 2023 13:32:44 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=BF=D0=BE=D0=BB=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=B4=D0=BB=D1=8F=20=D0=BF=D0=BB=D0=BE?= =?UTF-8?q?=D1=81=D0=BA=D0=BE=D0=B9=20=D0=BF=D0=BE=D0=B2=D0=B5=D1=80=D1=85?= =?UTF-8?q?=D0=BD=D0=BE=D1=81=D1=82=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index ab8f7e3..469e27f 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -356,13 +356,35 @@ int main(void) rectangle.material.ka = {0.05, 0.05, 0.05}; rectangle.material.kd = {1, 1, 1}; + // Текстуры для прямоугольника + Texture rectangle_diffuse(TEX_DIFFUSE, "../resources/textures/rekovalev_diffusemap.png"); + rectangle.set_texture(rectangle_diffuse); + Texture rectangle_normal(TEX_NORMAL, "../resources/textures/rekovalev_normalmap.png"); + rectangle.set_texture(rectangle_normal); + Texture rectangle_heights(TEX_HEIGHTS, "../resources/textures/rekovalev_bumpmap.png"); + rectangle.set_texture(rectangle_heights); + + // Текстурные координаты + glm::vec2 rectangle_texCoord[] = { { 1.0f, 0.0f } + , { 1.0f, 1.0f } + , { 0.0f, 1.0f } + , { 0.0f, 0.0f } + }; + rectangle.load_texCoords(rectangle_texCoord, sizeof(rectangle_texCoord)/sizeof(glm::vec2)); + + // Касательные и бикасательные векторы + glm::vec3 rectangle_tangent[4], rectangle_bitangent[4]; + calc_tb(rectangle_indices, 6, rectangle_verticies, rectangle_texCoord, rectangle_tangent, rectangle_bitangent); + rectangle.load_tangent(rectangle_tangent, 4); + rectangle.load_bitangent(rectangle_bitangent, 4); + // Шейдер для рисования отладочных лампочек ShaderProgram bulbShader; // Загрузка и компиляция шейдеров bulbShader.load(GL_VERTEX_SHADER, "shaders/bulb.vert"); bulbShader.load(GL_FRAGMENT_SHADER, "shaders/bulb.frag"); bulbShader.link(); - + // Вершины для скайбокса glm::vec3 skybox_verticies[] = { {-1.0f, 1.0f, -1.0f}, @@ -407,6 +429,7 @@ int main(void) {-1.0f, -1.0f, 1.0f}, { 1.0f, -1.0f, 1.0f} }; + // Модель скайбокса Model skybox; skybox.load_verteces(skybox_verticies, sizeof(skybox_verticies)/sizeof(glm::vec3));