mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2025-02-17 21:11:26 +01:00
Finish mixed biome/block coloring
This commit is contained in:
parent
96f9452608
commit
cc3a3f159f
@ -275,7 +275,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements Extent {
|
|||||||
BaseBlock block = textureUtil.getNearestBlock(color);
|
BaseBlock block = textureUtil.getNearestBlock(color);
|
||||||
TextureUtil.BiomeColor biome = textureUtil.getNearestBiome(color);
|
TextureUtil.BiomeColor biome = textureUtil.getNearestBiome(color);
|
||||||
int blockColor = textureUtil.getColor(block);
|
int blockColor = textureUtil.getColor(block);
|
||||||
if (textureUtil.colorDistance(biome.grass, color) < textureUtil.colorDistance(blockColor, color)) {
|
if (textureUtil.colorDistance(biome.grass, color) <= textureUtil.colorDistance(blockColor, color)) {
|
||||||
byte biomeByte = (byte) biome.id;
|
byte biomeByte = (byte) biome.id;
|
||||||
biomes[index] = biomeByte;
|
biomes[index] = biomeByte;
|
||||||
if (yBiome && x > 0 && x < widthIndex) {
|
if (yBiome && x > 0 && x < widthIndex) {
|
||||||
|
@ -11,6 +11,7 @@ public class CleanTextureUtil extends TextureUtil {
|
|||||||
long max = parent.distances[maxIndex];
|
long max = parent.distances[maxIndex];
|
||||||
int num = maxIndex - minIndex + 1;
|
int num = maxIndex - minIndex + 1;
|
||||||
|
|
||||||
|
this.validBiomes = parent.validBiomes;
|
||||||
this.blockColors = parent.blockColors;
|
this.blockColors = parent.blockColors;
|
||||||
this.blockDistance = parent.blockDistance;
|
this.blockDistance = parent.blockDistance;
|
||||||
this.distances = Arrays.copyOfRange(parent.blockDistance, minIndex, maxIndex + 1);
|
this.distances = Arrays.copyOfRange(parent.blockDistance, minIndex, maxIndex + 1);
|
||||||
|
@ -9,6 +9,10 @@ import org.json.simple.parser.ParseException;
|
|||||||
public class DelegateTextureUtil extends TextureUtil {
|
public class DelegateTextureUtil extends TextureUtil {
|
||||||
private final TextureUtil parent;
|
private final TextureUtil parent;
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Throwable {
|
||||||
|
TextureUtil.main(args);
|
||||||
|
}
|
||||||
|
|
||||||
public DelegateTextureUtil(TextureUtil parent) {
|
public DelegateTextureUtil(TextureUtil parent) {
|
||||||
super(parent.getFolder());
|
super(parent.getFolder());
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
@ -39,6 +43,16 @@ public class DelegateTextureUtil extends TextureUtil {
|
|||||||
return parent.getColor(block);
|
return parent.getColor(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BiomeColor getBiome(int biome) {
|
||||||
|
return parent.getBiome(biome);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BiomeColor getNearestBiome(int color) {
|
||||||
|
return parent.getNearestBiome(color);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File getFolder() {
|
public File getFolder() {
|
||||||
return parent.getFolder();
|
return parent.getFolder();
|
||||||
@ -49,11 +63,21 @@ public class DelegateTextureUtil extends TextureUtil {
|
|||||||
return parent.combineTransparency(top, bottom);
|
return parent.combineTransparency(top, bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void calculateLayerArrays() {
|
||||||
|
parent.calculateLayerArrays();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadModTextures() throws IOException, ParseException {
|
public void loadModTextures() throws IOException, ParseException {
|
||||||
parent.loadModTextures();
|
parent.loadModTextures();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int multiply(int c1, int c2) {
|
||||||
|
return parent.multiply(c1, c2);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseBlock getNearestBlock(BaseBlock block, boolean darker) {
|
public BaseBlock getNearestBlock(BaseBlock block, boolean darker) {
|
||||||
return parent.getNearestBlock(block, darker);
|
return parent.getNearestBlock(block, darker);
|
||||||
@ -79,8 +103,17 @@ public class DelegateTextureUtil extends TextureUtil {
|
|||||||
return parent.colorDistance(red1, green1, blue1, c2);
|
return parent.colorDistance(red1, green1, blue1, c2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int hueDistance(int red1, int green1, int blue1, int red2, int green2, int blue2) {
|
||||||
|
return TextureUtil.hueDistance(red1, green1, blue1, red2, green2, blue2);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getColor(BufferedImage image) {
|
public int getColor(BufferedImage image) {
|
||||||
return parent.getColor(image);
|
return parent.getColor(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getDistance(BufferedImage image, int c1) {
|
||||||
|
return parent.getDistance(image, c1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import java.util.Set;
|
|||||||
public class FilteredTextureUtil extends TextureUtil {
|
public class FilteredTextureUtil extends TextureUtil {
|
||||||
public FilteredTextureUtil(TextureUtil parent, Set<BaseBlock> blocks) {
|
public FilteredTextureUtil(TextureUtil parent, Set<BaseBlock> blocks) {
|
||||||
super(parent.getFolder());
|
super(parent.getFolder());
|
||||||
|
this.validBiomes = parent.validBiomes;
|
||||||
this.blockColors = parent.blockColors;
|
this.blockColors = parent.blockColors;
|
||||||
this.blockDistance = parent.blockDistance;
|
this.blockDistance = parent.blockDistance;
|
||||||
this.distances = parent.distances;
|
this.distances = parent.distances;
|
||||||
|
@ -52,7 +52,7 @@ public class TextureUtil {
|
|||||||
/**
|
/**
|
||||||
* https://github.com/erich666/Mineways/blob/master/Win/biomes.cpp
|
* https://github.com/erich666/Mineways/blob/master/Win/biomes.cpp
|
||||||
*/
|
*/
|
||||||
private BiomeColor[] validBiomes;
|
protected BiomeColor[] validBiomes;
|
||||||
private BiomeColor[] biomes = new BiomeColor[] {
|
private BiomeColor[] biomes = new BiomeColor[] {
|
||||||
// ID Name Temperature, rainfall, grass, foliage colors
|
// ID Name Temperature, rainfall, grass, foliage colors
|
||||||
// - note: the colors here are just placeholders, they are computed in the program
|
// - note: the colors here are just placeholders, they are computed in the program
|
||||||
@ -823,7 +823,7 @@ public class TextureUtil {
|
|||||||
int g = green1 - green2;
|
int g = green1 - green2;
|
||||||
int b = blue1 - blue2;
|
int b = blue1 - blue2;
|
||||||
int hd = hueDistance(red1, green1, blue1, red2, green2, blue2);
|
int hd = hueDistance(red1, green1, blue1, red2, green2, blue2);
|
||||||
return (((512 + rmean) * r * r) >> 8) + 4 * g * g + (((767 - rmean) * b * b) >> 8) + (hd);
|
return (((512 + rmean) * r * r) >> 8) + 4 * g * g + (((767 - rmean) * b * b) >> 8) + (hd * hd);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static int hueDistance(int red1, int green1, int blue1, int red2, int green2, int blue2) {
|
protected static int hueDistance(int red1, int green1, int blue1, int red2, int green2, int blue2) {
|
||||||
|
Loading…
Reference in New Issue
Block a user