autotile map

This commit is contained in:
Tanasart 2024-10-21 16:50:45 +07:00
parent 39e002eae3
commit 678b396269
4 changed files with 378 additions and 73 deletions

View File

@ -1,3 +1,9 @@
enum AUTOTILE_TYPE {
box9,
side15,
top48,
}
function tiler_brush_autotile(_type, _index) constructor {
type = _type;
index = _index;
@ -7,14 +13,14 @@ function tiler_brush_autotile(_type, _index) constructor {
drawing_surface = noone;
target_surface = noone;
eraseMode = false;
bitmask = [];
switch(type) {
case AUTOTILE_TYPE.box3_3 :
case AUTOTILE_TYPE.box9 :
// - 1 - | 0 1 2
// 2 x 4 | 3 4 5
// - 8 - | 6 7 8
bitmask_type = 4;
bitmask = [ 4,
/* 1 */ 7,
/* 2 */ 5, 8,
@ -65,7 +71,7 @@ function tiler_brush_autotile(_type, _index) constructor {
shader_set_surface("maskSurface", mask_surface);
shader_set_i("bitmask", bitmask);
shader_set_i("bitmaskSize", array_length(bitmask));
shader_set_i("bitmaskType", bitmask_type);
shader_set_i("bitmaskType", type);
shader_set_i("indexes", index);
shader_set_i("indexSize", array_length(index));

View File

@ -48,6 +48,14 @@ function Node_MK_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
__edge_buffer = [ surface_create(1, 1), surface_create(1, 1), surface_create(1, 1) ];
edge_surface = [];
attributes.show_tile_index = false;
array_push(attributeEditors, "Display");
array_push(attributeEditors, ["Show index", function() /*=>*/ {return attributes.show_tile_index}, new checkBox(function() /*=>*/ { attributes.show_tile_index = !attributes.show_tile_index; }) ]);
#region overlay
tile_overlay_select = noone;
#endregion
#region index
index_18 = [ 0, /**/ 8, 12, 4, /**/ 7, 11,
0, /**/ 10, 15, 5, /**/ 13, 14,
@ -130,11 +138,7 @@ function Node_MK_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
#endregion
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
} #endregion
static step = function() { #region
static step = function() {
var _outType = getSingleValue( 3);
var _edgType = getSingleValue( 5);
var _edgFull = getSingleValue(11);
@ -145,9 +149,9 @@ function Node_MK_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
inputs[ 9].setVisible(_edgType == 1, _edgType == 1);
inputs[13].setVisible(_edgType == 0);
inputs[14].setVisible(_outType == 1);
} #endregion
}
static generateFull = function(_data, _tex0, _tex1, _edge, _crop, indMain, indEdge_et, indEdge_eb, indEdge_el, indEdge_er) { #region
static generateFull = function(_data, _tex0, _tex1, _edge, _crop, indMain, indEdge_et, indEdge_eb, indEdge_el, indEdge_er) {
var _len = array_length(indMain);
var _sprs = array_create(_len);
var _use1 = is_surface(_tex1);
@ -199,7 +203,7 @@ function Node_MK_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
var _el = _edge[2][indEdge_el[i]];
var _er = _edge[3][indEdge_er[i]];
if(_el != noone) { #region
if(_el != noone) {
shader_set(sh_mk_tile55_edge_l);
shader_set_f("dimension", _sw, _sh);
shader_set_f("crop", _crop);
@ -208,9 +212,9 @@ function Node_MK_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
draw_surface_ext(_el, 0, 0, 1, 1, 0, c_white, 1);
shader_reset();
} #endregion
}
if(_er != noone) { #region
if(_er != noone) {
shader_set(sh_mk_tile55_edge_r);
shader_set_f("dimension", _sw, _sh);
shader_set_f("crop", _crop);
@ -219,9 +223,9 @@ function Node_MK_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
draw_surface_ext(_er, 0, 0, 1, 1, 0, c_white, 1);
shader_reset();
} #endregion
}
if(_et != noone) { #region
if(_et != noone) {
shader_set(sh_mk_tile55_edge_t);
shader_set_f("dimension", _sw, _sh);
shader_set_f("crop", _crop);
@ -230,9 +234,9 @@ function Node_MK_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
draw_surface_ext(_et, 0, 0, 1, 1, 0, c_white, 1);
shader_reset();
} #endregion
}
if(_eb != noone) { #region
if(_eb != noone) {
shader_set(sh_mk_tile55_edge_b);
shader_set_f("dimension", _sw, _sh);
shader_set_f("crop", _crop);
@ -241,7 +245,7 @@ function Node_MK_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
draw_surface_ext(_eb, 0, 0, 1, 1, 0, c_white, 1);
shader_reset();
} #endregion
}
BLEND_NORMAL
surface_reset_target();
@ -250,9 +254,9 @@ function Node_MK_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
}
return _sprs;
} #endregion
}
static generateSimple = function(_data, _tex0, _tex1, _edge, _crop, indMain, indEdge_et, indEdge_eb, indEdge_el, indEdge_er) { #region
static generateSimple = function(_data, _tex0, _tex1, _edge, _crop, indMain, indEdge_et, indEdge_eb, indEdge_el, indEdge_er) {
var _sprs = array_create(18);
var _use1 = is_surface(_tex1);
var _sw = surface_get_width_safe(_tex0);
@ -296,7 +300,7 @@ function Node_MK_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
var _el = _edge[2][indEdge_el[i]];
var _er = _edge[3][indEdge_er[i]];
if(_el != noone) { #region
if(_el != noone) {
shader_set(sh_mk_tile18_edge_l);
shader_set_f("dimension", _sw, _sh);
shader_set_f("crop", _crop);
@ -305,9 +309,9 @@ function Node_MK_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
draw_surface_ext(_el, 0, 0, 1, 1, 0, c_white, 1);
shader_reset();
} #endregion
}
if(_er != noone) { #region
if(_er != noone) {
shader_set(sh_mk_tile18_edge_r);
shader_set_f("dimension", _sw, _sh);
shader_set_f("crop", _crop);
@ -316,9 +320,9 @@ function Node_MK_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
draw_surface_ext(_er, 0, 0, 1, 1, 0, c_white, 1);
shader_reset();
} #endregion
}
if(_et != noone) { #region
if(_et != noone) {
shader_set(sh_mk_tile18_edge_t);
shader_set_f("dimension", _sw, _sh);
shader_set_f("crop", _crop);
@ -327,9 +331,9 @@ function Node_MK_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
draw_surface_ext(_et, 0, 0, 1, 1, 0, c_white, 1);
shader_reset();
} #endregion
}
if(_eb != noone) { #region
if(_eb != noone) {
shader_set(sh_mk_tile18_edge_b);
shader_set_f("dimension", _sw, _sh);
shader_set_f("crop", _crop);
@ -338,7 +342,7 @@ function Node_MK_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
draw_surface_ext(_eb, 0, 0, 1, 1, 0, c_white, 1);
shader_reset();
} #endregion
}
BLEND_NORMAL
surface_reset_target();
@ -347,24 +351,13 @@ function Node_MK_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
}
return _sprs;
} #endregion
static generate18 = function(_data, _tex0, _tex1, _edge, _crop) {
INLINE
return generateSimple(_data, _tex0, _tex1, _edge, _crop, index_18, index_18_et, index_18_eb, index_18_el, index_18_er);
}
static generate55 = function(_data, _tex0, _tex1, _edge, _crop) {
INLINE
return generateFull(_data, _tex0, _tex1, _edge, _crop, index_55, index_55_et, index_55_eb, index_55_el, index_55_er);
}
static generate18 = function(_data, _tex0, _tex1, _edge, _crop) { INLINE return generateSimple(_data, _tex0, _tex1, _edge, _crop, index_18, index_18_et, index_18_eb, index_18_el, index_18_er); }
static generate55 = function(_data, _tex0, _tex1, _edge, _crop) { INLINE return generateFull( _data, _tex0, _tex1, _edge, _crop, index_55, index_55_et, index_55_eb, index_55_el, index_55_er); }
static generate48 = function(_data, _tex0, _tex1, _edge, _crop) { INLINE return generateFull( _data, _tex0, _tex1, _edge, _crop, index_48, index_48_et, index_48_eb, index_48_el, index_48_er); }
static generate48 = function(_data, _tex0, _tex1, _edge, _crop) {
INLINE
return generateFull(_data, _tex0, _tex1, _edge, _crop, index_48, index_48_et, index_48_eb, index_48_el, index_48_er);
}
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
static processData = function(_outSurf, _data, _output_index, _array_index) {
var _tex0 = _data[0];
var _tex1 = _data[1];
var _type = _data[2];
@ -388,7 +381,7 @@ function Node_MK_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
for( var i = 0, n = array_length(__edge_buffer); i < n; i++ )
__edge_buffer[i] = surface_verify(__edge_buffer[i], _sw, _sh);
if(_edgType == 0 && is_surface(_data[6])) { #region
if(_edgType == 0 && is_surface(_data[6])) {
var _esw = surface_get_width_safe(_data[6]);
var _esh = surface_get_height_safe(_data[6]);
@ -414,9 +407,9 @@ function Node_MK_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
surface_reset_shader();
_edges = __edge_uniform;
} #endregion
}
for( var i = 0; i < 4; i++ ) { #region edges
for( var i = 0; i < 4; i++ ) { //edges
var _ed = _edges[i];
var _edShf = _edgeShf[_shi[i]];
@ -435,7 +428,7 @@ function Node_MK_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
__edge_surface[_sIndx] = surface_verify(__edge_surface[_sIndx], _sw, _sh);
surface_set_target(__edge_buffer[0]); #region
surface_set_target(__edge_buffer[0]);
DRAW_CLEAR
BLEND_OVERRIDE
@ -460,12 +453,12 @@ function Node_MK_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
}
BLEND_NORMAL
surface_reset_target(); #endregion
surface_reset_target();
_edBuf = __edge_buffer[0];
if(_edgType == 0 && _edgTran == 1) { // rotate surface for uniform edge type
surface_set_target(__edge_buffer[1]); #region
surface_set_target(__edge_buffer[1]);
DRAW_CLEAR
BLEND_ALPHA_MULP
@ -476,13 +469,13 @@ function Node_MK_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
}
BLEND_NORMAL
surface_reset_target(); #endregion
surface_reset_target();
_edBuf = __edge_buffer[1];
}
if(_edgSprt == 1 && j >= 2) {
surface_set_target(__edge_buffer[2]); #region
surface_set_target(__edge_buffer[2]);
DRAW_CLEAR
BLEND_ALPHA_MULP
@ -518,12 +511,12 @@ function Node_MK_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
}
BLEND_NORMAL
surface_reset_target(); #endregion
surface_reset_target();
_edBuf = __edge_buffer[2];
}
surface_set_target(__edge_surface[_sIndx]); #region
surface_set_target(__edge_surface[_sIndx]);
DRAW_CLEAR
BLEND_OVERRIDE
@ -540,11 +533,11 @@ function Node_MK_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
draw_surface(_edBuf, _xx, _yy);
BLEND_NORMAL
surface_reset_target(); #endregion
surface_reset_target();
edge_surface[i][j] = __edge_surface[_sIndx];
}
} #endregion
}
_edge = edge_surface;
@ -604,5 +597,86 @@ function Node_MK_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
surface_reset_target();
return _outSurf;
} #endregion
}
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
if(!attributes.show_tile_index) return;
var _tex = getSingleValue(0);
var _typ = getSingleValue(2);
var _out = getSingleValue(0,, true);
if(!is_surface(_tex)) return;
if(!is_surface(_out)) return;
var _dim = surface_get_dimension(_tex);
var _oim = surface_get_dimension(_out);
var _til = [ _oim[0] / _dim[0], _oim[1] / _dim[1] ];
var _tw = _dim[0] * _s;
var _th = _dim[1] * _s;
////////////////////////////////////////////////////////////////////////////////////////
draw_set_color(COLORS._main_icon_light);
draw_set_alpha(0.5);
for(var i = 1; i < _til[0]; i++) {
var _lx = _x + i * _tw;
draw_line(_lx, _y, _lx, _y + _oim[1] * _s);
}
for(var i = 1; i < _til[1]; i++) {
var _ly = _y + i * _th;
draw_line(_x, _ly, _x + _oim[0] * _s, _ly);
}
draw_set_alpha(1);
////////////////////////////////////////////////////////////////////////////////////////
var _bitmask_draw = false;
var _bitmask_x = 0;
var _bitmask_y = 0;
for(var i = 0; i < _til[1]; i++) {
var _ly = _y + i * _th;
for(var j = _typ? 0 : 1; j < _til[0]; j++) {
var _lx = _x + j * _tw;
var _id = _typ? i * _til[0] + j : i * (_til[0] - 1) + j - 1;
if(hover && point_in_rectangle(_mx, _my, _lx, _ly, _lx + _tw, _ly + _th)) {
draw_set_color(COLORS._main_icon_light)
draw_rectangle(_lx, _ly, _lx + _tw - 1, _ly + _th - 1, true);
if(mouse_press(mb_left))
tile_overlay_select = tile_overlay_select == _id? noone : _id;
}
draw_set_text(f_p0, fa_left, fa_left, _id == tile_overlay_select? COLORS._main_icon_light : COLORS._main_icon);
draw_text(_lx + 4, _ly + 4, _id);
if(_id == tile_overlay_select) {
_bitmask_draw = true;
_bitmask_x = _lx;
_bitmask_y = _ly;
}
}
}
if(_bitmask_draw) {
draw_set_color(COLORS._main_accent);
for(var i = 0; i < 3; i++)
for(var j = 0; j < 3; j++) {
var _id = i * 3 + j;
var _lx = _bitmask_x + (j - 1) * _tw;
var _ly = _bitmask_y + (i - 1) * _th;
draw_set_text(f_p0b, fa_center, fa_center, COLORS._main_accent);
draw_text(_lx + _tw / 2, _ly + _th / 2, _id);
draw_rectangle(_lx, _ly, _lx + _tw - 1, _ly + _th - 1, true);
}
}
}
}

View File

@ -1,7 +1,3 @@
enum AUTOTILE_TYPE {
box3_3,
}
function Node_Tile_Drawer(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Tile Drawer";
bypass_grid = true;
@ -242,13 +238,7 @@ function Node_Tile_Drawer(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
#endregion
#region ++++ auto tile ++++
autotiles = [
new tiler_brush_autotile(AUTOTILE_TYPE.box3_3, [
0, 1, 2,
11, 12, 13,
22, 23, 24,
]),
];
autotiles = [];
autotile_selecting = 0;

View File

@ -1,3 +1,7 @@
#define _0(x) (x==0)
#define _1(x) (x==1)
#define _A(x) (true)
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
@ -55,14 +59,245 @@ void main() {
int i7 = m7 == 1. && erase == 1? 0 : int(ceil(m7));
int i8 = m8 == 1. && erase == 1? 0 : int(ceil(m8));
int bitIndex;
int index = 0;
if(bitmaskType == 4) bitIndex = i1 * 1 + i3 * 2 + i5 * 4 + i7 * 8;
else if(bitmaskType == 8) bitIndex = i0 * 1 + i1 * 2 + i2 * 4
+ i3 * 8 + i5 * 16
+ i6 * 32 + i7 * 64 + i8 * 128;
// 0 1 2
// 3 5
// 6 7 8
float res = float(indexes[bitmask[bitIndex]]);
if(bitmaskType == 0) {
int _bitIndex = i1 * 1 + i3 * 2 + i5 * 4 + i7 * 8;
index = bitmask[_bitIndex];
} else if(bitmaskType == 1) {
int _bitIndex = i1 * 1 + i3 * 2 + i5 * 4 + i7 * 8;
index = 6;
if(_0(i1) && _0(i3) && _1(i5) && _1(i7)) index = 0;
if(_0(i1) && _0(i5) && _1(i3) && _1(i7)) index = 2;
if(_0(i3) && _0(i7) && _1(i1) && _1(i5)) index = 10;
if(_0(i5) && _0(i7) && _1(i1) && _1(i3)) index = 12;
if(_0(i1) && _1(i3) && _1(i5) && _1(i7)) index = 1;
if(_0(i3) && _1(i1) && _1(i5) && _1(i7)) index = 5;
if(_0(i5) && _1(i3) && _1(i1) && _1(i7)) index = 7;
if(_0(i7) && _1(i3) && _1(i5) && _1(i1)) index = 11;
if(_1(i0) && _1(i1) && _1(i3) && _1(i5) && _1(i7) && _1(i8)) {
if(_1(i2) && _0(i6)) index = 4;
if(_0(i2) && _1(i6)) index = 8;
if(_0(i2) && _0(i6)) index = 13;
}
if(_1(i1) && _1(i2) && _1(i3) && _1(i5) && _1(i6) && _1(i7)) {
if(_1(i0) && _0(i8)) index = 3;
if(_0(i0) && _1(i8)) index = 9;
if(_0(i0) && _0(i8)) index = 14;
}
} else if(bitmaskType == 2) {
index = 12;
if(_0(i0) && _0(i1) && _0(i3) && _1(i5) && _1(i7) && _1(i8)) index = 0;
if(_0(i1) && _0(i2) && _1(i3) && _0(i5) && _1(i6) && _1(i7)) index = 2;
if(_1(i1) && _1(i2) && _0(i3) && _1(i5) && _0(i7) && _0(i8)) index = 22;
if(_1(i0) && _1(i1) && _1(i3) && _0(i5) && _0(i6) && _0(i7)) index = 24;
/////////////////
if(_0(i0) && _0(i1) && _0(i2) &&
_1(i3) && _1(i5) &&
_1(i6) && _1(i7) && _1(i8)) index = 1;
if(_0(i0) && _1(i1) && _1(i2) &&
_0(i3) && _1(i5) &&
_0(i6) && _1(i7) && _1(i8)) index = 11;
if(_1(i0) && _1(i1) && _0(i2) &&
_1(i3) && _0(i5) &&
_1(i6) && _1(i7) && _0(i8)) index = 13;
if(_1(i0) && _1(i1) && _1(i2) &&
_1(i3) && _1(i5) &&
_0(i6) && _0(i7) && _0(i8)) index = 23;
/////////////////
if(_A(i0) && _0(i1) && _A(i2) &&
_0(i3) && _0(i5) &&
_A(i6) && _1(i7) && _A(i8)) index = 3;
if(_A(i0) && _1(i1) && _A(i2) &&
_0(i3) && _0(i5) &&
_A(i6) && _1(i7) && _A(i8)) index = 14;
if(_A(i0) && _1(i1) && _A(i2) &&
_0(i3) && _0(i5) &&
_A(i6) && _0(i7) && _A(i8)) index = 25;
/////////////////
if(_A(i0) && _0(i1) && _A(i2) &&
_0(i3) && _1(i5) &&
_A(i6) && _0(i7) && _A(i8)) index = 33;
if(_A(i0) && _0(i1) && _A(i2) &&
_1(i3) && _1(i5) &&
_A(i6) && _0(i7) && _A(i8)) index = 34;
if(_A(i0) && _0(i1) && _A(i2) &&
_1(i3) && _0(i5) &&
_A(i6) && _0(i7) && _A(i8)) index = 35;
/////////////////
if(_A(i0) && _0(i1) && _A(i2) &&
_0(i3) && _0(i5) &&
_A(i6) && _0(i7) && _A(i8)) index = 36;
/////////////////
if(_A(i0) && _0(i1) && _A(i2) &&
_0(i3) && _1(i5) &&
_A(i6) && _1(i7) && _0(i8)) index = 4;
if(_A(i0) && _0(i1) && _A(i2) &&
_1(i3) && _0(i5) &&
_0(i6) && _1(i7) && _A(i8)) index = 7;
if(_A(i0) && _1(i1) && _0(i2) &&
_0(i3) && _1(i5) &&
_A(i6) && _0(i7) && _A(i8)) index = 37;
if(_0(i0) && _1(i1) && _A(i2) &&
_1(i3) && _0(i5) &&
_A(i6) && _0(i7) && _A(i8)) index = 40;
/////////////////
if(_A(i0) && _0(i1) && _A(i2) &&
_1(i3) && _1(i5) &&
_1(i6) && _1(i7) && _0(i8)) index = 5;
if(_A(i0) && _0(i1) && _A(i2) &&
_1(i3) && _1(i5) &&
_0(i6) && _1(i7) && _1(i8)) index = 6;
if(_A(i0) && _1(i1) && _1(i2) &&
_0(i3) && _1(i5) &&
_A(i6) && _1(i7) && _0(i8)) index = 15;
if(_A(i0) && _1(i1) && _0(i2) &&
_0(i3) && _1(i5) &&
_A(i6) && _1(i7) && _1(i8)) index = 26;
if(_1(i0) && _1(i1) && _A(i2) &&
_1(i3) && _0(i5) &&
_0(i6) && _1(i7) && _A(i8)) index = 18;
if(_0(i0) && _1(i1) && _A(i2) &&
_1(i3) && _0(i5) &&
_1(i6) && _1(i7) && _A(i8)) index = 29;
if(_1(i0) && _1(i1) && _0(i2) &&
_1(i3) && _1(i5) &&
_A(i6) && _0(i7) && _A(i8)) index = 38;
if(_0(i0) && _1(i1) && _1(i2) &&
_1(i3) && _1(i5) &&
_A(i6) && _0(i7) && _A(i8)) index = 39;
/////////////////
if(_1(i0) && _1(i1) && _1(i2) &&
_1(i3) && _1(i5) &&
_1(i6) && _1(i7) && _0(i8)) index = 16;
if(_1(i0) && _1(i1) && _1(i2) &&
_1(i3) && _1(i5) &&
_0(i6) && _1(i7) && _1(i8)) index = 17;
if(_1(i0) && _1(i1) && _0(i2) &&
_1(i3) && _1(i5) &&
_1(i6) && _1(i7) && _1(i8)) index = 27;
if(_0(i0) && _1(i1) && _1(i2) &&
_1(i3) && _1(i5) &&
_1(i6) && _1(i7) && _1(i8)) index = 28;
/////////////////
if(_A(i0) && _1(i1) && _0(i2) &&
_0(i3) && _1(i5) &&
_A(i6) && _1(i7) && _0(i8)) index = 48;
if(_1(i0) && _1(i1) && _0(i2) &&
_1(i3) && _1(i5) &&
_1(i6) && _1(i7) && _0(i8)) index = 49;
if(_0(i0) && _1(i1) && _A(i2) &&
_1(i3) && _0(i5) &&
_0(i6) && _0(i7) && _A(i8)) index = 50;
if(_0(i0) && _1(i1) && _1(i2) &&
_1(i3) && _1(i5) &&
_0(i6) && _0(i7) && _1(i8)) index = 51;
/////////////////
if(_A(i0) && _0(i1) && _A(i2) &&
_1(i3) && _1(i5) &&
_0(i6) && _1(i7) && _0(i8)) index = 8;
if(_1(i0) && _1(i1) && _1(i2) &&
_1(i3) && _1(i5) &&
_0(i6) && _1(i7) && _0(i8)) index = 8;
if(_0(i0) && _1(i1) && _0(i2) &&
_1(i3) && _1(i5) &&
_1(i6) && _1(i7) && _1(i8)) index = 30;
if(_0(i0) && _1(i1) && _0(i2) &&
_1(i3) && _1(i5) &&
_0(i6) && _0(i7) && _0(i8)) index = 41;
/////////////////
if(_1(i0) && _1(i1) && _0(i2) &&
_1(i3) && _1(i5) &&
_0(i6) && _1(i7) && _1(i8)) index = 9;
if(_0(i0) && _1(i1) && _1(i2) &&
_1(i3) && _1(i5) &&
_1(i6) && _1(i7) && _0(i8)) index = 20;
/////////////////
if(_0(i0) && _1(i1) && _0(i2) &&
_1(i3) && _1(i5) &&
_0(i6) && _1(i7) && _1(i8)) index = 31;
if(_0(i0) && _1(i1) && _0(i2) &&
_1(i3) && _1(i5) &&
_1(i6) && _1(i7) && _0(i8)) index = 32;
if(_0(i0) && _1(i1) && _1(i2) &&
_1(i3) && _1(i5) &&
_0(i6) && _1(i7) && _0(i8)) index = 42;
if(_1(i0) && _1(i1) && _0(i2) &&
_1(i3) && _1(i5) &&
_0(i6) && _1(i7) && _0(i8)) index = 43;
/////////////////
if(_0(i0) && _1(i1) && _0(i2) &&
_1(i3) && _1(i5) &&
_0(i6) && _1(i7) && _0(i8)) index = 52;
}
float res = float(indexes[index]);
gl_FragColor = vec4(res + 1., 0., 0., 0.);
}