🔧 Use new global methods for shader I/O
This commit is contained in:
@@ -48,12 +48,8 @@ void main() {
|
|||||||
float c = cos(angle);
|
float c = cos(angle);
|
||||||
coords = vec2(dot(coords, vec2(c, -s)), dot(coords, vec2(s, c)));
|
coords = vec2(dot(coords, vec2(c, -s)), dot(coords, vec2(s, c)));
|
||||||
|
|
||||||
// Shell.GLSLEffect uses straight alpha. So we have to convert from premultiplied.
|
|
||||||
oColor = texture2D(uTexture, coords + center);
|
|
||||||
if (oColor.a > 0) {
|
|
||||||
oColor.rgb /= oColor.a;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fade out the window texture.
|
// Fade out the window texture.
|
||||||
|
vec4 oColor = getInputColor(coords + center);
|
||||||
oColor.a *= 1.0 - progress;
|
oColor.a *= 1.0 - progress;
|
||||||
|
setOutputColor(oColor);
|
||||||
}
|
}
|
||||||
@@ -25,7 +25,7 @@ const float ACTOR_SCALE = 2.0;
|
|||||||
const float PADDING = ACTOR_SCALE / 2.0 - 0.5;
|
const float PADDING = ACTOR_SCALE / 2.0 - 0.5;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
oColor = vec4(0, 0, 0, 0);
|
vec4 oColor = vec4(0, 0, 0, 0);
|
||||||
|
|
||||||
float progress = uForOpening ? 1.0 - uProgress : uProgress;
|
float progress = uForOpening ? 1.0 - uProgress : uProgress;
|
||||||
|
|
||||||
@@ -66,12 +66,9 @@ void main() {
|
|||||||
float shardGroup = floor(shardMap.g * SHARD_LAYERS * 0.999);
|
float shardGroup = floor(shardMap.g * SHARD_LAYERS * 0.999);
|
||||||
|
|
||||||
if (shardGroup == i && (shardMap.x - pow(progress + 0.1, 2)) > 0) {
|
if (shardGroup == i && (shardMap.x - pow(progress + 0.1, 2)) > 0) {
|
||||||
oColor = texture2D(uTexture, coords);
|
oColor = getInputColor(coords);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shell.GLSLEffect uses straight alpha. So we have to convert from premultiplied.
|
setOutputColor(oColor);
|
||||||
if (oColor.a > 0) {
|
|
||||||
oColor.rgb /= oColor.a;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -106,7 +106,7 @@ uniform float uTime;
|
|||||||
uniform vec2 uSize;
|
uniform vec2 uSize;
|
||||||
uniform float uPadding;
|
uniform float uPadding;
|
||||||
|
|
||||||
// On GNOME, we set iTexCoord and oColor to be aliases for the cogl variables.
|
// On GNOME, we set iTexCoord to be an alias for the cogl variables.
|
||||||
#define iTexCoord cogl_tex_coord_in[0]
|
#define iTexCoord cogl_tex_coord_in[0]
|
||||||
|
|
||||||
// Shell.GLSLEffect uses straight alpha. So we have to convert from premultiplied.
|
// Shell.GLSLEffect uses straight alpha. So we have to convert from premultiplied.
|
||||||
|
|||||||
@@ -59,17 +59,12 @@ vec2 getMasks(float progress) {
|
|||||||
void main() {
|
void main() {
|
||||||
float progress = easeOutQuad(uProgress);
|
float progress = easeOutQuad(uProgress);
|
||||||
|
|
||||||
vec2 masks = getMasks(progress);
|
vec2 masks = getMasks(progress);
|
||||||
vec4 windowColor = texture2D(uTexture, iTexCoord.st);
|
vec4 oColor = getInputColor(iTexCoord.st);
|
||||||
|
|
||||||
// Shell.GLSLEffect uses straight alpha. So we have to convert from premultiplied.
|
|
||||||
if (windowColor.a > 0) {
|
|
||||||
windowColor.rgb /= windowColor.a;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dissolve window to effect color / transparency.
|
// Dissolve window to effect color / transparency.
|
||||||
oColor.rgb = mix(uColor, windowColor.rgb, 0.2 * masks.y + 0.8);
|
oColor.rgb = mix(uColor, oColor.rgb, 0.2 * masks.y + 0.8);
|
||||||
oColor.a = windowColor.a * masks.y;
|
oColor.a = oColor.a * masks.y;
|
||||||
|
|
||||||
vec2 scaledUV = (iTexCoord.st - 0.5) * (1.0 + 0.1 * progress);
|
vec2 scaledUV = (iTexCoord.st - 0.5) * (1.0 + 0.1 * progress);
|
||||||
scaledUV /= uScale;
|
scaledUV /= uScale;
|
||||||
@@ -94,4 +89,6 @@ void main() {
|
|||||||
// oColor = vec4(vec3(masks.x), 1.0);
|
// oColor = vec4(vec3(masks.x), 1.0);
|
||||||
// oColor = vec4(vec3(masks.y), 1.0);
|
// oColor = vec4(vec3(masks.y), 1.0);
|
||||||
// oColor = vec4(vec3(particles), 1.0);
|
// oColor = vec4(vec3(particles), 1.0);
|
||||||
|
|
||||||
|
setOutputColor(oColor);
|
||||||
}
|
}
|
||||||
@@ -76,17 +76,12 @@ vec4 getMasks(float progress) {
|
|||||||
void main() {
|
void main() {
|
||||||
float progress = easeOutQuad(uProgress);
|
float progress = easeOutQuad(uProgress);
|
||||||
|
|
||||||
vec4 masks = getMasks(progress);
|
vec4 masks = getMasks(progress);
|
||||||
vec4 windowColor = texture2D(uTexture, iTexCoord.st);
|
vec4 oColor = getInputColor(iTexCoord.st);
|
||||||
|
|
||||||
// Shell.GLSLEffect uses straight alpha. So we have to convert from premultiplied.
|
|
||||||
if (windowColor.a > 0) {
|
|
||||||
windowColor.rgb /= windowColor.a;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dissolve window to effect color / transparency.
|
// Dissolve window to effect color / transparency.
|
||||||
oColor.rgb = mix(uColor, windowColor.rgb, 0.5 * masks.w + 0.5);
|
oColor.rgb = mix(uColor, oColor.rgb, 0.5 * masks.w + 0.5);
|
||||||
oColor.a = windowColor.a * masks.w;
|
oColor.a = oColor.a * masks.w;
|
||||||
|
|
||||||
// Add leading shower particles.
|
// Add leading shower particles.
|
||||||
vec2 showerUV = iTexCoord.st + vec2(0, -0.7 * progress / SHOWER_TIME);
|
vec2 showerUV = iTexCoord.st + vec2(0, -0.7 * progress / SHOWER_TIME);
|
||||||
@@ -118,4 +113,6 @@ void main() {
|
|||||||
// oColor = vec4(vec3(shower), 1.0);
|
// oColor = vec4(vec3(shower), 1.0);
|
||||||
// oColor = vec4(vec3(streaks), 1.0);
|
// oColor = vec4(vec3(streaks), 1.0);
|
||||||
// oColor = vec4(vec3(atoms), 1.0);
|
// oColor = vec4(vec3(atoms), 1.0);
|
||||||
|
|
||||||
|
setOutputColor(oColor);
|
||||||
}
|
}
|
||||||
@@ -103,12 +103,7 @@ void main() {
|
|||||||
vec4 fire = getFireColor(noise);
|
vec4 fire = getFireColor(noise);
|
||||||
|
|
||||||
// Get the window texture.
|
// Get the window texture.
|
||||||
oColor = texture2D(uTexture, iTexCoord.st);
|
vec4 oColor = getInputColor(iTexCoord.st);
|
||||||
|
|
||||||
// Shell.GLSLEffect uses straight alpha. So we have to convert from premultiplied.
|
|
||||||
if (oColor.a > 0) {
|
|
||||||
oColor.rgb /= oColor.a;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fade the window according to the effect mask.
|
// Fade the window according to the effect mask.
|
||||||
oColor.a *= effectMask.x;
|
oColor.a *= effectMask.x;
|
||||||
@@ -120,4 +115,6 @@ void main() {
|
|||||||
// oColor = vec4(vec3(noise), 1);
|
// oColor = vec4(vec3(noise), 1);
|
||||||
// oColor = vec4(vec3(effectMask.x), 1);
|
// oColor = vec4(vec3(effectMask.x), 1);
|
||||||
// oColor = vec4(vec3(effectMask.y), 1);
|
// oColor = vec4(vec3(effectMask.y), 1);
|
||||||
|
|
||||||
|
setOutputColor(oColor);
|
||||||
}
|
}
|
||||||
@@ -79,22 +79,15 @@ void main() {
|
|||||||
vec2 texScale = 0.1 * uSize / uScale;
|
vec2 texScale = 0.1 * uSize / uScale;
|
||||||
vec4 hex = getHexagons(iTexCoord.st * texScale);
|
vec4 hex = getHexagons(iTexCoord.st * texScale);
|
||||||
|
|
||||||
if (tileProgress > hex.z) {
|
vec4 oColor = vec4(0.0);
|
||||||
|
|
||||||
// Crop outer parts of the shrinking tiles.
|
// Crop outer parts of the shrinking tiles.
|
||||||
oColor.a = 0.0;
|
if (tileProgress < hex.z) {
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
// Make the tiles shrink by offsetting the texture lookup towards the edge
|
// Make the tiles shrink by offsetting the texture lookup towards the edge
|
||||||
// of the cell.
|
// of the cell.
|
||||||
vec2 lookupOffset = tileProgress * hex.xy / texScale / (1.0 - tileProgress);
|
vec2 lookupOffset = tileProgress * hex.xy / texScale / (1.0 - tileProgress);
|
||||||
oColor = texture2D(uTexture, iTexCoord.st + lookupOffset);
|
oColor = getInputColor(iTexCoord.st + lookupOffset);
|
||||||
|
|
||||||
// Shell.GLSLEffect uses straight alpha. So we have to convert from premultiplied.
|
|
||||||
if (oColor.a > 0) {
|
|
||||||
oColor.rgb /= oColor.a;
|
|
||||||
}
|
|
||||||
|
|
||||||
vec4 glow = uGlowColor;
|
vec4 glow = uGlowColor;
|
||||||
vec4 line = uLineColor;
|
vec4 line = uLineColor;
|
||||||
@@ -122,4 +115,6 @@ void main() {
|
|||||||
oColor.rgb = mix(oColor.rgb, line.rgb, line.a);
|
oColor.rgb = mix(oColor.rgb, line.rgb, line.a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setOutputColor(oColor);
|
||||||
}
|
}
|
||||||
@@ -83,12 +83,7 @@ void main() {
|
|||||||
float textMask = getText(coords);
|
float textMask = getText(coords);
|
||||||
|
|
||||||
// Get the window texture.
|
// Get the window texture.
|
||||||
oColor = texture2D(uTexture, coords);
|
vec4 oColor = getInputColor(coords);
|
||||||
|
|
||||||
// Shell.GLSLEffect uses straight alpha. So we have to convert from premultiplied.
|
|
||||||
if (oColor.a > 0) {
|
|
||||||
oColor.rgb /= oColor.a;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fade the window according to the effect mask.
|
// Fade the window according to the effect mask.
|
||||||
oColor.a *= rainMask.y;
|
oColor.a *= rainMask.y;
|
||||||
@@ -107,4 +102,6 @@ void main() {
|
|||||||
// oColor = vec4(vec3(textMask), 1);
|
// oColor = vec4(vec3(textMask), 1);
|
||||||
// oColor = vec4(vec3(rainMask.x), 1);
|
// oColor = vec4(vec3(rainMask.x), 1);
|
||||||
// oColor = vec4(vec3(rainMask.y), 1);
|
// oColor = vec4(vec3(rainMask.y), 1);
|
||||||
|
|
||||||
|
setOutputColor(oColor);
|
||||||
}
|
}
|
||||||
@@ -34,11 +34,7 @@ void main() {
|
|||||||
progress = progress + 0.25 - 0.5 * simplex2D((iTexCoord.st + uSeed) * 2.0);
|
progress = progress + 0.25 - 0.5 * simplex2D((iTexCoord.st + uSeed) * 2.0);
|
||||||
progress = pow(max(0, progress), 2.0);
|
progress = pow(max(0, progress), 2.0);
|
||||||
|
|
||||||
// This may help you to understand how this effect works.
|
vec4 oColor = vec4(0.0);
|
||||||
// oColor = vec4(progress, 0, 0, 0);
|
|
||||||
// return;
|
|
||||||
|
|
||||||
oColor = vec4(0, 0, 0, 0);
|
|
||||||
|
|
||||||
for (float i = 0; i < DUST_LAYERS; ++i) {
|
for (float i = 0; i < DUST_LAYERS; ++i) {
|
||||||
|
|
||||||
@@ -80,12 +76,7 @@ void main() {
|
|||||||
if (dustGroup == i) {
|
if (dustGroup == i) {
|
||||||
|
|
||||||
// Get the window color.
|
// Get the window color.
|
||||||
vec4 windowColor = texture2D(uTexture, coords + 0.5);
|
vec4 windowColor = getInputColor(coords + 0.5);
|
||||||
|
|
||||||
// Shell.GLSLEffect uses straight alpha. So we have to convert from premultiplied.
|
|
||||||
if (windowColor.a > 0) {
|
|
||||||
windowColor.rgb /= windowColor.a;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fade the window color to uDustColor.
|
// Fade the window color to uDustColor.
|
||||||
vec3 dustColor = mix(windowColor.rgb, uDustColor.rgb, uDustColor.a);
|
vec3 dustColor = mix(windowColor.rgb, uDustColor.rgb, uDustColor.a);
|
||||||
@@ -97,4 +88,9 @@ void main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This may help you to understand how this effect works.
|
||||||
|
// oColor = vec4(progress, 0, 0, 0);
|
||||||
|
|
||||||
|
setOutputColor(oColor);
|
||||||
}
|
}
|
||||||
@@ -90,12 +90,7 @@ void main() {
|
|||||||
// Get the window texture. We shift the texture lookup by the local derivative of
|
// Get the window texture. We shift the texture lookup by the local derivative of
|
||||||
// the claw texture in order to mimic some folding distortion.
|
// the claw texture in order to mimic some folding distortion.
|
||||||
vec2 offset = vec2(dFdx(scratchMap), dFdy(scratchMap)) * progress * 0.5;
|
vec2 offset = vec2(dFdx(scratchMap), dFdy(scratchMap)) * progress * 0.5;
|
||||||
oColor = texture2D(uTexture, coords + offset);
|
vec4 oColor = getInputColor(coords + offset);
|
||||||
|
|
||||||
// Shell.GLSLEffect uses straight alpha. So we have to convert from premultiplied.
|
|
||||||
if (oColor.a > 0) {
|
|
||||||
oColor.rgb /= oColor.a;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add colorful flashes.
|
// Add colorful flashes.
|
||||||
float flashIntensity = 1.0 / FLASH_INTENSITY * (scratchMap - progress) + 1;
|
float flashIntensity = 1.0 / FLASH_INTENSITY * (scratchMap - progress) + 1;
|
||||||
@@ -120,4 +115,6 @@ void main() {
|
|||||||
// These are pretty useful for understanding how this works.
|
// These are pretty useful for understanding how this works.
|
||||||
// oColor = vec4(vec3(flashIntensity), 1);
|
// oColor = vec4(vec3(flashIntensity), 1);
|
||||||
// oColor = vec4(vec3(scratchMap), 1);
|
// oColor = vec4(vec3(scratchMap), 1);
|
||||||
|
|
||||||
|
setOutputColor(oColor);
|
||||||
}
|
}
|
||||||
@@ -71,12 +71,7 @@ void main() {
|
|||||||
vec2 coords = iTexCoord.st * (scale + 1.0) - scale * 0.5;
|
vec2 coords = iTexCoord.st * (scale + 1.0) - scale * 0.5;
|
||||||
|
|
||||||
// Get the color of the window.
|
// Get the color of the window.
|
||||||
oColor = texture2D(uTexture, coords);
|
vec4 oColor = getInputColor(coords);
|
||||||
|
|
||||||
// Shell.GLSLEffect uses straight alpha. So we have to convert from premultiplied.
|
|
||||||
if (oColor.a > 0) {
|
|
||||||
oColor.rgb /= oColor.a;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compute several layers of moving wisps.
|
// Compute several layers of moving wisps.
|
||||||
vec2 uv = (iTexCoord.st - 0.5) / mix(1.0, 0.5, progress) + 0.5;
|
vec2 uv = (iTexCoord.st - 0.5) / mix(1.0, 0.5, progress) + 0.5;
|
||||||
@@ -110,4 +105,6 @@ void main() {
|
|||||||
// oColor = vec4(vec3(wisps), 1.0);
|
// oColor = vec4(vec3(wisps), 1.0);
|
||||||
// oColor = vec4(vec3(noise), 1.0);
|
// oColor = vec4(vec3(noise), 1.0);
|
||||||
// oColor = vec4(vec3(mask*min(wispsIn, 1.0 - wispsOut)), 1.0);
|
// oColor = vec4(vec3(mask*min(wispsIn, 1.0 - wispsOut)), 1.0);
|
||||||
|
|
||||||
|
setOutputColor(oColor);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user