🔧 Make shaders compatible with GLES

This commit is contained in:
Simon Schneegans
2023-04-02 20:42:38 +02:00
parent c78bc4c094
commit 5aad16c8bf
7 changed files with 44 additions and 32 deletions
+5 -5
View File
@@ -31,7 +31,7 @@ void main() {
float progress = uForOpening ? 1.0 - uProgress : uProgress;
// Draw the individual shard layers.
for (float i = 0; i < SHARD_LAYERS; ++i) {
for (float i = 0.0; i < SHARD_LAYERS; ++i) {
// To enable drawing shards outside of the window bounds, the actor was scaled
// by ACTOR_SCALE. Here we scale and move the texture coordinates so that the
@@ -51,8 +51,8 @@ void main() {
// Move down each layer a bit.
float gravity =
(uForOpening ? -1.0 : 1.0) * uGravity * 0.1 * (i + 1) * progress * progress;
coords += vec2(0, gravity);
(uForOpening ? -1.0 : 1.0) * uGravity * 0.1 * (i + 1.0) * progress * progress;
coords += vec2(0.0, gravity);
// Restore correct position.
coords += uEpicenter;
@@ -66,10 +66,10 @@ void main() {
// the bin of the current shard.
float shardGroup = floor(shardMap.g * SHARD_LAYERS * 0.999);
if (shardGroup == i && (shardMap.x - pow(progress + 0.1, 2)) > 0.0) {
if (shardGroup == i && (shardMap.x - pow(progress + 0.1, 2.0)) > 0.0) {
oColor = getInputColor(coords);
}
}
setOutputColor(oColor);
}
}