aboutsummaryrefslogtreecommitdiff
path: root/src/main/resources/assets/notenoughupdates/shaders
diff options
context:
space:
mode:
authorMoulberry <james.jenour@student.scotch.wa.edu.au>2020-08-23 11:09:19 +1000
committerMoulberry <james.jenour@student.scotch.wa.edu.au>2020-08-23 11:09:19 +1000
commit3cb08dc571907bdf216ee628c1f8608067a03441 (patch)
treee98e8e67c74394eae1815c3657eccb92e018ba48 /src/main/resources/assets/notenoughupdates/shaders
parent65ae0aa5a0319b6ead2dd6ed07c53a7e7291a23d (diff)
downloadNotEnoughUpdates-3cb08dc571907bdf216ee628c1f8608067a03441.tar.gz
NotEnoughUpdates-3cb08dc571907bdf216ee628c1f8608067a03441.tar.bz2
NotEnoughUpdates-3cb08dc571907bdf216ee628c1f8608067a03441.zip
fine dj
Diffstat (limited to 'src/main/resources/assets/notenoughupdates/shaders')
-rw-r--r--src/main/resources/assets/notenoughupdates/shaders/space_cape.frag60
-rw-r--r--src/main/resources/assets/notenoughupdates/shaders/space_cape.vert12
2 files changed, 72 insertions, 0 deletions
diff --git a/src/main/resources/assets/notenoughupdates/shaders/space_cape.frag b/src/main/resources/assets/notenoughupdates/shaders/space_cape.frag
new file mode 100644
index 00000000..b3cb8a1d
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/shaders/space_cape.frag
@@ -0,0 +1,60 @@
+#version 120
+
+varying vec4 passColour;
+varying vec3 passNormal;
+uniform sampler2D textureIn;
+
+uniform int millis;
+uniform int eventMillis;
+uniform float eventRand; //0-1
+
+void main() {
+ vec4 texture = texture2D(textureIn, gl_TexCoord[0].st);
+
+ vec2 texCoord = gl_TexCoord[0].st + vec2(mod(millis/100.0f,1024.0f)/1024.0f, 421.0f/1024.0f);
+
+ vec4 extra = vec4(0,0,0,0);
+ if(eventRand < 0.4f) {
+ vec2 extraPos = vec2(45.0f+eventRand/0.4f*250.0f, eventMillis/300.0f*550.0f)/1024.0f;
+ vec2 extraTexCoord = vec2(48.0f/1024.0f-(gl_TexCoord[0].t-extraPos.y), gl_TexCoord[0].s-extraPos.x+894.0f/1024.0f);
+ if(extraTexCoord.x > 0.0f && extraTexCoord.x < 200.0f/1024.0f) {
+ if(extraTexCoord.y > 843.0f/1024.0f && extraTexCoord.y < 943.0f/1024.0f) {
+ extra = texture2D(textureIn, extraTexCoord);
+ }
+ }
+ } else if(eventRand < 0.45f) {
+ vec2 extraPos = vec2(-30.0f+eventMillis/2000f*370.0f, 50.0f+(eventRand-0.4f)/0.05f*300.0f)/1024.0f;
+ vec2 extraTexCoord = vec2(gl_TexCoord[0].s-extraPos.x+248.0f/1024.0f, gl_TexCoord[0].t-extraPos.y+894.0f/1024.0f);
+ if(extraTexCoord.x > 200.0f/1024.0f && extraTexCoord.x < 300.0f/1024.0f) {
+ if(extraTexCoord.y > 843.0f/1024.0f && extraTexCoord.y < 943.0f/1024.0f) {
+ extra = texture2D(textureIn, extraTexCoord);
+ }
+ }
+ } else if(eventRand < 0.47f) {
+ vec2 extraPos = vec2(-30.0f+eventMillis/2000f*370.0f, 50.0f+(eventRand-0.45f)/0.02f*300.0f)/1024.0f;
+ vec2 extraTexCoord = vec2(gl_TexCoord[0].s-extraPos.x+348.0f/1024.0f, gl_TexCoord[0].t-extraPos.y+894.0f/1024.0f);
+ if(extraTexCoord.x > 300.0f/1024.0f && extraTexCoord.x < 400.0f/1024.0f) {
+ if(extraTexCoord.y > 843.0f/1024.0f && extraTexCoord.y < 943.0f/1024.0f) {
+ extra = texture2D(textureIn, extraTexCoord);
+ }
+ }
+ } else if(eventRand < 0.48f) {
+ vec2 extraPos = vec2(-30.0f+eventMillis/2000f*370.0f, 50.0f+(eventRand-0.47f)/0.01f*300.0f)/1024.0f;
+ vec2 extraTexCoord = vec2(gl_TexCoord[0].s-extraPos.x+448.0f/1024.0f, gl_TexCoord[0].t-extraPos.y+894.0f/1024.0f);
+ if(extraTexCoord.x > 400.0f/1024.0f && extraTexCoord.x < 500.0f/1024.0f) {
+ if(extraTexCoord.y > 843.0f/1024.0f && extraTexCoord.y < 943.0f/1024.0f) {
+ extra = texture2D(textureIn, extraTexCoord);
+ }
+ }
+ }
+
+ vec3 space = texture2D(textureIn, texCoord).rgb;
+
+ gl_FragColor = vec4(texture.rgb*texture.a + extra.rgb*extra.a*(1.0f-texture.a) + space*(1.0f-texture.a)*(1.0f-extra.a), 1.0f) * passColour;
+
+ vec3 fakeSunNormal = normalize(vec3(0.2f,1.0f,-0.2f));
+ vec3 normNormal = normalize(passNormal);
+ float shading = max(0.6f, dot(fakeSunNormal, normNormal));
+
+ gl_FragColor = vec4(gl_FragColor.rgb*shading, gl_FragColor.a);
+}
diff --git a/src/main/resources/assets/notenoughupdates/shaders/space_cape.vert b/src/main/resources/assets/notenoughupdates/shaders/space_cape.vert
new file mode 100644
index 00000000..2b5c48f8
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/shaders/space_cape.vert
@@ -0,0 +1,12 @@
+#version 120
+
+varying vec4 passColour;
+varying vec3 passNormal;
+
+void main() {
+ gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+ gl_TexCoord[0] = gl_MultiTexCoord0;
+
+ passColour = gl_Color;
+ passNormal = normalize(gl_Normal);
+} \ No newline at end of file