-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy paththing_ownership.shader
117 lines (94 loc) · 3.56 KB
/
thing_ownership.shader
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
shader_type canvas_item;
render_mode blend_mix;
uniform float alphaFilled = 1.0;
//uniform float alphaOutline = 1.0;
//uniform float outlineThickness = 2.00;
uniform float fadeAlpha = 1.0;
uniform vec4 ownerCol = vec4(1.0, 0.0, 0.0, 1.0);
void fragment() {
vec4 baseCol = texture(TEXTURE,UV);
vec4 modifiedCol = baseCol;
modifiedCol.rgb = mix(baseCol.rgb, ownerCol.rgb, ownerCol.a * alphaFilled * fadeAlpha);
COLOR = modifiedCol;
}
//void fragment() {
// vec4 baseCol = texture(TEXTURE,UV);
// vec4 modifiedCol = baseCol;
//// if (baseCol.a == 0.0){
////
//// }
// float textureWidth = float(textureSize(TEXTURE,0).x);
// float textureHeight = float(textureSize(TEXTURE,0).y);
// vec2 texel = vec2(1.0/textureWidth, 1.0/textureHeight);
// float superPixel = max(texel.x, texel.x*zoom)*outlineThickness;
//
// modifiedCol.rgb = mix(baseCol.rgb, ownerCol.rgb, ownerCol.a * alphaOutline);
// //modifiedCol.rgb = mix(baseCol.rgb, ownerCol.rgb, ownerCol.a * alphaFilled);
//
// bool isBorder = false;
// if (texture(TEXTURE, vec2(UV.x, UV.y+superPixel )).a == 0.0) {isBorder = true;}
// if (texture(TEXTURE, vec2(UV.x, UV.y-superPixel )).a == 0.0) {isBorder = true;}
// if (texture(TEXTURE, vec2(UV.x+superPixel, UV.y )).a == 0.0) {isBorder = true;}
// if (texture(TEXTURE, vec2(UV.x-superPixel, UV.y )).a == 0.0) {isBorder = true;}
// //if (isBorder != true) {
// // modifiedCol.a = 0.0;
// //}
//
//// if (ownerCol.rgb == vec3(0.0,0.0,0.0)) {
//// COLOR = baseCol;
//// } else {
//// COLOR = modifiedCol;
//// }
// COLOR = modifiedCol;
//}
// //vec4 baseCol = texture(TEXTURE,UV);
//
// vec4 modifiedCol = baseCol;
//
// float textureWidth = float(textureSize(TEXTURE,0).x);
// float textureHeight = float(textureSize(TEXTURE,0).y);
// vec2 texel = vec2(1.0/textureWidth, 1.0/textureHeight);
//
// float superPixel = max(texel.x, texel.x*zoom)*outlineThickness;
//
// // Place border around colour which has the mouse over it.
// //if (cursorOnColor.rgb == vec3(0.0,0.0,0.0)) {
////
////
//// }
// //} else {
// float fadeAlpha;
// if (baseCol == color0) {fadeAlpha = alphaFadeColor0;}
// if (baseCol == color1) {fadeAlpha = alphaFadeColor1;}
// if (baseCol == color2) {fadeAlpha = alphaFadeColor2;}
// if (baseCol == color3) {fadeAlpha = alphaFadeColor3;}
// if (baseCol == color4) {fadeAlpha = alphaFadeColor4;}
// if (baseCol == color5) {fadeAlpha = alphaFadeColor5;}
//
// modifiedCol.a = filledAlpha;
//
// modifiedCol.a *= 1.0-fadeAlpha;
//
// if (baseCol.a == 1.0) {
// bool isBorder = false;
// if (texture(territoryTexture, vec2(UV.x, UV.y+superPixel )) != baseCol) {isBorder = true;}
// if (texture(territoryTexture, vec2(UV.x, UV.y-superPixel )) != baseCol) {isBorder = true;}
// if (texture(territoryTexture, vec2(UV.x+superPixel, UV.y )) != baseCol) {isBorder = true;}
// if (texture(territoryTexture, vec2(UV.x-superPixel, UV.y )) != baseCol) {isBorder = true;}
//
// if (texture(territoryTexture, vec2(UV.x+superPixel, UV.y+superPixel )) != baseCol) {isBorder = true;}
// if (texture(territoryTexture, vec2(UV.x+superPixel, UV.y-superPixel )) != baseCol) {isBorder = true;}
// if (texture(territoryTexture, vec2(UV.x-superPixel, UV.y+superPixel )) != baseCol) {isBorder = true;}
// if (texture(territoryTexture, vec2(UV.x-superPixel, UV.y-superPixel )) != baseCol) {isBorder = true;}
//
// if (isBorder == true) {
// modifiedCol.a = outlineAlpha;
// //if (cursorOnColor == baseCol) {
// modifiedCol.a *= fadeAlpha;
// //}
// modifiedCol.a = max(modifiedCol.a, filledAlpha);
// }
// }
//
// //}
// // Always make transparent if ownership is none (represented by black)