ParticleEffect#sizeInterp / Log usable RAM
This commit is contained in:
@@ -56,6 +56,9 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform
|
|||||||
Log.info("[GL] Using @ context.", gl30 != null ? "OpenGL 3" : "OpenGL 2");
|
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.");
|
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);
|
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(() -> {
|
Time.setDeltaProvider(() -> {
|
||||||
float result = Core.graphics.getDeltaTime() * 60f;
|
float result = Core.graphics.getDeltaTime() * 60f;
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ public class ParticleEffect extends Effect{
|
|||||||
public float cone = 180f, length = 20f, baseLength = 0f;
|
public float cone = 180f, length = 20f, baseLength = 0f;
|
||||||
/** Particle size/length/radius interpolation. */
|
/** Particle size/length/radius interpolation. */
|
||||||
public Interp interp = Interp.linear;
|
public Interp interp = Interp.linear;
|
||||||
|
/** Particle size interpolation. Null to use interp. */
|
||||||
|
public @Nullable Interp sizeInterp = null;
|
||||||
public float offsetX, offsetY;
|
public float offsetX, offsetY;
|
||||||
public float lightScl = 2f, lightOpacity = 0.6f;
|
public float lightScl = 2f, lightOpacity = 0.6f;
|
||||||
public @Nullable Color lightColor;
|
public @Nullable Color lightColor;
|
||||||
@@ -44,6 +46,7 @@ public class ParticleEffect extends Effect{
|
|||||||
@Override
|
@Override
|
||||||
public void init(){
|
public void init(){
|
||||||
clip = Math.max(clip, length + Math.max(sizeFrom, sizeTo));
|
clip = Math.max(clip, length + Math.max(sizeFrom, sizeTo));
|
||||||
|
if(sizeInterp == null) sizeInterp = interp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -52,15 +55,15 @@ public class ParticleEffect extends Effect{
|
|||||||
|
|
||||||
float rawfin = e.fin();
|
float rawfin = e.fin();
|
||||||
float fin = e.fin(interp);
|
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);
|
float ox = e.x + Angles.trnsx(e.rotation, offsetX, offsetY), oy = e.y + Angles.trnsy(e.rotation, offsetX, offsetY);
|
||||||
|
|
||||||
Draw.color(colorFrom, colorTo, fin);
|
Draw.color(colorFrom, colorTo, fin);
|
||||||
Color lightColor = this.lightColor == null ? Draw.getColor() : this.lightColor;
|
Color lightColor = this.lightColor == null ? Draw.getColor() : this.lightColor;
|
||||||
|
|
||||||
if(line){
|
if(line){
|
||||||
Lines.stroke(interp.apply(strokeFrom, strokeTo, rawfin));
|
Lines.stroke(sizeInterp.apply(strokeFrom, strokeTo, rawfin));
|
||||||
float len = interp.apply(lenFrom, lenTo, rawfin);
|
float len = sizeInterp.apply(lenFrom, lenTo, rawfin);
|
||||||
|
|
||||||
rand.setSeed(e.id);
|
rand.setSeed(e.id);
|
||||||
for(int i = 0; i < particles; i++){
|
for(int i = 0; i < particles; i++){
|
||||||
|
|||||||
@@ -273,6 +273,7 @@ public class Turret extends ReloadTurret{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(hasAmmo()){
|
if(hasAmmo()){
|
||||||
|
if(Float.isNaN(reload)) rotation = 0;
|
||||||
|
|
||||||
if(timer(timerTarget, targetInterval)){
|
if(timer(timerTarget, targetInterval)){
|
||||||
findTarget();
|
findTarget();
|
||||||
@@ -289,9 +290,7 @@ public class Turret extends ReloadTurret{
|
|||||||
}else{ //default AI behavior
|
}else{ //default AI behavior
|
||||||
targetPosition(target);
|
targetPosition(target);
|
||||||
|
|
||||||
if(Float.isNaN(rotation)){
|
if(Float.isNaN(rotation)) rotation = 0;
|
||||||
rotation = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float targetRot = angleTo(targetPos);
|
float targetRot = angleTo(targetPos);
|
||||||
|
|||||||
Reference in New Issue
Block a user