New water textures

This commit is contained in:
Anuken
2020-04-04 00:31:29 -04:00
parent 54a2bf1ba8
commit 85e4270536
15 changed files with 590 additions and 453 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 239 B

After

Width:  |  Height:  |  Size: 291 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 239 B

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 240 B

After

Width:  |  Height:  |  Size: 291 B

+1 -1
View File
@@ -12,7 +12,7 @@ uniform float time;
varying vec4 v_color; varying vec4 v_color;
varying vec2 v_texCoord; varying vec2 v_texCoord;
void main() { void main(){
vec2 c = v_texCoord.xy; vec2 c = v_texCoord.xy;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 736 B

After

Width:  |  Height:  |  Size: 736 B

File diff suppressed because it is too large Load Diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 691 KiB

After

Width:  |  Height:  |  Size: 690 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 284 KiB

After

Width:  |  Height:  |  Size: 285 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 224 KiB

After

Width:  |  Height:  |  Size: 228 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 867 KiB

After

Width:  |  Height:  |  Size: 864 KiB

+18 -33
View File
@@ -159,39 +159,6 @@ public class Blocks implements ContentList{
albedo = 0.5f; albedo = 0.5f;
}}; }};
darksandTaintedWater = new Floor("darksand-tainted-water"){{
speedMultiplier = 0.75f;
variants = 0;
status = StatusEffects.wet;
statusDuration = 60f;
liquidDrop = Liquids.water;
isLiquid = true;
cacheLayer = CacheLayer.water;
albedo = 0.5f;
}};
sandWater = new Floor("sand-water"){{
speedMultiplier = 0.8f;
variants = 0;
status = StatusEffects.wet;
statusDuration = 50f;
liquidDrop = Liquids.water;
isLiquid = true;
cacheLayer = CacheLayer.water;
albedo = 0.5f;
}};
darksandWater = new Floor("darksand-water"){{
speedMultiplier = 0.8f;
variants = 0;
status = StatusEffects.wet;
statusDuration = 50f;
liquidDrop = Liquids.water;
isLiquid = true;
cacheLayer = CacheLayer.water;
albedo = 0.5f;
}};
tar = new Floor("tar"){{ tar = new Floor("tar"){{
drownTime = 150f; drownTime = 150f;
status = StatusEffects.tarred; status = StatusEffects.tarred;
@@ -254,6 +221,24 @@ public class Blocks implements ContentList{
playerUnmineable = true; playerUnmineable = true;
}}; }};
darksandTaintedWater = new ShallowLiquid("darksand-tainted-water", Blocks.taintedWater, Blocks.darksand){{
speedMultiplier = 0.75f;
statusDuration = 60f;
albedo = 0.5f;
}};
sandWater = new ShallowLiquid("sand-water", Blocks.water, Blocks.sand){{
speedMultiplier = 0.8f;
statusDuration = 50f;
albedo = 0.5f;
}};
darksandWater = new ShallowLiquid("darksand-water", Blocks.water, Blocks.darksand){{
speedMultiplier = 0.8f;
statusDuration = 50f;
albedo = 0.5f;
}};
holostone = new Floor("holostone"){{ holostone = new Floor("holostone"){{
}}; }};
@@ -231,7 +231,9 @@ public class Floor extends Block{
} }
protected boolean doEdge(Floor other, boolean sameLayer){ protected boolean doEdge(Floor other, boolean sameLayer){
return (other.blendGroup.id > blendGroup.id || edges() == null) && other.edgeOnto(this) && (other.cacheLayer.ordinal() > this.cacheLayer.ordinal() || !sameLayer); boolean dir = !((other instanceof ShallowLiquid && ((ShallowLiquid)other).floorBase == this) || (this instanceof ShallowLiquid && ((ShallowLiquid)this).floorBase == other));
return ((other.blendGroup.id > blendGroup.id == dir) || edges() == null) &&
other.edgeOnto(this) && (other.cacheLayer.ordinal() > this.cacheLayer.ordinal() || !sameLayer);
} }
protected boolean edgeOnto(Floor other){ protected boolean edgeOnto(Floor other){
@@ -0,0 +1,21 @@
package mindustry.world.blocks.environment;
import mindustry.world.*;
//do not use in mods!
public class ShallowLiquid extends Floor{
public final Floor liquidBase, floorBase;
public ShallowLiquid(String name, Block liquid, Block floor){
super(name);
this.liquidBase = liquid.asFloor();
this.floorBase = floor.asFloor();
isLiquid = true;
variants = floor.asFloor().variants;
status = liquid.asFloor().status;
liquidDrop = liquid.asFloor().liquidDrop;
cacheLayer = liquid.asFloor().cacheLayer;
}
}
+25 -1
View File
@@ -21,6 +21,7 @@ import static mindustry.Vars.*;
public class Generators{ public class Generators{
public static void generate(){ public static void generate(){
ObjectMap<Block, Image> gens = new ObjectMap<>();
ImagePacker.generate("cracks", () -> { ImagePacker.generate("cracks", () -> {
RidgedPerlin r = new RidgedPerlin(1, 3); RidgedPerlin r = new RidgedPerlin(1, 3);
@@ -170,6 +171,29 @@ public class Generators{
colors.save("../../../assets/sprites/block_colors"); colors.save("../../../assets/sprites/block_colors");
}); });
ImagePacker.generate("shallows", () -> {
content.blocks().<ShallowLiquid>each(b -> b instanceof ShallowLiquid, floor -> {
Image overlay = ImagePacker.get(floor.liquidBase.region);
int index = 0;
for(TextureRegion region : floor.floorBase.variantRegions()){
Image res = new Image(32, 32);
res.draw(ImagePacker.get(region));
for(int x = 0; x < res.width; x++){
for(int y = 0; y < res.height; y++){
Color color = overlay.getColor(x, y).a(0.3f);
res.draw(x, y, color);
}
}
String name = floor.name + "" + (++index);
res.save("../blocks/environment/" + name);
res.save("../editor/editor-" + name);
gens.put(floor, res);
}
});
});
ImagePacker.generate("item-icons", () -> { ImagePacker.generate("item-icons", () -> {
for(UnlockableContent item : (Array<? extends UnlockableContent>)(Array)Array.withArrays(content.items(), content.liquids())){ for(UnlockableContent item : (Array<? extends UnlockableContent>)(Array)Array.withArrays(content.items(), content.liquids())){
Image base = ImagePacker.get(item.getContentType().name() + "-" + item.name); Image base = ImagePacker.get(item.getContentType().name() + "-" + item.name);
@@ -261,7 +285,7 @@ public class Generators{
} }
try{ try{
Image image = ImagePacker.get(floor.generateIcons()[0]); Image image = gens.get(floor, ImagePacker.get(floor.generateIcons()[0]));
Image edge = ImagePacker.get("edge-stencil"); Image edge = ImagePacker.get("edge-stencil");
Image result = new Image(edge.width, edge.height); Image result = new Image(edge.width, edge.height);