+static void render_tile( v2i pos, struct cell *ptr, v4f const regular_colour, v4f const selected_colour )
+{
+ int selected = world.selected == pos[1]*world.w + pos[0];
+
+ int tile_offsets[][2] =
+ {
+ {2, 0}, {0, 3}, {0, 2}, {2, 2},
+ {1, 0}, {2, 3}, {3, 2}, {1, 3},
+ {3, 1}, {0, 1}, {1, 2}, {2, 1},
+ {1, 1}, {3, 3}, {2, 1}, {2, 1}
+ };
+
+ int uv[2];
+
+ uv[0] = tile_offsets[ ptr->config ][0];
+ uv[1] = tile_offsets[ ptr->config ][1];
+
+ glUniform4f( SHADER_UNIFORM( shader_tile_main, "uOffset" ),
+ (float)pos[0],
+ (float)pos[1],
+ uv[0],
+ uv[1]
+ );
+
+ if( selected )
+ {
+ glUniform4fv( SHADER_UNIFORM( shader_tile_main, "uColour" ), 1, selected_colour );
+ draw_mesh( 0, 2 );
+ glUniform4fv( SHADER_UNIFORM( shader_tile_main, "uColour" ), 1, regular_colour );
+ }
+ else
+ draw_mesh( 0, 2 );
+}
+
+// Renders specific chunk of tiles
+static void render_tile_block( v2i start, v2i end, v4f const regular_colour, v4f const selected_colour )