Reflective planet water
This commit is contained in:
@@ -133,6 +133,7 @@ public class Blocks implements ContentList{
|
||||
statusDuration = 120f;
|
||||
drownTime = 140f;
|
||||
cacheLayer = CacheLayer.water;
|
||||
albedo = 0.5f;
|
||||
}};
|
||||
|
||||
water = new Floor("water"){{
|
||||
@@ -143,6 +144,7 @@ public class Blocks implements ContentList{
|
||||
liquidDrop = Liquids.water;
|
||||
isLiquid = true;
|
||||
cacheLayer = CacheLayer.water;
|
||||
albedo = 0.5f;
|
||||
}};
|
||||
|
||||
taintedWater = new Floor("tainted-water"){{
|
||||
@@ -154,6 +156,7 @@ public class Blocks implements ContentList{
|
||||
liquidDrop = Liquids.water;
|
||||
isLiquid = true;
|
||||
cacheLayer = CacheLayer.water;
|
||||
albedo = 0.5f;
|
||||
}};
|
||||
|
||||
darksandTaintedWater = new Floor("darksand-tainted-water"){{
|
||||
@@ -164,6 +167,7 @@ public class Blocks implements ContentList{
|
||||
liquidDrop = Liquids.water;
|
||||
isLiquid = true;
|
||||
cacheLayer = CacheLayer.water;
|
||||
albedo = 0.5f;
|
||||
}};
|
||||
|
||||
sandWater = new Floor("sand-water"){{
|
||||
@@ -174,6 +178,7 @@ public class Blocks implements ContentList{
|
||||
liquidDrop = Liquids.water;
|
||||
isLiquid = true;
|
||||
cacheLayer = CacheLayer.water;
|
||||
albedo = 0.5f;
|
||||
}};
|
||||
|
||||
darksandWater = new Floor("darksand-water"){{
|
||||
@@ -184,6 +189,7 @@ public class Blocks implements ContentList{
|
||||
liquidDrop = Liquids.water;
|
||||
isLiquid = true;
|
||||
cacheLayer = CacheLayer.water;
|
||||
albedo = 0.5f;
|
||||
}};
|
||||
|
||||
tar = new Floor("tar"){{
|
||||
|
||||
@@ -80,6 +80,7 @@ public class Shaders{
|
||||
public static class PlanetShader extends LoadShader{
|
||||
public Vec3 lightDir = new Vec3(1, 1, 1).nor();
|
||||
public Color ambientColor = Color.white.cpy();
|
||||
public Vec3 camDir = new Vec3();
|
||||
|
||||
public PlanetShader(){
|
||||
super("planet", "planet");
|
||||
@@ -89,6 +90,7 @@ public class Shaders{
|
||||
public void apply(){
|
||||
setUniformf("u_lightdir", lightDir);
|
||||
setUniformf("u_ambientColor", ambientColor.r, ambientColor.g, ambientColor.b);
|
||||
setUniformf("u_camdir", camDir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,8 +60,7 @@ public class TODOPlanetGenerator extends PlanetGenerator{
|
||||
Block block = getBlock(position);
|
||||
//replace salt with sand color
|
||||
if(block == Blocks.salt) return Blocks.sand.mapColor;
|
||||
//return block.asFloor().isLiquid ? Tmp.c1.set(block.mapColor).a(0.5f) : block.mapColor;
|
||||
return block.mapColor;
|
||||
return Tmp.c1.set(block.mapColor).a(1f - block.albedo);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -177,6 +177,9 @@ public class PlanetDialog extends FloatingDialog{
|
||||
cam.lookAt(planet.position);
|
||||
cam.update();
|
||||
|
||||
//TODO hacky
|
||||
Shaders.planet.camDir.set(cam.direction).rotate(Vec3.Y, planet.getRotation());
|
||||
|
||||
projector.proj(cam.combined());
|
||||
batch.proj(cam.combined());
|
||||
|
||||
|
||||
@@ -129,6 +129,8 @@ public class Block extends UnlockableContent{
|
||||
public boolean hasShadow = true;
|
||||
/** Sounds made when this block breaks.*/
|
||||
public Sound breakSound = Sounds.boom;
|
||||
/** How reflective this block is. */
|
||||
public float albedo = 0f;
|
||||
|
||||
/** The sound that this block makes while active. One sound loop. Do not overuse.*/
|
||||
public Sound activeSound = Sounds.none;
|
||||
|
||||
Reference in New Issue
Block a user