ParticleEffect#sizeInterp / Log usable RAM

This commit is contained in:
Anuken
2021-09-07 22:32:27 -04:00
parent 8adefb7b72
commit dd7062f0f7
3 changed files with 11 additions and 6 deletions

View File

@@ -56,6 +56,9 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform
Log.info("[GL] Using @ context.", gl30 != null ? "OpenGL 3" : "OpenGL 2");
if(maxTextureSize < 4096) Log.warn("[GL] Your maximum texture size is below the recommended minimum of 4096. This will cause severe performance issues.");
Log.info("[JAVA] Version: @", OS.javaVersion);
long ram = Runtime.getRuntime().maxMemory();
boolean gb = ram >= 1024 * 1024 * 1024;
Log.info("[RAM] Available: @ @", Strings.fixed(gb ? ram / 1024f / 1024 / 1024f : ram / 1024f / 1024f, 1), gb ? "GB" : "MB");
Time.setDeltaProvider(() -> {
float result = Core.graphics.getDeltaTime() * 60f;

View File

@@ -20,6 +20,8 @@ public class ParticleEffect extends Effect{
public float cone = 180f, length = 20f, baseLength = 0f;
/** Particle size/length/radius interpolation. */
public Interp interp = Interp.linear;
/** Particle size interpolation. Null to use interp. */
public @Nullable Interp sizeInterp = null;
public float offsetX, offsetY;
public float lightScl = 2f, lightOpacity = 0.6f;
public @Nullable Color lightColor;
@@ -44,6 +46,7 @@ public class ParticleEffect extends Effect{
@Override
public void init(){
clip = Math.max(clip, length + Math.max(sizeFrom, sizeTo));
if(sizeInterp == null) sizeInterp = interp;
}
@Override
@@ -52,15 +55,15 @@ public class ParticleEffect extends Effect{
float rawfin = e.fin();
float fin = e.fin(interp);
float rad = interp.apply(sizeFrom, sizeTo, rawfin) * 2;
float rad = sizeInterp.apply(sizeFrom, sizeTo, rawfin) * 2;
float ox = e.x + Angles.trnsx(e.rotation, offsetX, offsetY), oy = e.y + Angles.trnsy(e.rotation, offsetX, offsetY);
Draw.color(colorFrom, colorTo, fin);
Color lightColor = this.lightColor == null ? Draw.getColor() : this.lightColor;
if(line){
Lines.stroke(interp.apply(strokeFrom, strokeTo, rawfin));
float len = interp.apply(lenFrom, lenTo, rawfin);
Lines.stroke(sizeInterp.apply(strokeFrom, strokeTo, rawfin));
float len = sizeInterp.apply(lenFrom, lenTo, rawfin);
rand.setSeed(e.id);
for(int i = 0; i < particles; i++){

View File

@@ -273,6 +273,7 @@ public class Turret extends ReloadTurret{
}
if(hasAmmo()){
if(Float.isNaN(reload)) rotation = 0;
if(timer(timerTarget, targetInterval)){
findTarget();
@@ -289,9 +290,7 @@ public class Turret extends ReloadTurret{
}else{ //default AI behavior
targetPosition(target);
if(Float.isNaN(rotation)){
rotation = 0;
}
if(Float.isNaN(rotation)) rotation = 0;
}
float targetRot = angleTo(targetPos);