stuff
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
|
||||
// [COMBO] {"material":"Blend mode","combo":"BLENDMODE","type":"imageblending","default":2}
|
||||
|
||||
#include "common_blending.h"
|
||||
|
||||
varying vec4 v_TexCoord;
|
||||
|
||||
uniform float g_Multiply; // {"material":"Multiply","default":1,"range":[0.0, 10.0]}
|
||||
|
||||
#if OPACITYMASK == 1
|
||||
varying vec2 v_TexCoordOpacity;
|
||||
#endif
|
||||
|
||||
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
|
||||
uniform sampler2D g_Texture1; // {"material":"Blend texture","mode":"rgbmask","default":"util/white"}
|
||||
uniform sampler2D g_Texture2; // {"material":"Opacity mask","mode":"opacitymask","default":"util/white","combo":"OPACITYMASK"}
|
||||
|
||||
void main() {
|
||||
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
|
||||
vec4 mask = texSample2D(g_Texture1, v_TexCoord.zw);
|
||||
float blend = mask.a * g_Multiply;
|
||||
|
||||
#if OPACITYMASK == 1
|
||||
blend *= texSample2D(g_Texture2, v_TexCoordOpacity).r;
|
||||
#endif
|
||||
|
||||
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, mask.rgb, blend);
|
||||
|
||||
|
||||
gl_FragColor = albedo;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
|
||||
uniform mat4 g_ModelViewProjectionMatrix;
|
||||
uniform vec4 g_Texture1Resolution;
|
||||
|
||||
#if OPACITYMASK == 1
|
||||
uniform vec4 g_Texture2Resolution;
|
||||
|
||||
varying vec2 v_TexCoordOpacity;
|
||||
#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.xy = a_TexCoord;
|
||||
v_TexCoord.zw = vec2(v_TexCoord.x * g_Texture1Resolution.z / g_Texture1Resolution.x,
|
||||
v_TexCoord.y * g_Texture1Resolution.w / g_Texture1Resolution.y);
|
||||
|
||||
#if OPACITYMASK == 1
|
||||
v_TexCoordOpacity = vec2(v_TexCoord.x * g_Texture2Resolution.z / g_Texture2Resolution.x,
|
||||
v_TexCoord.y * g_Texture2Resolution.w / g_Texture2Resolution.y);
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
// [COMBO] {"material":"Invert","combo":"INVERT","type":"options","default":0}
|
||||
// [COMBO] {"material":"Flatten","combo":"FLATTEN","type":"options","default":0}
|
||||
|
||||
varying vec2 v_TexCoord;
|
||||
|
||||
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
|
||||
|
||||
uniform float g_KeyAlpha; // {"material":"Write alpha","default":0,"range":[0,1]}
|
||||
uniform float g_KeyFuzz; // {"material":"Fuzziness","default":0,"range":[0,3]}
|
||||
uniform float g_KeyTolerance; // {"material":"Tolerance","default":0.1,"range":[0,3]}
|
||||
uniform vec3 g_KeyColor; // {"material":"Color", "type": "color", "default":"1 1 1"}
|
||||
|
||||
void main() {
|
||||
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
|
||||
|
||||
float delta = dot(abs(g_KeyColor - albedo.rgb), vec3(1, 1, 1));
|
||||
float blend = smoothstep(0.001, 0.002 + g_KeyFuzz, delta - g_KeyTolerance);
|
||||
|
||||
#if INVERT == 1
|
||||
blend = 1.0 - blend;
|
||||
#endif
|
||||
|
||||
albedo.a *= mix(g_KeyAlpha, 1.0, blend);
|
||||
|
||||
#if FLATTEN == 1
|
||||
albedo.rgb *= albedo.a;
|
||||
#endif
|
||||
|
||||
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.xy = a_TexCoord;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
|
||||
// [COMBO] {"material":"Background","combo":"BACKGROUND","type":"options","default":1}
|
||||
|
||||
#include "common.h"
|
||||
|
||||
varying vec2 v_TexCoord;
|
||||
|
||||
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
|
||||
|
||||
uniform float g_Size; // {"material":"Size","default":1,"range":[0.01, 1]}
|
||||
uniform float g_Scale; // {"material":"Distortion","default":1,"range":[0, 2.5]}
|
||||
uniform vec2 g_Center; // {"material":"Center","default":"0.5 0.5"}
|
||||
|
||||
void main() {
|
||||
//vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
|
||||
|
||||
float aperture = 178.0;
|
||||
float apertureHalf = 0.5 * aperture * (M_PI / 180.0);
|
||||
float maxFactor = sin(apertureHalf);
|
||||
|
||||
vec2 uv;
|
||||
vec2 xy = (v_TexCoord.xy - g_Center) * 2.0 / g_Size;
|
||||
float d = length(xy);
|
||||
float alpha = 1.0;
|
||||
if (d < (2.0 - maxFactor))
|
||||
{
|
||||
d = length(xy * maxFactor);
|
||||
float z = sqrt(1.0 - d * d);
|
||||
float r = atan2(d, z) / M_PI;
|
||||
float phi = atan2(xy.y, xy.x);
|
||||
|
||||
uv.x = r * cos(phi) * g_Size + g_Center.x;
|
||||
uv.y = r * sin(phi) * g_Size + g_Center.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
uv = v_TexCoord.xy;
|
||||
#if BACKGROUND == 0
|
||||
alpha = 0.0;
|
||||
#endif
|
||||
}
|
||||
|
||||
vec4 albedo = texSample2D(g_Texture0, mix(v_TexCoord.xy, uv, g_Scale));
|
||||
albedo.a *= alpha;
|
||||
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.xy = a_TexCoord;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
|
||||
// [COMBO] {"material":"Caster","combo":"CASTER","type":"options","default":0,"options":{"Radial":0,"Directional":1}}
|
||||
|
||||
#include "common.h"
|
||||
|
||||
varying vec2 v_TexCoord;
|
||||
|
||||
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
|
||||
|
||||
uniform float g_Length; // {"material":"Ray length","default":0.5,"range":[0.01, 1]}
|
||||
uniform float g_Intensity; // {"material":"Ray intensity","default":1,"range":[0.01, 2.0]}
|
||||
uniform vec3 g_Color1; // {"material":"Color start","default":"1 1 1","type":"color"}
|
||||
uniform vec3 g_Color2; // {"material":"Color end","default":"1 1 1","type":"color"}
|
||||
|
||||
#if CASTER == 0
|
||||
uniform vec2 g_Center; // {"material":"Center","default":"0.5 0.5"}
|
||||
#else
|
||||
uniform float g_Direction; // {"material":"Direction","default":0,"range":[0,6.28]}
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
|
||||
vec2 texCoords = v_TexCoord;
|
||||
vec4 albedo = CAST4(0.0);
|
||||
|
||||
#if CASTER == 0
|
||||
vec2 direction = g_Center - texCoords;
|
||||
#else
|
||||
vec2 direction = rotateVec2(vec2(0, -0.5), g_Direction);
|
||||
#endif
|
||||
|
||||
float dist = length(direction);
|
||||
direction /= dist;
|
||||
|
||||
dist = min(dist, dist * g_Length);
|
||||
texCoords += direction * dist;
|
||||
direction = direction * dist / 29.0;
|
||||
|
||||
for (int i = 0; i < 30; ++i)
|
||||
{
|
||||
vec4 sample = texSample2D(g_Texture0, texCoords);
|
||||
texCoords -= direction;
|
||||
sample.rgb *= mix(g_Color2, g_Color1, i/29.0);
|
||||
albedo += sample * (i / 29.0);
|
||||
}
|
||||
|
||||
gl_FragColor = albedo * g_Intensity * 0.1;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
uniform mat4 g_ModelViewProjectionMatrix;
|
||||
uniform vec4 g_Texture1Resolution;
|
||||
|
||||
attribute vec3 a_Position;
|
||||
attribute vec2 a_TexCoord;
|
||||
|
||||
varying vec2 v_TexCoord;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(a_Position, 1.0);
|
||||
|
||||
v_TexCoord = a_TexCoord;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
// [COMBO] {"material":"Blend mode","combo":"BLENDMODE","type":"imageblending","default":9}
|
||||
|
||||
#include "common_blending.h"
|
||||
|
||||
varying vec4 v_TexCoord;
|
||||
|
||||
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
|
||||
uniform sampler2D g_Texture1; // {"material":"Prev","hidden":true}
|
||||
|
||||
void main() {
|
||||
|
||||
vec4 rays = texSample2D(g_Texture0, v_TexCoord.zw);
|
||||
vec4 albedo = texSample2D(g_Texture1, v_TexCoord.xy);
|
||||
|
||||
#if BLENDMODE == 0
|
||||
albedo = rays;
|
||||
#else
|
||||
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, rays.rgb, rays.a);
|
||||
albedo.a += rays.a;
|
||||
#endif
|
||||
|
||||
gl_FragColor = albedo;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
uniform mat4 g_ModelViewProjectionMatrix;
|
||||
uniform vec4 g_Texture1Resolution;
|
||||
|
||||
attribute vec3 a_Position;
|
||||
attribute vec2 a_TexCoord;
|
||||
|
||||
varying vec4 v_TexCoord;
|
||||
|
||||
#ifdef HLSL_SM30
|
||||
uniform vec4 g_Texture0Resolution;
|
||||
#endif
|
||||
|
||||
void main() {
|
||||
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
|
||||
|
||||
v_TexCoord = a_TexCoord.xyxy;
|
||||
|
||||
#ifdef HLSL_SM30
|
||||
v_TexCoord.zw += 0.5 / g_Texture0Resolution.xy;
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
varying vec4 v_TexCoord;
|
||||
|
||||
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
|
||||
uniform sampler2D g_Texture1; // {"material":"Mask","mode":"opacitymask","default":"util/white"}
|
||||
|
||||
uniform float g_Threshold; // {"material":"Ray threshold","default":0.5,"range":[0, 1]}
|
||||
|
||||
void main() {
|
||||
float mask = texSample2D(g_Texture1, v_TexCoord.zw).r;
|
||||
vec4 sample = texSample2D(g_Texture0, v_TexCoord.xy);
|
||||
sample.rgb *= sample.a;
|
||||
sample.a = 1.0;
|
||||
gl_FragColor = sample * mask * step(g_Threshold, dot(vec3(0.11, 0.59, 0.3), sample.rgb));
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
attribute vec3 a_Position;
|
||||
attribute vec2 a_TexCoord;
|
||||
|
||||
varying vec4 v_TexCoord;
|
||||
|
||||
uniform vec4 g_Texture0Resolution;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(a_Position, 1.0);
|
||||
v_TexCoord.xy = a_TexCoord;
|
||||
|
||||
v_TexCoord.zw = vec2(v_TexCoord.x * g_Texture0Resolution.z / g_Texture0Resolution.x,
|
||||
v_TexCoord.y * g_Texture0Resolution.w / g_Texture0Resolution.y);
|
||||
|
||||
#ifdef HLSL_SM30
|
||||
vec2 offsets = 0.5 / g_Texture0Resolution.xy;
|
||||
v_TexCoord.xy += offsets;
|
||||
#endif
|
||||
}
|
||||
@@ -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":"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.25 +
|
||||
texSample2D(g_Texture0, v_TexCoord[1]) * 0.5 +
|
||||
texSample2D(g_Texture0, v_TexCoord[2]) * 0.25;
|
||||
#endif
|
||||
|
||||
gl_FragColor = albedo;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
|
||||
// [COMBO] {"material":"Kernel size","combo":"KERNEL","type":"options","default":1,"options":{"13x13":0,"7x7":1,"3x3":2}}
|
||||
|
||||
uniform vec2 g_Scale; // {"material":"Blur 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() {
|
||||
gl_Position = vec4(a_Position, 1.0);
|
||||
|
||||
#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,10 @@
|
||||
|
||||
varying vec2 v_TexCoord;
|
||||
varying vec2 v_Scroll;
|
||||
|
||||
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
|
||||
|
||||
void main() {
|
||||
vec2 texCoord = frac(v_TexCoord + v_Scroll);
|
||||
gl_FragColor = texSample2D(g_Texture0, texCoord);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
uniform mat4 g_ModelViewProjectionMatrix;
|
||||
uniform float g_Time;
|
||||
|
||||
uniform float g_ScrollX; // {"material":"Speed X","default":0.2,"range":[-2,2]}
|
||||
uniform float g_ScrollY; // {"material":"Speed Y","default":0.2,"range":[-2,2]}
|
||||
|
||||
attribute vec3 a_Position;
|
||||
attribute vec2 a_TexCoord;
|
||||
|
||||
varying vec2 v_TexCoord;
|
||||
varying vec2 v_Scroll;
|
||||
|
||||
void main() {
|
||||
gl_Position = mul(vec4(a_Position, 1.0), g_ModelViewProjectionMatrix);
|
||||
v_TexCoord = a_TexCoord;
|
||||
|
||||
vec2 scroll = vec2(g_ScrollX, g_ScrollY);
|
||||
scroll = sign(scroll) * pow(vec2(g_ScrollX, g_ScrollY), CAST2(2.0));
|
||||
v_Scroll = scroll * g_Time;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
|
||||
// [COMBO] {"material":"Blend mode","combo":"BLENDMODE","type":"imageblending","default":2}
|
||||
|
||||
#include "common_blending.h"
|
||||
|
||||
varying vec2 v_TexCoord;
|
||||
|
||||
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
|
||||
|
||||
uniform float g_BlendAlpha; // {"material":"Alpha","default":1,"range":[0,1]}
|
||||
uniform vec3 g_TintColor; // {"material":"Color", "type": "color", "default":"1 1 1"}
|
||||
|
||||
void main() {
|
||||
vec4 albedo = texSample2D(g_Texture0, v_TexCoord.xy);
|
||||
|
||||
albedo.rgb = ApplyBlending(BLENDMODE, albedo.rgb, g_TintColor, g_BlendAlpha);
|
||||
|
||||
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.xy = a_TexCoord;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
// [COMBO] {"material":"Repeat","combo":"CLAMP","type":"options","default":1}
|
||||
|
||||
varying vec2 v_TexCoord;
|
||||
|
||||
uniform sampler2D g_Texture0; // {"material":"Framebuffer","hidden":true}
|
||||
|
||||
void main() {
|
||||
vec2 texCoord = v_TexCoord;
|
||||
#if CLAMP
|
||||
texCoord = frac(texCoord);
|
||||
#endif
|
||||
gl_FragColor = texSample2D(g_Texture0, texCoord);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
|
||||
// [COMBO] {"material":"Mode","combo":"MODE","type":"options","default":0,"options":{"Vertex":1,"UV":0}}
|
||||
|
||||
#include "common.h"
|
||||
|
||||
uniform mat4 g_ModelViewProjectionMatrix;
|
||||
|
||||
uniform vec2 g_Offset; // {"material":"Offset","default":"0 0"}
|
||||
uniform vec2 g_Scale; // {"material":"Scale","default":"1 1"}
|
||||
uniform float g_Direction; // {"material":"Angle","default":0,"range":[0,6.28]}
|
||||
|
||||
attribute vec3 a_Position;
|
||||
attribute vec2 a_TexCoord;
|
||||
|
||||
varying vec2 v_TexCoord;
|
||||
|
||||
vec2 applyFx(vec2 v) {
|
||||
v = rotateVec2(v - CAST2(0.5), g_Direction);
|
||||
return (v + g_Offset) * g_Scale + CAST2(0.5);
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
||||
vec3 position = a_Position;
|
||||
#if MODE == 1
|
||||
position.xy = applyFx(position.xy);
|
||||
#endif
|
||||
gl_Position = mul(vec4(position, 1.0), g_ModelViewProjectionMatrix);
|
||||
|
||||
v_TexCoord = a_TexCoord;
|
||||
|
||||
#if MODE == 0
|
||||
v_TexCoord = applyFx(v_TexCoord);
|
||||
#endif
|
||||
}
|
||||
Reference in New Issue
Block a user