diff --git a/shaders/tag.vs b/shaders/tag.vs index 18bdf67..34db6b7 100644 --- a/shaders/tag.vs +++ b/shaders/tag.vs @@ -13,13 +13,14 @@ uniform mat4 proj, model, view; uniform vec4 lumPos; uniform float phase; +uniform float averageMusic; void main(void) { mat4 N = transpose(inverse(view * model)); vsoNormal = normalize((N * vec4(vsiNormal, 0)).xyz); vec4 lumPosv = view * lumPos; - float dist = length(vsiPosition.xz), freq = 5, amplitude = 0.1 * (sqrt(2.) - dist); + float dist = length(vsiPosition.xz), freq = 5, amplitude = averageMusic * (sqrt(2.) - dist); float y = amplitude * cos(phase + freq * dist); vec3 p = vec3(vsiPosition.x, y, vsiPosition.z); diff --git a/src/tag.c b/src/tag.c index 347284f..1032510 100644 --- a/src/tag.c +++ b/src/tag.c @@ -90,6 +90,8 @@ static void draw(void) { glBindTexture(GL_TEXTURE_2D, _texId[0]); glUniform1f(glGetUniformLocation(_pId, "phase"), 0); glUniform4fv(glGetUniformLocation(_pId, "lumPos"), 1, lum_pos); + glUniform1f(glGetUniformLocation(_pId, "averageMusic"), + (float)averageMusic() * 5); glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, _texId[1]);