diff options
author | Moulberry <james.jenour@student.scotch.wa.edu.au> | 2020-10-18 21:01:11 +1100 |
---|---|---|
committer | Moulberry <james.jenour@student.scotch.wa.edu.au> | 2020-10-18 21:01:11 +1100 |
commit | a0402708801b525145d01d0f4da17f0ba9d93455 (patch) | |
tree | ce0b58df707388449558073df3aa9492efaf8978 /src/main/resources/assets/notenoughupdates/shaders | |
parent | 275fe45caa8eb1048914d864aafae21f3f3a1157 (diff) | |
download | NotEnoughUpdates-a0402708801b525145d01d0f4da17f0ba9d93455.tar.gz NotEnoughUpdates-a0402708801b525145d01d0f4da17f0ba9d93455.tar.bz2 NotEnoughUpdates-a0402708801b525145d01d0f4da17f0ba9d93455.zip |
1.4
Diffstat (limited to 'src/main/resources/assets/notenoughupdates/shaders')
-rw-r--r-- | src/main/resources/assets/notenoughupdates/shaders/lava_cape.frag | 32 | ||||
-rw-r--r-- | src/main/resources/assets/notenoughupdates/shaders/lava_cape.vert | 12 |
2 files changed, 44 insertions, 0 deletions
diff --git a/src/main/resources/assets/notenoughupdates/shaders/lava_cape.frag b/src/main/resources/assets/notenoughupdates/shaders/lava_cape.frag new file mode 100644 index 00000000..9fb35990 --- /dev/null +++ b/src/main/resources/assets/notenoughupdates/shaders/lava_cape.frag @@ -0,0 +1,32 @@ +#version 120 + +varying vec4 passColour; +varying vec3 passNormal; +uniform sampler2D textureIn; + +uniform int millis; + +void main() { + vec4 texture = texture2D(textureIn, gl_TexCoord[0].st); + + float t = gl_TexCoord[0].t; + t = clamp(t, 10.0f/1024.0f, 410.0f/1024.0f); + + float index = mod(millis/30.0f-t*1024.0f, 1024.0f); + float xIndex = mod(index, 1024.0f); + float yIndex = mod(gl_TexCoord[0].s*1024.0f+millis/500.0f, 421.0f)+421.0f; + vec3 lava = texture2D(textureIn, vec2(xIndex/1024.0f, yIndex/1024.0f)).xyz; + + float factor = (lava.r / 0.65f)*(lava.r / 0.65f); + lava.r += sin(mod(millis/2000.0f, 6.28f))*factor*0.15f+sin(mod(millis/500.0f, 6.28f))*factor*0.15f; + lava.g += sin(mod(millis/2000.0f, 6.28f))*factor*0.15f; + lava.b += sin(mod(millis/2000.0f, 6.28f))*factor*0.15f; + + gl_FragColor = vec4(texture.rgb*texture.a + lava*(1.0f-texture.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/lava_cape.vert b/src/main/resources/assets/notenoughupdates/shaders/lava_cape.vert new file mode 100644 index 00000000..2b5c48f8 --- /dev/null +++ b/src/main/resources/assets/notenoughupdates/shaders/lava_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 |