From 29c45e43e84ddd5c021403868f6cb7056c0d1f56 Mon Sep 17 00:00:00 2001 From: Tibo De Peuter Date: Fri, 6 Dec 2024 15:04:49 +0100 Subject: [PATCH] feat(3): Task 3 --- src/3_snap_to_sphere.tes | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/3_snap_to_sphere.tes b/src/3_snap_to_sphere.tes index 873e025..0e2a1b6 100644 --- a/src/3_snap_to_sphere.tes +++ b/src/3_snap_to_sphere.tes @@ -35,10 +35,15 @@ void main() // (so before model, view, proj are applied) ///////////////////////////////////////////////////////////////////////////// - // Replace with your code + // Replace with your code + // Based on: + // https://learnopengl.com/Guest-Articles/2021/Tessellation/Tessellation + sphere_fs_in = normalize(interp_pos.xyz); + view_pos_fs_in = view * model(is_moon, animation_seconds) * vec4(sphere_fs_in, 1.0); + normal_fs_in = normalize(mat3(view * model(is_moon, animation_seconds)) * sphere_fs_in); + pos_fs_in = proj * view_pos_fs_in; - - gl_Position = interp_pos; + gl_Position = pos_fs_in; ///////////////////////////////////////////////////////////////////////////// }