mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 00:58:30 -05:00
21 lines
637 B
Text
21 lines
637 B
Text
float xll_saturate(float x) {
|
|
return clamp(x, 0.0, 1.0);
|
|
}
|
|
vec3 xll_saturate(vec3 x) {
|
|
return clamp(x, 0.0, 1.0);
|
|
}
|
|
uniform sampler2D _MainTex;
|
|
uniform sampler2D _BurntTex;
|
|
uniform mediump float _EmberFadeEnd;
|
|
uniform mediump float _EmberFadeStart;
|
|
lowp vec4 frag (mediump vec2 uv) {
|
|
lowp vec3 base = texture2D(_MainTex, uv).xyz;
|
|
lowp vec3 burn = texture2D(_BurntTex, uv).xyz;
|
|
lowp float t;
|
|
t = xll_saturate( ((_EmberFadeStart - 0.05) / (_EmberFadeStart - _EmberFadeEnd)) );
|
|
return vec4(mix(base, burn, vec3(t)), 1.0);
|
|
}
|
|
varying mediump vec2 xlv_TEXCOORD0;
|
|
void main() {
|
|
gl_FragColor = frag(xlv_TEXCOORD0);
|
|
}
|