mirror of
https://github.com/Anuken/Mindustry.git
synced 2024-11-11 14:56:10 +03:00
Light cleanup
This commit is contained in:
parent
1b2e10d355
commit
5d4ca753a7
@ -29,7 +29,7 @@ void main() {
|
||||
vec4 color = texture2D(u_texture, T);
|
||||
vec2 v = vec2(1.0/u_texsize.x, 1.0/u_texsize.y);
|
||||
|
||||
if(texture2D(u_texture, T).a < 0.2 &&
|
||||
if(texture2D(u_texture, T).a < 0.9 &&
|
||||
(texture2D(u_texture, T + vec2(0, step) * v).a > 0.0 || texture2D(u_texture, T + vec2(0, -step) * v).a > 0.0 ||
|
||||
texture2D(u_texture, T + vec2(step, 0) * v).a > 0.0 || texture2D(u_texture, T + vec2(-step, 0) * v).a > 0.0)){
|
||||
|
||||
|
@ -540,7 +540,7 @@ public class Bullets implements ContentList{
|
||||
|
||||
Tmp.v1.trns(b.rotation(), baseLen * 1.1f);
|
||||
|
||||
renderer.lights.line(b.x(), b.y(), b.x() + Tmp.v1.x, b.y() + Tmp.v1.y, 40, Color.orange, 0.7f);
|
||||
Drawf.light(b.x(), b.y(), b.x() + Tmp.v1.x, b.y() + Tmp.v1.y, 40, Color.orange, 0.7f);
|
||||
Draw.reset();
|
||||
}
|
||||
};
|
||||
|
@ -490,7 +490,7 @@ public class Fx{
|
||||
|
||||
color();
|
||||
|
||||
renderer.lights.add(e.x, e.y, 20f * e.fslope(), Pal.lightFlame, 0.5f);
|
||||
Drawf.light(e.x, e.y, 20f * e.fslope(), Pal.lightFlame, 0.5f);
|
||||
}),
|
||||
|
||||
fireSmoke = new Effect(35f, e -> {
|
||||
|
@ -9,8 +9,6 @@ import mindustry.entities.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
|
||||
import static mindustry.Vars.renderer;
|
||||
|
||||
public class LaserBulletType extends BulletType{
|
||||
protected Color[] colors = {Pal.lancerLaser.cpy().mul(1f, 1f, 1f, 0.4f), Pal.lancerLaser, Color.white};
|
||||
protected float length = 160f;
|
||||
@ -73,6 +71,6 @@ public class LaserBulletType extends BulletType{
|
||||
Draw.reset();
|
||||
|
||||
Tmp.v1.trns(b.rotation(), baseLen * 1.1f);
|
||||
renderer.lights.line(b.x(), b.y(), b.x() + Tmp.v1.x, b.y() + Tmp.v1.y, width * 1.4f * b.fout(), colors[0], 0.6f);
|
||||
Drawf.light(b.x(), b.y(), b.x() + Tmp.v1.x, b.y() + Tmp.v1.y, width * 1.4f * b.fout(), colors[0], 0.6f);
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw
|
||||
|
||||
type.draw(this);
|
||||
//TODO refactor
|
||||
renderer.lights.add(x(), y(), 16f, Pal.powerLight, 0.3f);
|
||||
Drawf.light(x(), y(), 16f, Pal.powerLight, 0.3f);
|
||||
}
|
||||
|
||||
/** Sets the bullet's rotation in degrees. */
|
||||
|
@ -5,7 +5,6 @@ import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.util.*;
|
||||
import mindustry.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.entities.*;
|
||||
@ -111,7 +110,7 @@ abstract class PuddleComp implements Posc, Puddlec{
|
||||
if(liquid.lightColor.a > 0.001f && f > 0){
|
||||
Color color = liquid.lightColor;
|
||||
float opacity = color.a * f;
|
||||
Vars.renderer.lights.add(tile.drawx(), tile.drawy(), 30f * f, color, opacity * 0.8f);
|
||||
Drawf.light(tile.drawx(), tile.drawy(), 30f * f, color, opacity * 0.8f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -644,7 +644,7 @@ abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc, QuadTree
|
||||
float fract = 1f;
|
||||
float opacity = color.a * fract;
|
||||
if(opacity > 0.001f){
|
||||
renderer.lights.add(x, y, block.size * 30f * fract, color, opacity);
|
||||
Drawf.light(x, y, block.size * 30f * fract, color, opacity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,26 @@ import static mindustry.Vars.*;
|
||||
|
||||
public class Drawf{
|
||||
|
||||
public static void light(float x, float y, float radius, Color color, float opacity){
|
||||
renderer.lights.add(x, y, radius, color, opacity);
|
||||
}
|
||||
|
||||
public static void light(Position pos, float radius, Color color, float opacity){
|
||||
light(pos.getX(), pos.getY(), radius, color, opacity);
|
||||
}
|
||||
|
||||
public static void light(float x, float y, TextureRegion region, Color color, float opacity){
|
||||
renderer.lights.add(x, y, region, color, opacity);
|
||||
}
|
||||
|
||||
public static void light(float x, float y, float x2, float y2){
|
||||
renderer.lights.line(x, y, x2, y2, 30, Color.orange, 0.3f);
|
||||
}
|
||||
|
||||
public static void light(float x, float y, float x2, float y2, float stroke, Color tint, float alpha){
|
||||
renderer.lights.line(x, y, x2, y2, stroke, tint, alpha);
|
||||
}
|
||||
|
||||
public static void selected(int x, int y, Block block, Color color){
|
||||
Draw.color(color);
|
||||
for(int i = 0; i < 4; i++){
|
||||
@ -104,7 +124,7 @@ public class Drawf{
|
||||
Lines.precise(false);
|
||||
Lines.stroke(1f);
|
||||
|
||||
renderer.lights.line(x, y, x2, y2);
|
||||
Drawf.light(x, y, x2, y2);
|
||||
}
|
||||
|
||||
public static void tri(float x, float y, float width, float length, float rotation){
|
||||
|
@ -26,10 +26,6 @@ public class LightRenderer{
|
||||
lights.add(run);
|
||||
}
|
||||
|
||||
public void add(Position pos, float radius, Color color, float opacity){
|
||||
add(pos.getX(), pos.getY(), radius, color, opacity);
|
||||
}
|
||||
|
||||
public void add(float x, float y, float radius, Color color, float opacity){
|
||||
if(!enabled()) return;
|
||||
|
||||
@ -52,10 +48,6 @@ public class LightRenderer{
|
||||
});
|
||||
}
|
||||
|
||||
public void line(float x, float y, float x2, float y2){
|
||||
line(x, y, x2, y2, 30, Color.orange, 0.3f);
|
||||
}
|
||||
|
||||
public void line(float x, float y, float x2, float y2, float stroke, Color tint, float alpha){
|
||||
if(!enabled()) return;
|
||||
|
||||
|
@ -243,7 +243,7 @@ public class UnitType extends UnlockableContent{
|
||||
|
||||
public void drawLight(Unitc unit){
|
||||
if(lightRadius > 0){
|
||||
renderer.lights.add(unit, lightRadius, lightColor, lightOpacity);
|
||||
Drawf.light(unit, lightRadius, lightColor, lightOpacity);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ public class MendProjector extends Block{
|
||||
|
||||
@Override
|
||||
public void drawLight(){
|
||||
renderer.lights.add(x, y, 50f * efficiency(), baseColor, 0.7f * efficiency());
|
||||
Drawf.light(x, y, 50f * efficiency(), baseColor, 0.7f * efficiency());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -72,7 +72,7 @@ public class OverdriveProjector extends Block{
|
||||
|
||||
@Override
|
||||
public void drawLight(){
|
||||
renderer.lights.add(x, y, 50f * efficiency(), baseColor, 0.7f * efficiency());
|
||||
Drawf.light(x, y, 50f * efficiency(), baseColor, 0.7f * efficiency());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -126,7 +126,7 @@ public class ImpactReactor extends PowerGenerator{
|
||||
@Override
|
||||
public void drawLight(){
|
||||
float fract = tile.<FusionReactorEntity>ent().warmup;
|
||||
renderer.lights.add(x, y, (110f + Mathf.absin(5, 5f)) * fract, Tmp.c1.set(plasma2).lerp(plasma1, Mathf.absin(7f, 0.2f)), 0.8f * fract);
|
||||
Drawf.light(x, y, (110f + Mathf.absin(5, 5f)) * fract, Tmp.c1.set(plasma2).lerp(plasma1, Mathf.absin(7f, 0.2f)), 0.8f * fract);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -7,6 +7,7 @@ import arc.math.*;
|
||||
import arc.util.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.consumers.*;
|
||||
import mindustry.world.meta.*;
|
||||
@ -180,7 +181,7 @@ public class ItemLiquidGenerator extends PowerGenerator{
|
||||
|
||||
@Override
|
||||
public void drawLight(){
|
||||
renderer.lights.add(x, y, (60f + Mathf.absin(10f, 5f)) * productionEfficiency * size, Color.orange, 0.5f);
|
||||
Drawf.light(x, y, (60f + Mathf.absin(10f, 5f)) * productionEfficiency * size, Color.orange, 0.5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public class LightBlock extends Block{
|
||||
|
||||
@Override
|
||||
public void drawLight(){
|
||||
renderer.lights.add(x, y, radius, Tmp.c1.set(color), brightness * efficiency());
|
||||
Drawf.light(x, y, radius, Tmp.c1.set(color), brightness * efficiency());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -149,7 +149,7 @@ public class NuclearReactor extends PowerGenerator{
|
||||
@Override
|
||||
public void drawLight(){
|
||||
float fract = productionEfficiency;
|
||||
renderer.lights.add(x, y, (90f + Mathf.absin(5, 5f)) * fract, Tmp.c1.set(lightColor).lerp(Color.scarlet, heat), 0.6f * fract);
|
||||
Drawf.light(x, y, (90f + Mathf.absin(5, 5f)) * fract, Tmp.c1.set(lightColor).lerp(Color.scarlet, heat), 0.6f * fract);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -5,11 +5,10 @@ import arc.graphics.*;
|
||||
import arc.math.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
import static mindustry.Vars.renderer;
|
||||
|
||||
public class ThermalGenerator extends PowerGenerator{
|
||||
public Effect generateEffect = Fx.none;
|
||||
public Attribute attribute = Attribute.heat;
|
||||
@ -46,7 +45,7 @@ public class ThermalGenerator extends PowerGenerator{
|
||||
|
||||
@Override
|
||||
public void drawLight(){
|
||||
renderer.lights.add(x, y, (40f + Mathf.absin(10f, 5f)) * productionEfficiency * size, Color.scarlet, 0.4f);
|
||||
Drawf.light(x, y, (40f + Mathf.absin(10f, 5f)) * productionEfficiency * size, Color.scarlet, 0.4f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -5,8 +5,7 @@ import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.util.*;
|
||||
|
||||
import static mindustry.Vars.renderer;
|
||||
import mindustry.graphics.*;
|
||||
|
||||
/** A GenericCrafter with a new glowing region drawn on top. */
|
||||
public class GenericSmelter extends GenericCrafter{
|
||||
@ -48,7 +47,7 @@ public class GenericSmelter extends GenericCrafter{
|
||||
|
||||
@Override
|
||||
public void drawLight(){
|
||||
renderer.lights.add(x, y, (60f + Mathf.absin(10f, 5f)) * warmup * size, flameColor, 0.65f);
|
||||
Drawf.light(x, y, (60f + Mathf.absin(10f, 5f)) * warmup * size, flameColor, 0.65f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ public class CoreBlock extends StorageBlock{
|
||||
|
||||
@Override
|
||||
public void drawLight(){
|
||||
renderer.lights.add(x, y, 30f * size, Pal.accent, 0.5f + Mathf.absin(20f, 0.1f));
|
||||
Drawf.light(x, y, 30f * size, Pal.accent, 0.5f + Mathf.absin(20f, 0.1f));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,3 +1,3 @@
|
||||
org.gradle.daemon=true
|
||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||
archash=b8be5f9e64493e00e0243f9c41a83af1c574aaab
|
||||
archash=907d6db786c2629697cbfd3863ce0edd23a179f1
|
||||
|
Loading…
Reference in New Issue
Block a user