Fixed distort artifacts
This commit is contained in:
@@ -615,6 +615,7 @@ public class World{
|
|||||||
GenerateInput input = new GenerateInput();
|
GenerateInput input = new GenerateInput();
|
||||||
|
|
||||||
for(GenerateFilter filter : filters){
|
for(GenerateFilter filter : filters){
|
||||||
|
filter.randomize();
|
||||||
input.begin(filter, width(), height(), (x, y) -> tiles.getn(x, y));
|
input.begin(filter, width(), height(), (x, y) -> tiles.getn(x, y));
|
||||||
filter.apply(tiles, input);
|
filter.apply(tiles, input);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,24 +23,27 @@ public abstract class GenerateFilter{
|
|||||||
//buffer of tiles used, each tile packed into a long struct
|
//buffer of tiles used, each tile packed into a long struct
|
||||||
long[] buffer = new long[tiles.width * tiles.height];
|
long[] buffer = new long[tiles.width * tiles.height];
|
||||||
|
|
||||||
//save to buffer
|
|
||||||
for(int i = 0; i < tiles.width * tiles.height; i++){
|
for(int i = 0; i < tiles.width * tiles.height; i++){
|
||||||
Tile tile = tiles.geti(i);
|
Tile tile = tiles.geti(i);
|
||||||
buffer[i] = PackTile.get(tile.blockID(), tile.floorID(), tile.overlayID());
|
|
||||||
|
in.apply(tile.x, tile.y, tile.block(), tile.floor(), tile.overlay());
|
||||||
|
apply();
|
||||||
|
|
||||||
|
buffer[i] = PackTile.get(in.block.id, in.floor.id, in.overlay.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//write to buffer
|
||||||
for(int i = 0; i < tiles.width * tiles.height; i++){
|
for(int i = 0; i < tiles.width * tiles.height; i++){
|
||||||
Tile tile = tiles.geti(i);
|
Tile tile = tiles.geti(i);
|
||||||
long b = buffer[i];
|
long b = buffer[i];
|
||||||
|
|
||||||
in.apply(tile.x, tile.y, Vars.content.block(PackTile.block(b)), Vars.content.block(PackTile.floor(b)), Vars.content.block(PackTile.overlay(b)));
|
Block block = Vars.content.block(PackTile.block(b)), floor = Vars.content.block(PackTile.floor(b)), overlay = Vars.content.block(PackTile.overlay(b));
|
||||||
apply();
|
|
||||||
|
|
||||||
tile.setFloor(in.floor.asFloor());
|
tile.setFloor(floor.asFloor());
|
||||||
tile.setOverlay(!in.floor.asFloor().hasSurface() && in.overlay.asFloor().needsSurface ? Blocks.air : in.overlay);
|
tile.setOverlay(!floor.asFloor().hasSurface() && overlay.asFloor().needsSurface ? Blocks.air : overlay);
|
||||||
|
|
||||||
if(!tile.block().synthetic() && !in.block.synthetic()){
|
if(!tile.block().synthetic() && !block.synthetic()){
|
||||||
tile.setBlock(in.block);
|
tile.setBlock(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
Reference in New Issue
Block a user