From e64644e0aff9257dab923bf02e744e17320751c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20Dani=C3=ABl=20Maat?= Date: Fri, 12 Aug 2022 22:59:26 +0100 Subject: [PATCH] Fix colors --- src/music/features/visualizer/shaders/vertices.glsl | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/music/features/visualizer/shaders/vertices.glsl b/src/music/features/visualizer/shaders/vertices.glsl index d6a3a7e..b1c947c 100644 --- a/src/music/features/visualizer/shaders/vertices.glsl +++ b/src/music/features/visualizer/shaders/vertices.glsl @@ -1,11 +1,11 @@ #version 300 es -//VERTEX SHADER +// VERTEX SHADER // -// Takes vertices of a unit cube, scales them up along Y according to -// aHeight, and colors them with basic diffuse shading. +// Takes vertices of a unit cube, scales them up along Y according to +// aHeight, and colors them with basic diffuse shading. #define CLEAR_COLOR vec4(0.0, 0.0, 0.0, 1.0) -#define BASE_COLOR vec4(1.0, 1.0, 1.0, 1.0) +#define BASE_COLOR vec3(0.6, 0.819607843137, 0.807843137255) #define AMBIENT_LIGHT vec3(0.3, 0.3, 0.3) #define LIGHT_DIRECTION normalize(vec3(0.85, 0.8, 0.75)) #define LIGHT_COLOR vec3(1.0, 1.0, 1.0) @@ -44,6 +44,9 @@ void main() { vec4 transformedNormal = uNormalMatrix * vec4(aVertexNormal, 1.0); float directionalLight = max(dot(transformedNormal.xyz, LIGHT_DIRECTION), 0.0); - vColor = vec4(directionalLight * LIGHT_COLOR + AMBIENT_LIGHT, 1.0); + vec3 appliedColor = + BASE_COLOR * (directionalLight * LIGHT_COLOR + AMBIENT_LIGHT); + + vColor = vec4(appliedColor.rgb, 1.0); } }