commiting for now, gn

This commit is contained in:
lunarcleint
2024-03-19 04:37:35 -07:00
parent 85cd935163
commit 172af9a680
2 changed files with 88 additions and 0 deletions
@@ -0,0 +1,31 @@
#pragma header
#extension GL_EXT_gpu_shader4 : enable
// Used in charter by waveforms -lunar
uniform vec2 textureRes;
uniform sampler2D waveformTexture;
uniform ivec2 waveformSize;
float getAmplitude() {
float amplitudeRet = 0.; // look in charter for more how it works -lunar
vec2 pixel = openfl_TextureCoordv * textureRes;
float pixelID = floor(pixel.y/3.);
vec2 wavePixel = vec2(int(pixelID)%waveformSize.x, floor(pixelID/waveformSize.x));
vec4 waveData = texture2D(waveformTexture, wavePixel / waveformSize);
switch (int(pixel.y) % 3) {
case 0: amplitudeRet = waveData.r; break;
case 1: amplitudeRet = waveData.g; break;
case 2: amplitudeRet = waveData.b; break;
}
return amplitudeRet;
}
void main()
{
gl_FragColor = vec4(vec3(getAmplitude()), 1.);
}