mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 09:09:47 +00:00
Revert "Slightly optimize IndexedToRGB.gdshader"
This reverts commit 7cf87ac142
.
This commit is contained in:
parent
11da07b9ac
commit
d580523c6e
|
@ -7,14 +7,14 @@ uniform sampler2D palette_texture : filter_nearest;
|
||||||
uniform sampler2D indices_texture : filter_nearest;
|
uniform sampler2D indices_texture : filter_nearest;
|
||||||
|
|
||||||
void fragment() {
|
void fragment() {
|
||||||
float index = texture(indices_texture, UV).r * 255.0;
|
float index = texture(indices_texture, UV).r;
|
||||||
if (index <= EPSILON) { // If index is zero, make it transparent
|
if (index <= EPSILON) { // If index is zero, make it transparent
|
||||||
COLOR = vec4(0.0);
|
COLOR = vec4(0.0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
float n_of_colors = float(textureSize(palette_texture, 0).x);
|
float n_of_colors = float(textureSize(palette_texture, 0).x);
|
||||||
index -= 1.0;
|
index -= 1.0 / 255.0;
|
||||||
float index_normalized = index / n_of_colors;
|
float index_normalized = ((index * 255.0)) / n_of_colors;
|
||||||
if (index_normalized + EPSILON < 1.0) {
|
if (index_normalized + EPSILON < 1.0) {
|
||||||
COLOR = texture(palette_texture, vec2(index_normalized + EPSILON, 0.0));
|
COLOR = texture(palette_texture, vec2(index_normalized + EPSILON, 0.0));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue