#version 450
/*
 * Copyright 2023 TU Wien, Institute of Visual Computing & Human-Centered Technology.
 * This file is part of the GCG Lab Framework and must not be redistributed.
 *
 * Original version created by Lukas Gersthofer and Bernhard Steiner.
 * Vulkan edition created by Johannes Unterguggenberger (junt@cg.tuwien.ac.at).
 */

layout (binding = 0) uniform UniformBuffer {
	vec4 color;
	mat4 modelMatrix;
	mat4 modelMatrixForNormals;
	mat4 viewProjMatrix;
	vec4 cameraPosition;
	vec4 illumination; // ka, kd, ks, alpha
} ub_data;

layout (binding = 1) uniform DirectionalLight {
	vec4 color;
	vec4 direction;
} dl_data;

struct PointLight {
	vec4 color;
	vec4 position;
	vec4 attenuation;
};

layout (binding = 2) uniform PointLights {
	PointLight lights[2];
} pl_data;

layout (binding = 3) uniform sampler2D diffuse_texture;
layout (binding = 4) uniform sampler2D rendered_normals;
layout (binding = 5) uniform sampler2D depth;

layout (location = 0) in VertexData {
	vec3 positionWorld;
	vec3 normalWorld;
	vec2 textureCoordinates;
} frag_in;

layout (location = 0) out vec4 out_color;

void main() {
	vec3 scaledNormal = normalize(frag_in.normalWorld) * 0.5 + 0.5;
	float p = 2.0f;
	out_color = vec4(pow(scaledNormal.x, p), pow(scaledNormal.y, p), pow(scaledNormal.z, p), 1.0f);
}

