aboutsummaryrefslogtreecommitdiff
path: root/src/main/resources/assets/notenoughupdates/shaders
diff options
context:
space:
mode:
authorMoulberry <james.jenour@student.scotch.wa.edu.au>2020-10-31 21:49:14 +1100
committerMoulberry <james.jenour@student.scotch.wa.edu.au>2020-10-31 21:49:14 +1100
commit431d4a5eca207aa6f86a90e3c4e1912885f115eb (patch)
tree8d3bd19ad3d40da034aaca8e2766dadb627bfaf1 /src/main/resources/assets/notenoughupdates/shaders
parent2397734d98c30a05db58bc6ef67607078889a386 (diff)
downloadNotEnoughUpdates-431d4a5eca207aa6f86a90e3c4e1912885f115eb.tar.gz
NotEnoughUpdates-431d4a5eca207aa6f86a90e3c4e1912885f115eb.tar.bz2
NotEnoughUpdates-431d4a5eca207aa6f86a90e3c4e1912885f115eb.zip
1.4.9
Diffstat (limited to 'src/main/resources/assets/notenoughupdates/shaders')
-rw-r--r--src/main/resources/assets/notenoughupdates/shaders/program/dungeonmap.fsh32
-rw-r--r--src/main/resources/assets/notenoughupdates/shaders/program/dungeonmap.json19
-rw-r--r--src/main/resources/assets/notenoughupdates/shaders/program/dungeonmap.vsh16
3 files changed, 67 insertions, 0 deletions
diff --git a/src/main/resources/assets/notenoughupdates/shaders/program/dungeonmap.fsh b/src/main/resources/assets/notenoughupdates/shaders/program/dungeonmap.fsh
new file mode 100644
index 00000000..c7bcfb0f
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/shaders/program/dungeonmap.fsh
@@ -0,0 +1,32 @@
+#version 120
+
+uniform sampler2D DiffuseSampler;
+
+uniform float radiusSq = 0.5f;
+
+uniform vec2 InSize;
+uniform vec2 OutSize;
+
+varying vec2 texCoord;
+
+void main() {
+ if(radiusSq < 0.5 && (texCoord.s-0.5)*(texCoord.s-0.5)+(texCoord.t-0.5)*(texCoord.t-0.5) > radiusSq) {
+ discard;
+ }
+
+ /*float totalAlpha = 0.0f;
+ vec3 accum = vec3(0.0);
+
+ for(int x = -1; x<3; x++) {
+ for(int y = -1; y<3; y++) {
+ vec4 pixel = texture2D(DiffuseSampler, texCoord+vec2(x, y)/InSize);
+
+ accum += pixel.rgb * pixel.a;
+ totalAlpha += pixel.a;
+ }
+ }
+ gl_FragColor.a = totalAlpha/4*4;
+ gl_FragColor.rgb = accum/4*4;*/
+
+ gl_FragColor = texture2D(DiffuseSampler, texCoord);
+} \ No newline at end of file
diff --git a/src/main/resources/assets/notenoughupdates/shaders/program/dungeonmap.json b/src/main/resources/assets/notenoughupdates/shaders/program/dungeonmap.json
new file mode 100644
index 00000000..bb41ffd5
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/shaders/program/dungeonmap.json
@@ -0,0 +1,19 @@
+{
+ "blend": {
+ "func": "add",
+ "srcrgb": "srcalpha",
+ "dstrgb": "1-srcalpha"
+ },
+ "vertex": "dungeonmap",
+ "fragment": "dungeonmap",
+ "attributes": [ "Position" ],
+ "samplers": [
+ { "name": "DiffuseSampler" }
+ ],
+ "uniforms": [
+ { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
+ { "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
+ { "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
+ { "name": "radiusSq", "type": "float", "count": 1, "values": [ 1.0 ] }
+ ]
+}
diff --git a/src/main/resources/assets/notenoughupdates/shaders/program/dungeonmap.vsh b/src/main/resources/assets/notenoughupdates/shaders/program/dungeonmap.vsh
new file mode 100644
index 00000000..01a16db5
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/shaders/program/dungeonmap.vsh
@@ -0,0 +1,16 @@
+#version 120
+
+attribute vec4 Position;
+
+uniform mat4 ProjMat;
+uniform vec2 OutSize;
+
+varying vec2 texCoord;
+
+void main(){
+ vec4 outPos = ProjMat * vec4(Position.xy, 0.0, 1.0);
+ gl_Position = vec4(outPos.xy, 0.2, 1.0);
+
+ texCoord = Position.xy / OutSize;
+ texCoord.y = 1.0 - texCoord.y;
+}