Commit 5ae6b730 authored by Andrey Filippov's avatar Andrey Filippov

Refactored texture processing steps

parent 0b00f0ae
...@@ -391,6 +391,25 @@ public class TileNeibs{ ...@@ -391,6 +391,25 @@ public class TileNeibs{
for (int i = 0; i < tiles.length; i++) tiles[i] = !itiles[i]; for (int i = 0; i < tiles.length; i++) tiles[i] = !itiles[i];
} }
public boolean [] getEdgeSelection(
int shrink, // grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
boolean [] tiles,
boolean [] prohibit)
{
boolean [] etiles = new boolean [tiles.length];
for (int i = 0; i < tiles.length; i++) etiles[i] = !tiles[i];
growSelection(
shrink, // grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
etiles,
prohibit);
for (int i = 0; i < tiles.length; i++) etiles[i] &= tiles[i];
return etiles;
}
public void growSelection( public void growSelection(
int grow, // grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more int grow, // grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
boolean [] tiles, boolean [] tiles,
...@@ -630,7 +649,7 @@ public class TileNeibs{ ...@@ -630,7 +649,7 @@ public class TileNeibs{
} }
return enum_clust_ordered; return enum_clust_ordered;
} }
public int getMax( public static int getMax(
int [] data) int [] data)
{ {
int mx = data[0]; int mx = data[0];
......
...@@ -5662,7 +5662,7 @@ public class TilePlanes { ...@@ -5662,7 +5662,7 @@ public class TilePlanes {
grown_sel, // boolean [] tiles, grown_sel, // boolean [] tiles,
false); // boolean ordered) false); // boolean ordered)
int num_clusters = tileNeibs.getMax( int num_clusters = TileNeibs.getMax(
clusters); // int [] data) clusters); // int [] data)
if (num_clusters > 1){ if (num_clusters > 1){
boolean [] dbg_grown_sel =grown_sel.clone(); boolean [] dbg_grown_sel =grown_sel.clone();
...@@ -5699,7 +5699,7 @@ public class TilePlanes { ...@@ -5699,7 +5699,7 @@ public class TilePlanes {
clusters = tileNeibs.enumerateClusters( clusters = tileNeibs.enumerateClusters(
grown_sel, // boolean [] tiles, grown_sel, // boolean [] tiles,
false); // boolean ordered) false); // boolean ordered)
num_clusters = tileNeibs.getMax( num_clusters = TileNeibs.getMax(
clusters); clusters);
if (num_clusters > 1){ if (num_clusters > 1){
boolean [][] cluster_sels = new boolean [num_clusters][selections[np].length]; boolean [][] cluster_sels = new boolean [num_clusters][selections[np].length];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment