Skip to content

Commit b60a6dc

Browse files
committedMar 10, 2016
This actually works...
1 parent 5c45bbe commit b60a6dc

7 files changed

+142
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"targets": [
3+
"swap"
4+
],
5+
"passes": [
6+
{
7+
"name": "computronics_invert",
8+
"intarget": "minecraft:main",
9+
"outtarget": "swap"
10+
},
11+
{
12+
"name": "blit",
13+
"intarget": "swap",
14+
"outtarget": "minecraft:main"
15+
}
16+
]
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"targets": [
3+
"swap"
4+
],
5+
"passes": [
6+
{
7+
"name": "computronics_invert_x",
8+
"intarget": "minecraft:main",
9+
"outtarget": "swap"
10+
},
11+
{
12+
"name": "blit",
13+
"intarget": "swap",
14+
"outtarget": "minecraft:main"
15+
}
16+
]
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"targets": [
3+
"swap"
4+
],
5+
"passes": [
6+
{
7+
"name": "computronics_invert_y",
8+
"intarget": "minecraft:main",
9+
"outtarget": "swap"
10+
},
11+
{
12+
"name": "blit",
13+
"intarget": "swap",
14+
"outtarget": "minecraft:main"
15+
}
16+
]
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"blend": {
3+
"func": "add",
4+
"srcrgb": "one",
5+
"dstrgb": "zero"
6+
},
7+
"vertex": "computronics_invert",
8+
"fragment": "blit",
9+
"attributes": [ "Position" ],
10+
"samplers": [
11+
{ "name": "DiffuseSampler" }
12+
],
13+
"uniforms": [
14+
{ "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 ] },
15+
{ "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
16+
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
17+
{ "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
18+
{ "name": "Flip", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }
19+
]
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#version 120
2+
3+
attribute vec4 Position;
4+
5+
uniform mat4 ProjMat;
6+
uniform vec2 InSize;
7+
uniform vec2 OutSize;
8+
uniform vec2 ScreenSize;
9+
uniform vec2 Flip;
10+
11+
varying vec2 texCoord;
12+
13+
void main(){
14+
vec4 outPos = ProjMat * vec4(Position.xy, 0.0, 1.0);
15+
if(Flip.x > 0) {
16+
outPos.x *= -1.0 * Flip.x;
17+
outPos.y *= -1.0 * Flip.x;
18+
}
19+
gl_Position = vec4(outPos.xy, 0.2, 1.0);
20+
vec2 inOutRatio = OutSize / InSize;
21+
vec2 inScreenRatio = ScreenSize / InSize;
22+
texCoord = Position.xy / OutSize;
23+
if(Flip.y > 0 && Flip.x > 0) {
24+
texCoord.y = 1.0 - texCoord.y;
25+
}
26+
texCoord.x = texCoord.x * inOutRatio.x;
27+
texCoord.y = texCoord.y * inOutRatio.y;
28+
if(Flip.y > 0 && Flip.x <= 0){
29+
texCoord.y -= 1.0 - inScreenRatio.y;
30+
}
31+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"blend": {
3+
"func": "add",
4+
"srcrgb": "one",
5+
"dstrgb": "zero"
6+
},
7+
"vertex": "computronics_invert",
8+
"fragment": "blit",
9+
"attributes": [ "Position" ],
10+
"samplers": [
11+
{ "name": "DiffuseSampler" }
12+
],
13+
"uniforms": [
14+
{ "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 ] },
15+
{ "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
16+
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
17+
{ "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
18+
{ "name": "Flip", "type": "float", "count": 2, "values": [ 1.0,-1.0 ] }
19+
]
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"blend": {
3+
"func": "add",
4+
"srcrgb": "one",
5+
"dstrgb": "zero"
6+
},
7+
"vertex": "computronics_invert",
8+
"fragment": "blit",
9+
"attributes": [ "Position" ],
10+
"samplers": [
11+
{ "name": "DiffuseSampler" }
12+
],
13+
"uniforms": [
14+
{ "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 ] },
15+
{ "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
16+
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
17+
{ "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
18+
{ "name": "Flip", "type": "float", "count": 2, "values": [-1.0, 1.0 ] }
19+
]
20+
}

0 commit comments

Comments
 (0)
Please sign in to comment.