Created
April 10, 2023 14:01
-
-
Save fcor/7c43f898528ac9ac62ea98b528016d27 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #version 150 | |
| uniform float time; | |
| uniform vec2 resolution; | |
| uniform vec2 mouse; | |
| uniform vec3 spectrum; | |
| uniform sampler2D midi; | |
| in VertexData | |
| { | |
| vec4 v_position; | |
| vec3 v_normal; | |
| vec2 v_texcoord; | |
| } inData; | |
| out vec4 fragColor; | |
| // By DataNeel | |
| vec2 midiCoord(float offset) { | |
| float x = mod(offset,32.); | |
| float y = offset / 32.; | |
| return vec2(x,y)/32.; | |
| } | |
| // By companje | |
| float map(float value, float min1, float max1, float min2, float max2) { | |
| return min2 + (value - min1) * (max2 - min2) / (max1 - min1); | |
| } | |
| void main(void) | |
| { | |
| vec2 uv = -1. + 2. * inData.v_texcoord; | |
| float cc1 = 3.0 * 127.0 + 10.0; | |
| float cc2 = 2.0 * 127.0 + 44.0; | |
| float cc3 = 3.0 * 127.0 + 74.0; | |
| float val1 = texture(midi, midiCoord(cc1)).w; | |
| float val2 = texture(midi, midiCoord(cc2)).w; | |
| float val3 = texture(midi, midiCoord(cc3)).w; | |
| vec3 col = vec3(val1, val2, val3); | |
| fragColor = vec4(col,1.0); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment