v1.5.1
This commit is contained in:
1 parent
9536081bab
commit
1403446416
9 files changed
+280
-2
No files matched your search
@@ -0,0 +1,28 @@
|
||||
#version 150
|
||||
|
||||
in vec2 texCoord0;
|
||||
|
||||
uniform sampler2D Sampler0;
|
||||
uniform vec2 TexelSize;
|
||||
uniform vec4 OutlineColor;
|
||||
uniform float Radius;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
float center = texture(Sampler0, texCoord0).a;
|
||||
float around = 0.0;
|
||||
vec2 px = TexelSize * Radius;
|
||||
|
||||
around = max(around, texture(Sampler0, texCoord0 + vec2(px.x, 0.0)).a);
|
||||
around = max(around, texture(Sampler0, texCoord0 - vec2(px.x, 0.0)).a);
|
||||
around = max(around, texture(Sampler0, texCoord0 + vec2(0.0, px.y)).a);
|
||||
around = max(around, texture(Sampler0, texCoord0 - vec2(0.0, px.y)).a);
|
||||
around = max(around, texture(Sampler0, texCoord0 + vec2(px.x, px.y)).a);
|
||||
around = max(around, texture(Sampler0, texCoord0 + vec2(px.x, -px.y)).a);
|
||||
around = max(around, texture(Sampler0, texCoord0 + vec2(-px.x, px.y)).a);
|
||||
around = max(around, texture(Sampler0, texCoord0 - vec2(px.x, px.y)).a);
|
||||
|
||||
float outline = max(around - center, 0.0);
|
||||
fragColor = vec4(OutlineColor.rgb, outline * OutlineColor.a);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"vertex": "lzxnoneterraria:outline",
|
||||
"fragment": "lzxnoneterraria:outline",
|
||||
"samplers": [
|
||||
{ "name": "Sampler0" }
|
||||
],
|
||||
"attributes": [
|
||||
"Position",
|
||||
"UV0"
|
||||
],
|
||||
"uniforms": [
|
||||
{ "name": "TexelSize", "type": "float", "count": 2, "values": [ 0.001, 0.001 ] },
|
||||
{ "name": "OutlineColor", "type": "float", "count": 4, "values": [ 0.8, 0.176, 0.78, 1.0 ] },
|
||||
{ "name": "Radius", "type": "float", "count": 1, "values": [ 2.0 ] }
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
#version 150
|
||||
|
||||
in vec3 Position;
|
||||
in vec2 UV0;
|
||||
|
||||
out vec2 texCoord0;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(Position, 1.0);
|
||||
texCoord0 = UV0;
|
||||
}
|
||||
Reference in new issue
Block a user