use average music in tag

This commit is contained in:
Mylloon 2023-05-26 01:59:03 +02:00
parent 82aa077069
commit 19eebadb17
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 4 additions and 1 deletions

View file

@ -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);

View file

@ -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]);