Added rain, better snow implementation

This commit is contained in:
Anuken
2020-05-08 16:13:49 -04:00
parent cda3c3743b
commit bcec6261d1
6 changed files with 94 additions and 24 deletions

View File

@@ -31,7 +31,7 @@ public class Renderer implements ApplicationListener{
private Color clearColor = new Color(0f, 0f, 0f, 1f);
private float targetscale = Scl.scl(4);
private float camerascale = targetscale;
private float landscale = 0f, landTime;
private float landscale = 0f, landTime, weatherAlpha;
private float minZoomScl = Scl.scl(0.01f);
private float shakeIntensity, shaketime;
@@ -64,6 +64,9 @@ public class Renderer implements ApplicationListener{
landTime -= Time.delta();
landscale = Interpolation.pow5In.apply(minZoomScl, Scl.scl(4f), 1f - landTime / Fx.coreLand.lifetime);
camerascale = landscale;
weatherAlpha = 0f;
}else{
weatherAlpha = Mathf.lerpDelta(weatherAlpha, 1f, 0.08f);
}
camera.width = graphics.getWidth() / camerascale;
@@ -82,6 +85,10 @@ public class Renderer implements ApplicationListener{
}
}
public float weatherAlpha(){
return weatherAlpha;
}
public float landScale(){
return landTime > 0 ? landscale : 1f;
}
@@ -287,7 +294,11 @@ public class Renderer implements ApplicationListener{
public void clampScale(){
float s = Scl.scl(1f);
targetscale = Mathf.clamp(targetscale, s * 1.5f, Math.round(s * 6));
targetscale = Mathf.clamp(targetscale, minScale(), Math.round(s * 6));
}
public float minScale(){
return Scl.scl(1.5f);
}
public float getScale(){