stuff
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
|
||||
#if KERNEL == 0
|
||||
varying vec2 v_TexCoord[13];
|
||||
#endif
|
||||
#if KERNEL == 1
|
||||
varying vec2 v_TexCoord[7];
|
||||
#endif
|
||||
#if KERNEL == 2
|
||||
varying vec2 v_TexCoord[3];
|
||||
#endif
|
||||
|
||||
uniform sampler2D g_Texture0; // {"material":"ui_editor_properties_framebuffer","hidden":true}
|
||||
|
||||
void main() {
|
||||
#if KERNEL == 0
|
||||
vec4 albedo = texSample2D(g_Texture0, v_TexCoord[0]) * 0.006299 +
|
||||
texSample2D(g_Texture0, v_TexCoord[1]) * 0.017298 +
|
||||
texSample2D(g_Texture0, v_TexCoord[2]) * 0.039533 +
|
||||
texSample2D(g_Texture0, v_TexCoord[3]) * 0.075189 +
|
||||
texSample2D(g_Texture0, v_TexCoord[4]) * 0.119007 +
|
||||
texSample2D(g_Texture0, v_TexCoord[5]) * 0.156756 +
|
||||
texSample2D(g_Texture0, v_TexCoord[6]) * 0.171834 +
|
||||
texSample2D(g_Texture0, v_TexCoord[7]) * 0.156756 +
|
||||
texSample2D(g_Texture0, v_TexCoord[8]) * 0.119007 +
|
||||
texSample2D(g_Texture0, v_TexCoord[9]) * 0.075189 +
|
||||
texSample2D(g_Texture0, v_TexCoord[10]) * 0.039533 +
|
||||
texSample2D(g_Texture0, v_TexCoord[11]) * 0.017298 +
|
||||
texSample2D(g_Texture0, v_TexCoord[12]) * 0.006299;
|
||||
#endif
|
||||
#if KERNEL == 1
|
||||
vec4 albedo = texSample2D(g_Texture0, v_TexCoord[0]) * 0.071303 +
|
||||
texSample2D(g_Texture0, v_TexCoord[1]) * 0.131514 +
|
||||
texSample2D(g_Texture0, v_TexCoord[2]) * 0.189879 +
|
||||
texSample2D(g_Texture0, v_TexCoord[3]) * 0.214607 +
|
||||
texSample2D(g_Texture0, v_TexCoord[4]) * 0.189879 +
|
||||
texSample2D(g_Texture0, v_TexCoord[5]) * 0.131514 +
|
||||
texSample2D(g_Texture0, v_TexCoord[6]) * 0.071303;
|
||||
#endif
|
||||
#if KERNEL == 2
|
||||
vec4 albedo = texSample2D(g_Texture0, v_TexCoord[0]) * 0.27901 +
|
||||
texSample2D(g_Texture0, v_TexCoord[1]) * 0.44198 +
|
||||
texSample2D(g_Texture0, v_TexCoord[2]) * 0.27901;
|
||||
#endif
|
||||
|
||||
gl_FragColor = albedo;
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
|
||||
// [COMBO] {"material":"ui_editor_properties_kernel_size","combo":"KERNEL","type":"options","default":2,"options":{"13x13":0,"7x7":1,"3x3":2}}
|
||||
|
||||
uniform mat4 g_ModelViewProjectionMatrix;
|
||||
uniform vec2 g_Scale; // {"material":"ui_editor_properties_scale","default":"1 1","linked":true,"range":[0.01, 2.0]}
|
||||
|
||||
attribute vec3 a_Position;
|
||||
attribute vec2 a_TexCoord;
|
||||
|
||||
#if KERNEL == 0
|
||||
varying vec2 v_TexCoord[13];
|
||||
#endif
|
||||
#if KERNEL == 1
|
||||
varying vec2 v_TexCoord[7];
|
||||
#endif
|
||||
#if KERNEL == 2
|
||||
varying vec2 v_TexCoord[3];
|
||||
#endif
|
||||
|
||||
uniform vec4 g_Texture0Resolution;
|
||||
|
||||
void main() {
|
||||
#if VERTICAL
|
||||
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
|
||||
#else
|
||||
gl_Position = vec4(a_Position, 1.0);
|
||||
#endif
|
||||
|
||||
#if VERTICAL
|
||||
float offsetX = 0.0f;
|
||||
float offsetY = g_Scale.y / g_Texture0Resolution.w;
|
||||
#else
|
||||
float offsetX = g_Scale.x / g_Texture0Resolution.z;
|
||||
float offsetY = 0.0f;
|
||||
#endif
|
||||
|
||||
#if KERNEL == 0
|
||||
v_TexCoord[0] = vec2(a_TexCoord.x - offsetX * 6.0, a_TexCoord.y - offsetY * 6.0);
|
||||
v_TexCoord[1] = vec2(a_TexCoord.x - offsetX * 5.0, a_TexCoord.y - offsetY * 5.0);
|
||||
v_TexCoord[2] = vec2(a_TexCoord.x - offsetX * 4.0, a_TexCoord.y - offsetY * 4.0);
|
||||
v_TexCoord[3] = vec2(a_TexCoord.x - offsetX * 3.0, a_TexCoord.y - offsetY * 3.0);
|
||||
v_TexCoord[4] = vec2(a_TexCoord.x - offsetX * 2.0, a_TexCoord.y - offsetY * 2.0);
|
||||
v_TexCoord[5] = vec2(a_TexCoord.x - offsetX, a_TexCoord.y - offsetY);
|
||||
v_TexCoord[6] = vec2(a_TexCoord.x, a_TexCoord.y);
|
||||
v_TexCoord[7] = vec2(a_TexCoord.x + offsetX, a_TexCoord.y + offsetY);
|
||||
v_TexCoord[8] = vec2(a_TexCoord.x + offsetX * 2.0, a_TexCoord.y + offsetY * 2.0);
|
||||
v_TexCoord[9] = vec2(a_TexCoord.x + offsetX * 3.0, a_TexCoord.y + offsetY * 3.0);
|
||||
v_TexCoord[10] = vec2(a_TexCoord.x + offsetX * 4.0, a_TexCoord.y + offsetY * 4.0);
|
||||
v_TexCoord[11] = vec2(a_TexCoord.x + offsetX * 5.0, a_TexCoord.y + offsetY * 5.0);
|
||||
v_TexCoord[12] = vec2(a_TexCoord.x + offsetX * 6.0, a_TexCoord.y + offsetY * 6.0);
|
||||
#endif
|
||||
#if KERNEL == 1
|
||||
v_TexCoord[0] = vec2(a_TexCoord.x - offsetX * 3.0, a_TexCoord.y - offsetY * 3.0);
|
||||
v_TexCoord[1] = vec2(a_TexCoord.x - offsetX * 2.0, a_TexCoord.y - offsetY * 2.0);
|
||||
v_TexCoord[2] = vec2(a_TexCoord.x - offsetX, a_TexCoord.y - offsetY);
|
||||
v_TexCoord[3] = vec2(a_TexCoord.x, a_TexCoord.y);
|
||||
v_TexCoord[4] = vec2(a_TexCoord.x + offsetX, a_TexCoord.y + offsetY);
|
||||
v_TexCoord[5] = vec2(a_TexCoord.x + offsetX * 2.0, a_TexCoord.y + offsetY * 2.0);
|
||||
v_TexCoord[6] = vec2(a_TexCoord.x + offsetX * 3.0, a_TexCoord.y + offsetY * 3.0);
|
||||
#endif
|
||||
#if KERNEL == 2
|
||||
v_TexCoord[0] = vec2(a_TexCoord.x - offsetX, a_TexCoord.y - offsetY);
|
||||
v_TexCoord[1] = vec2(a_TexCoord.x, a_TexCoord.y);
|
||||
v_TexCoord[2] = vec2(a_TexCoord.x + offsetX, a_TexCoord.y + offsetY);
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
|
||||
// [COMBO] {"material":"ui_editor_properties_shading","combo":"SHADING","type":"options","default":0}
|
||||
// [COMBO] {"material":"ui_editor_properties_blend_mode","combo":"BLENDMODE","type":"imageblending","default":0}
|
||||
|
||||
#include "common.h"
|
||||
#include "common_blending.h"
|
||||
|
||||
varying vec4 v_TexCoord;
|
||||
varying vec4 v_TexCoordClouds;
|
||||
|
||||
uniform sampler2D g_Texture0; // {"material":"ui_editor_properties_framebuffer","hidden":true}
|
||||
uniform sampler2D g_Texture1; // {"material":"ui_editor_properties_albedo","default":"util/clouds_256"}
|
||||
uniform sampler2D g_Texture2; // {"material":"ui_editor_properties_opacity_mask","mode":"opacitymask","default":"util/white","combo":"MASK"}
|
||||
|
||||
uniform float g_CloudsAlpha; // {"material":"ui_editor_properties_alpha","default":1.0,"range":[0.01, 1]}
|
||||
uniform float g_CloudThreshold; // {"material":"ui_editor_properties_threshold","default":0.2,"range:":[0,1]}
|
||||
uniform float g_CloudFeather; // {"material":"ui_editor_properties_feather","default":0.1,"range":[0,1]}
|
||||
uniform float g_CloudShading; // {"material":"ui_editor_properties_shading","default":0.5,"range":[0,1]}
|
||||
uniform float g_ShadingDirection; // {"material":"ui_editor_properties_shading_direction","default":0,"range":[0,6.28]}
|
||||
uniform vec3 g_Color1; // {"material":"ui_editor_properties_color_start","default":"1 1 1","type":"color"}
|
||||
uniform vec3 g_Color2; // {"material":"ui_editor_properties_color_end","default":"0 0 0","type":"color"}
|
||||
|
||||
void main() {
|
||||
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
|
||||
float cloud0 = texSample2D(g_Texture1, v_TexCoordClouds.xy).r;
|
||||
float cloud1 = texSample2D(g_Texture1, v_TexCoordClouds.zw).r;
|
||||
|
||||
float cloudBlend = cloud0 * cloud1;
|
||||
vec3 cloudColor = CAST3(1.0);
|
||||
|
||||
#if SHADING == 1
|
||||
float light = 0.0;
|
||||
vec2 cloudDeltas = vec2(ddx(cloudBlend), ddy(cloudBlend));
|
||||
float shadingLength = length(cloudDeltas);
|
||||
if (shadingLength > 0.001)
|
||||
{
|
||||
cloudDeltas /= shadingLength;
|
||||
vec2 direction = rotateVec2(vec2(0, -1.0), g_ShadingDirection);
|
||||
light = dot(direction, cloudDeltas) * 0.5 + 0.5;
|
||||
}
|
||||
light = mix(0.5, light, g_CloudShading);
|
||||
cloudColor = mix(g_Color2, g_Color1, light);
|
||||
#endif
|
||||
|
||||
cloudBlend = smoothstep(g_CloudThreshold, g_CloudThreshold + g_CloudFeather, cloudBlend);
|
||||
|
||||
float blend = cloudBlend * g_CloudsAlpha;
|
||||
#if MASK == 1
|
||||
blend *= texSample2D(g_Texture2, v_TexCoord.zw).r;
|
||||
#endif
|
||||
albedo.a = blend;
|
||||
|
||||
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, cloudColor, blend);
|
||||
|
||||
#if BLENDMODE == 0
|
||||
albedo.a = 1.0;
|
||||
#endif
|
||||
|
||||
gl_FragColor = albedo;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
|
||||
uniform mat4 g_ModelViewProjectionMatrix;
|
||||
uniform vec4 g_Texture0Resolution;
|
||||
|
||||
#if MASK == 1
|
||||
uniform vec4 g_Texture2Resolution;
|
||||
#endif
|
||||
|
||||
uniform float g_Time;
|
||||
uniform vec2 g_CloudSpeeds; // {"material":"ui_editor_properties_speed","default":"0.01 -0.02"}
|
||||
uniform vec2 g_CloudScales; // {"material":"ui_editor_properties_scale","default":"1.3 0.5"}
|
||||
|
||||
attribute vec3 a_Position;
|
||||
attribute vec2 a_TexCoord;
|
||||
|
||||
varying vec4 v_TexCoord;
|
||||
varying vec4 v_TexCoordClouds;
|
||||
|
||||
void main() {
|
||||
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
|
||||
v_TexCoord = a_TexCoord.xyxy;
|
||||
|
||||
float aspect = g_Texture0Resolution.z / g_Texture0Resolution.w;
|
||||
v_TexCoordClouds.xy = (a_TexCoord + g_Time * g_CloudSpeeds.x) * g_CloudScales.x;
|
||||
v_TexCoordClouds.zw = (a_TexCoord + g_Time * g_CloudSpeeds.y) * g_CloudScales.y;
|
||||
|
||||
v_TexCoordClouds.zw = vec2(-v_TexCoordClouds.w, v_TexCoordClouds.z);
|
||||
|
||||
#if MASK == 1
|
||||
v_TexCoord.zw = vec2(v_TexCoord.x * g_Texture2Resolution.z / g_Texture2Resolution.x,
|
||||
v_TexCoord.y * g_Texture2Resolution.w / g_Texture2Resolution.y);
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
varying vec4 v_TexCoord;
|
||||
|
||||
uniform sampler2D g_Texture0; // {"material":"ui_editor_properties_framebuffer","hidden":true}
|
||||
uniform sampler2D g_Texture1; // {"material":"Previous framebuffer","hidden":true}
|
||||
uniform sampler2D g_Texture2; // {"material":"ui_editor_properties_opacity_mask","mode":"opacitymask","default":"util/white","combo":"MASK"}
|
||||
|
||||
uniform float g_Amount; // {"material":"Accumulation rate","default":0.8,"range":[0.01, 1]}
|
||||
|
||||
void main() {
|
||||
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
|
||||
vec4 pastAlbedo = texSample2D(g_Texture1, v_TexCoord.xy);
|
||||
|
||||
float rate = g_Amount;
|
||||
#if MASK == 1
|
||||
float mask = texSample2D(g_Texture2, v_TexCoord.zw).r;
|
||||
rate = g_Amount + (1.0 - g_Amount) * (1.0 - mask);
|
||||
#endif
|
||||
|
||||
gl_FragColor = mix(pastAlbedo, albedo, rate);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
|
||||
#if MASK == 1
|
||||
uniform vec4 g_Texture2Resolution;
|
||||
#endif
|
||||
|
||||
attribute vec3 a_Position;
|
||||
attribute vec2 a_TexCoord;
|
||||
|
||||
varying vec4 v_TexCoord;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(a_Position, 1.0);
|
||||
v_TexCoord.xyzw = a_TexCoord.xyxy;
|
||||
|
||||
#if MASK == 1
|
||||
v_TexCoord.zw = vec2(v_TexCoord.x * g_Texture2Resolution.z / g_Texture2Resolution.x,
|
||||
v_TexCoord.y * g_Texture2Resolution.w / g_Texture2Resolution.y);
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
varying vec2 v_TexCoord;
|
||||
|
||||
uniform sampler2D g_Texture0; // {"material":"ui_editor_properties_framebuffer","hidden":true}
|
||||
|
||||
void main() {
|
||||
vec4 albedo = texSample2D(g_Texture0, v_TexCoord);
|
||||
gl_FragColor = albedo;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
uniform mat4 g_ModelViewProjectionMatrix;
|
||||
|
||||
attribute vec3 a_Position;
|
||||
attribute vec2 a_TexCoord;
|
||||
|
||||
varying vec2 v_TexCoord;
|
||||
|
||||
void main() {
|
||||
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
|
||||
v_TexCoord = a_TexCoord;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
// [COMBO] {"material":"ui_editor_properties_repeat","combo":"REPEAT","type":"options","default":1}
|
||||
|
||||
varying vec3 v_TexCoord;
|
||||
|
||||
uniform sampler2D g_Texture0; // {"material":"ui_editor_properties_framebuffer","hidden":true}
|
||||
|
||||
void main() {
|
||||
vec2 texCoord = v_TexCoord.xy / v_TexCoord.z;
|
||||
|
||||
#if REPEAT
|
||||
texCoord = frac(texCoord);
|
||||
#endif
|
||||
gl_FragColor = texSample2D(g_Texture0, texCoord);
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
|
||||
// [COMBO] {"material":"ui_editor_properties_mode","combo":"MODE","type":"options","default":0,"options":{"Vertex":1,"UV":0}}
|
||||
|
||||
#include "common.h"
|
||||
|
||||
uniform mat4 g_ModelViewProjectionMatrix;
|
||||
uniform vec4 g_Texture0Resolution;
|
||||
|
||||
uniform float g_Top; // {"material":"ui_editor_properties_top","default":0,"range":[-0.49,0.49]}
|
||||
uniform float g_Bottom; // {"material":"ui_editor_properties_bottom","default":0,"range":[-0.49,0.49]}
|
||||
uniform float g_Left; // {"material":"ui_editor_properties_left","default":0,"range":[-0.49,0.49]}
|
||||
uniform float g_Right; // {"material":"ui_editor_properties_right","default":0,"range":[-0.49,0.49]}
|
||||
|
||||
attribute vec3 a_Position;
|
||||
attribute vec2 a_TexCoord;
|
||||
|
||||
varying vec3 v_TexCoord;
|
||||
|
||||
|
||||
void main() {
|
||||
|
||||
vec3 position = a_Position;
|
||||
v_TexCoord.xy = a_TexCoord;
|
||||
v_TexCoord.z = 1.0;
|
||||
|
||||
#if MODE == 1
|
||||
position.x += mix(g_Texture0Resolution.z * g_Top * mix(-1.0, 1.0, step(a_TexCoord.x, 0.5)),
|
||||
g_Texture0Resolution.z * g_Bottom * mix(-1.0, 1.0, step(a_TexCoord.x, 0.5)),
|
||||
step(0.5, a_TexCoord.y));
|
||||
|
||||
position.y += mix(g_Texture0Resolution.w * -g_Left * mix(-1.0, 1.0, step(a_TexCoord.y, 0.5)),
|
||||
g_Texture0Resolution.w * -g_Right * mix(-1.0, 1.0, step(a_TexCoord.y, 0.5)),
|
||||
step(0.5, a_TexCoord.x));
|
||||
|
||||
#endif
|
||||
|
||||
vec2 p3 = vec2(g_Top, g_Left);
|
||||
vec2 p2 = vec2(1 - g_Top, g_Right);
|
||||
vec2 p1 = vec2(1 - g_Bottom, 1 - g_Right);
|
||||
vec2 p0 = vec2(g_Bottom, 1 - g_Left);
|
||||
|
||||
float ax = p2.x - p0.x;
|
||||
float ay = p2.y - p0.y;
|
||||
float bx = p3.x - p1.x;
|
||||
float by = p3.y - p1.y;
|
||||
|
||||
float cross = ax * by - ay * bx;
|
||||
|
||||
float cy = p0.y - p1.y;
|
||||
float cx = p0.x - p1.x;
|
||||
|
||||
float s = (ax * cy - ay * cx) / cross;
|
||||
|
||||
float t = (bx * cy - by * cx) / cross;
|
||||
|
||||
float q0 = 1 / (1 - t);
|
||||
float q1 = 1 / (1 - s);
|
||||
float q2 = 1 / t;
|
||||
float q3 = 1 / s;
|
||||
|
||||
float q = mix(
|
||||
mix(q3, q2, a_TexCoord.x),
|
||||
mix(q0, q1, a_TexCoord.x),
|
||||
a_TexCoord.y
|
||||
);
|
||||
|
||||
v_TexCoord.xy = a_TexCoord;
|
||||
|
||||
#if MODE == 0
|
||||
v_TexCoord -= 0.5;
|
||||
v_TexCoord.x *= 0.5 / (0.5 - mix(g_Top, g_Bottom, step(0.5, a_TexCoord.y)));
|
||||
v_TexCoord.y *= 0.5 / (0.5 - mix(g_Left, g_Right, step(0.5, a_TexCoord.x)));
|
||||
v_TexCoord += 0.5;
|
||||
#endif
|
||||
|
||||
v_TexCoord.xy *= q;
|
||||
v_TexCoord.z = q;
|
||||
|
||||
|
||||
gl_Position = mul(vec4(position, 1.0), g_ModelViewProjectionMatrix);
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
|
||||
// [COMBO] {"material":"ui_editor_properties_blend_mode","combo":"BLENDMODE","type":"imageblending","default":2}
|
||||
|
||||
#include "common_blending.h"
|
||||
|
||||
varying vec4 v_TexCoord;
|
||||
|
||||
uniform sampler2D g_Texture0; // {"material":"ui_editor_properties_framebuffer","hidden":true}
|
||||
uniform sampler2D g_Texture1; // {"material":"ui_editor_properties_opacity_mask","mode":"opacitymask","default":"util/white","combo":"MASK"}
|
||||
|
||||
uniform float g_BlendAlpha; // {"material":"ui_editor_properties_alpha","default":1,"range":[0,1]}
|
||||
uniform vec3 g_TintColor; // {"material":"ui_editor_properties_color", "type": "color", "default":"1 1 1"}
|
||||
|
||||
void main() {
|
||||
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
|
||||
float mask = g_BlendAlpha;
|
||||
|
||||
#if MASK
|
||||
mask = texSample2D(g_Texture1, v_TexCoord.zw);
|
||||
#endif
|
||||
|
||||
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, g_TintColor, mask);
|
||||
|
||||
#if BLENDMODE == 0
|
||||
albedo.a = 1.0;
|
||||
#endif
|
||||
|
||||
gl_FragColor = albedo;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
uniform mat4 g_ModelViewProjectionMatrix;
|
||||
|
||||
#if MASK
|
||||
uniform vec4 g_Texture1Resolution;
|
||||
#endif
|
||||
|
||||
attribute vec3 a_Position;
|
||||
attribute vec2 a_TexCoord;
|
||||
|
||||
varying vec4 v_TexCoord;
|
||||
|
||||
void main() {
|
||||
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
|
||||
v_TexCoord = a_TexCoord.xyxy;
|
||||
|
||||
#if MASK
|
||||
v_TexCoord.zw = vec2(v_TexCoord.x * g_Texture1Resolution.z / g_Texture1Resolution.x,
|
||||
v_TexCoord.y * g_Texture1Resolution.w / g_Texture1Resolution.y);
|
||||
#endif
|
||||
}
|
||||
Reference in New Issue
Block a user