This commit is contained in:
Anuken
2020-10-08 14:06:07 -04:00
parent e05ac5ae41
commit d06449f311
18 changed files with 3555 additions and 3359 deletions

View File

@@ -35,7 +35,7 @@ public class Blocks implements ContentList{
public static Block
//environment
air, spawn, cliff, deepwater, water, taintedWater, tar, slag, stone, craters, charr, sand, darksand, dirt, mud, ice, snow, darksandTaintedWater,
air, spawn, cliff, deepwater, water, taintedWater, tar, slag, stone, craters, charr, sand, darksand, dirt, mud, ice, snow, darksandTaintedWater, space,
dacite, stoneWall, dirtWall, sporeWall, iceWall, daciteWall, sporePine, snowPine, pine, shrubs, whiteTree, whiteTreeDead, sporeCluster,
iceSnow, sandWater, darksandWater, duneWall, sandWall, moss, sporeMoss, shale, shaleWall, shaleBoulder, sandBoulder, daciteBoulder, grass, salt,
metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor5, basalt, magmarock, hotrock, snowWall, boulder, snowBoulder, saltWall,
@@ -216,6 +216,13 @@ public class Blocks implements ContentList{
lightColor = Color.orange.cpy().a(0.38f);
}};
space = new Floor("space"){{
cacheLayer = CacheLayer.space;
placeableOn = false;
solid = true;
variants = 0;
}};
stone = new Floor("stone");
craters = new Floor("craters"){{

View File

@@ -51,6 +51,17 @@ public enum CacheLayer{
endShader(Shaders.slag);
}
},
space{
@Override
public void begin(){
beginShader();
}
@Override
public void end(){
endShader(Shaders.space);
}
},
normal(5),
walls(3);

View File

@@ -19,7 +19,7 @@ public class Shaders{
public static UnitBuild build;
public static DarknessShader darkness;
public static LightShader light;
public static SurfaceShader water, mud, tar, slag;
public static SurfaceShader water, mud, tar, slag, space;
public static PlanetShader planet;
public static PlanetGridShader planetGrid;
public static AtmosphereShader atmosphere;
@@ -44,6 +44,7 @@ public class Shaders{
mud = new SurfaceShader("mud");
tar = new SurfaceShader("tar");
slag = new SurfaceShader("slag");
space = new SpaceShader("space");
planet = new PlanetShader();
planetGrid = new PlanetGridShader();
atmosphere = new AtmosphereShader();
@@ -196,6 +197,33 @@ public class Shaders{
}
}
public static class SpaceShader extends SurfaceShader{
Texture texture;
public SpaceShader(String frag){
super(frag);
Core.assets.load("cubemaps/stars/bottom.png", Texture.class).loaded = t -> {
texture = (Texture)t;
texture.setFilter(TextureFilter.linear);
texture.setWrap(TextureWrap.mirroredRepeat);
};
}
@Override
public void apply(){
setUniformf("u_campos", Core.camera.position.x - Core.camera.width / 2, Core.camera.position.y - Core.camera.height / 2);
setUniformf("u_ccampos", Core.camera.position);
setUniformf("u_resolution", Core.camera.width, Core.camera.height);
setUniformf("u_time", Time.time());
texture.bind(1);
renderer.effectBuffer.getTexture().bind(0);
setUniformi("u_stars", 1);
}
}
public static class SurfaceShader extends LoadShader{
public SurfaceShader(String frag){

View File

@@ -346,7 +346,7 @@ public class Tile implements Position, QuadTreeObject, Displayable{
}
public boolean solid(){
return block.solid || (build != null && build.checkSolid());
return block.solid || floor.solid || (build != null && build.checkSolid());
}
public boolean breakable(){