mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-02-07 10:59:49 +00:00
Revert "Use L8 format for selection texture"
This reverts commit 8a3414f83a
.
This commit is contained in:
parent
8a3414f83a
commit
3727caf9c4
|
@ -765,14 +765,14 @@ func bitmap_to_image(bitmap: BitMap, square := true) -> Image:
|
||||||
var height := bitmap.get_size().y
|
var height := bitmap.get_size().y
|
||||||
if square:
|
if square:
|
||||||
var square_size = max(width, height)
|
var square_size = max(width, height)
|
||||||
image.create(square_size, square_size, false, Image.FORMAT_L8)
|
image.create(square_size, square_size, false, Image.FORMAT_LA8)
|
||||||
else:
|
else:
|
||||||
image.create(width, height, false, Image.FORMAT_L8)
|
image.create(width, height, false, Image.FORMAT_LA8)
|
||||||
image.lock()
|
image.lock()
|
||||||
for x in width:
|
for x in width:
|
||||||
for y in height:
|
for y in height:
|
||||||
var pos := Vector2(x, y)
|
var pos := Vector2(x, y)
|
||||||
var color = Color(1, 1, 1) if bitmap.get_bit(pos) else Color(0, 0, 0)
|
var color = Color(1, 1, 1, 1) if bitmap.get_bit(pos) else Color(0, 0, 0, 0)
|
||||||
image.set_pixelv(pos, color)
|
image.set_pixelv(pos, color)
|
||||||
image.unlock()
|
image.unlock()
|
||||||
return image
|
return image
|
||||||
|
|
|
@ -33,5 +33,5 @@ void fragment() { // applies on each pixel seperately
|
||||||
col = new_color;
|
col = new_color;
|
||||||
|
|
||||||
// Mix selects original color if there is selection or col if there is none
|
// Mix selects original color if there is selection or col if there is none
|
||||||
COLOR = mix(original_color, col, selection_color.r);
|
COLOR = mix(original_color, col, selection_color.a);
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ void fragment() {
|
||||||
|
|
||||||
vec3 output;
|
vec3 output;
|
||||||
if(affect_selection && has_selection) {
|
if(affect_selection && has_selection) {
|
||||||
output = mix(original_color.rgb, stdPrime, selection_color.r);
|
output = mix(original_color.rgb, stdPrime, selection_color.a);
|
||||||
} else {
|
} else {
|
||||||
output = stdPrime;
|
output = stdPrime;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ void fragment() {
|
||||||
col = hsb2rgb(hsb);
|
col = hsb2rgb(hsb);
|
||||||
vec3 output;
|
vec3 output;
|
||||||
if(affect_selection && has_selection)
|
if(affect_selection && has_selection)
|
||||||
output = mix(original_color.rgb, col, selection_color.r);
|
output = mix(original_color.rgb, col, selection_color.a);
|
||||||
else
|
else
|
||||||
output = col;
|
output = col;
|
||||||
COLOR = vec4(output.rgb, original_color.a);
|
COLOR = vec4(output.rgb, original_color.a);
|
||||||
|
|
|
@ -26,7 +26,7 @@ void fragment() {
|
||||||
|
|
||||||
vec4 output;
|
vec4 output;
|
||||||
if(affect_selection && has_selection)
|
if(affect_selection && has_selection)
|
||||||
output = mix(original_color.rgba, col, selection_color.r);
|
output = mix(original_color.rgba, col, selection_color.a);
|
||||||
else
|
else
|
||||||
output = col;
|
output = col;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ bool hasContraryNeighbour(vec2 uv, vec2 texture_pixel_size, sampler2D texture) {
|
||||||
vec2 xy1 = uv + texture_pixel_size * vec2(x1, y1);
|
vec2 xy1 = uv + texture_pixel_size * vec2(x1, y1);
|
||||||
vec2 xy2 = uv + texture_pixel_size * vec2(x2, y2);
|
vec2 xy2 = uv + texture_pixel_size * vec2(x2, y2);
|
||||||
|
|
||||||
if (xy1 != clamp(xy1, vec2(0.0), vec2(1.0)) || texture(texture, xy1).r == 0.0 || xy2 != clamp(xy2, vec2(0.0), vec2(1.0)) || texture(texture, xy2).r == 0.0) {
|
if (xy1 != clamp(xy1, vec2(0.0), vec2(1.0)) || texture(texture, xy1).a == 0.0 || xy2 != clamp(xy2, vec2(0.0), vec2(1.0)) || texture(texture, xy2).a == 0.0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ void fragment() {
|
||||||
vec2 uv = UV;
|
vec2 uv = UV;
|
||||||
COLOR = texture(TEXTURE, uv);
|
COLOR = texture(TEXTURE, uv);
|
||||||
|
|
||||||
if ((COLOR.r > 0.0) == true && hasContraryNeighbour(uv, TEXTURE_PIXEL_SIZE, TEXTURE)) {
|
if ((COLOR.a > 0.0) == true && hasContraryNeighbour(uv, TEXTURE_PIXEL_SIZE, TEXTURE)) {
|
||||||
vec4 final_color = first_color;
|
vec4 final_color = first_color;
|
||||||
// Generate diagonal stripes
|
// Generate diagonal stripes
|
||||||
if(animated)
|
if(animated)
|
||||||
|
|
Loading…
Reference in a new issue