Запись ID объекта в текстуру

This commit is contained in:
2023-04-03 10:26:47 +03:00
committed by re.kovalev
parent 5f9e1f3003
commit 9bcd8c06c5
2 changed files with 11 additions and 1 deletions

View File

@@ -15,6 +15,7 @@ layout (location = 0) out vec3 gPosition;
layout (location = 1) out vec3 gNormal;
layout (location = 2) out vec4 gDiffuseP;
layout (location = 3) out vec4 gAmbientSpecular;
layout (location = 4) out uvec3 gID;
in vec3 vertex; // Позиция вершины в пространстве
in vec3 N; // Нормаль трансформированноая
@@ -31,6 +32,8 @@ uniform sampler2D tex_normal;
uniform float parallax_heightScale = 0.1;
uniform uvec3 ID = uvec3(0);
void main()
{
// Сформируем TBN матрицу
@@ -103,4 +106,6 @@ void main()
gAmbientSpecular.rgb = texture(tex_ambient, new_texCoord).rgb * ka;
// Сохранение зеркальной составляющей
gAmbientSpecular.a = texture(tex_specular, new_texCoord).r * ks.r;
// Сохранение идентификатора объекта
gID = ID;
}