summaryrefslogtreecommitdiff
path: root/engine/fragment.glsl
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-05-23 20:57:35 +0200
committerHampusM <hampus@hampusmat.com>2024-05-23 20:57:35 +0200
commitf47ce90430f36e74d713e22781a34f89149f7ea5 (patch)
tree01c2439097a3f51517b02cb4cf3cbbd5c773f478 /engine/fragment.glsl
parent638c775707240d365432ed910a88a3cbf545a130 (diff)
refactor(engine): pass vertex data to fragment shader with struct
Diffstat (limited to 'engine/fragment.glsl')
-rw-r--r--engine/fragment.glsl13
1 files changed, 2 insertions, 11 deletions
diff --git a/engine/fragment.glsl b/engine/fragment.glsl
index afeef25..cc46f36 100644
--- a/engine/fragment.glsl
+++ b/engine/fragment.glsl
@@ -7,10 +7,7 @@
out vec4 FragColor;
-in vec2 in_texture_coords;
-
-in vec3 in_frag_pos;
-in vec3 in_normal;
+in VertexData vertex_data;
uniform vec3 view_pos;
uniform sampler2D input_texture;
@@ -20,13 +17,7 @@ uniform int point_light_cnt;
void main()
{
- VertexData vertex_data;
-
- vertex_data.texture_coords = in_texture_coords;
- vertex_data.world_space_pos = in_frag_pos;
- vertex_data.world_space_normal = in_normal;
-
- vec3 ambient_light = calc_ambient_light(material, in_texture_coords);
+ vec3 ambient_light = calc_ambient_light(material, vertex_data.texture_coords);
vec3 point_light_sum = vec3(0.0, 0.0, 0.0);