Shader cleanup

This commit is contained in:
Anuken
2019-02-26 13:11:49 -05:00
parent 0cb14461ba
commit 964d1a0d87
36 changed files with 1344 additions and 2321 deletions
@@ -13,7 +13,6 @@ import io.anuke.mindustry.entities.Units;
import io.anuke.mindustry.entities.bullet.BulletType;
import io.anuke.mindustry.entities.units.UnitState;
import io.anuke.mindustry.graphics.Pal;
import io.anuke.mindustry.graphics.Shaders;
import io.anuke.mindustry.net.Net;
import io.anuke.mindustry.world.meta.BlockFlag;
@@ -113,13 +112,13 @@ public abstract class FlyingUnit extends BaseUnit{
@Override
public void draw(){
Draw.alpha(Draw.getShader() != Shaders.mix ? 1f : hitTime / hitDuration);
Draw.mixcol(Color.WHITE, hitTime / hitDuration);
Draw.rect(type.region, x, y, rotation - 90);
drawWeapons();
drawItems();
Draw.alpha(1f);
Draw.mixcol();
}
public void drawWeapons(){
@@ -12,7 +12,6 @@ import io.anuke.mindustry.entities.Units;
import io.anuke.mindustry.entities.bullet.BulletType;
import io.anuke.mindustry.entities.units.UnitState;
import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.graphics.Shaders;
import io.anuke.mindustry.type.Weapon;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.Floor;
@@ -109,14 +108,14 @@ public abstract class GroundUnit extends BaseUnit{
@Override
public void draw(){
Draw.alpha(Draw.getShader() != Shaders.mix ? 1f : hitTime / hitDuration);
Draw.mixcol(Color.WHITE, hitTime / hitDuration);
float ft = Mathf.sin(walkTime * type.speed*5f, 6f, 2f + type.hitsize/15f);
Floor floor = getFloorOn();
if(floor.isLiquid){
Draw.tint(Color.WHITE, floor.liquidColor, 0.5f);
Draw.color(Color.WHITE, floor.liquidColor, 0.5f);
}
for(int i : Mathf.signs){
@@ -127,9 +126,9 @@ public abstract class GroundUnit extends BaseUnit{
}
if(floor.isLiquid){
Draw.tint(Color.WHITE, floor.liquidColor, drownTime * 0.4f);
Draw.color(Color.WHITE, floor.liquidColor, drownTime * 0.4f);
}else{
Draw.tint(Color.WHITE);
Draw.color(Color.WHITE);
}
Draw.rect(type.baseRegion, x, y, baseRotation - 90);
@@ -146,7 +145,7 @@ public abstract class GroundUnit extends BaseUnit{
drawItems();
Draw.alpha(1f);
Draw.mixcol();
}
@Override
@@ -23,7 +23,6 @@ import io.anuke.mindustry.entities.traits.TargetTrait;
import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.gen.Call;
import io.anuke.mindustry.graphics.Pal;
import io.anuke.mindustry.graphics.Shaders;
import io.anuke.mindustry.input.Binding;
import io.anuke.mindustry.io.TypeIO;
import io.anuke.mindustry.net.Net;
@@ -285,11 +284,11 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
Floor floor = getFloorOn();
Draw.color();
Draw.alpha(Draw.getShader() != Shaders.mix ? 1f : hitTime / hitDuration);
Draw.mixcol(Color.WHITE, hitTime / hitDuration);
if(!mech.flying){
if(floor.isLiquid){
Draw.tint(Color.WHITE, floor.liquidColor, 0.5f);
Draw.color(Color.WHITE, floor.liquidColor, 0.5f);
}
float boostTrnsY = -boostHeat * 3f;
@@ -309,9 +308,9 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
}
if(floor.isLiquid){
Draw.tint(Color.WHITE, floor.liquidColor, drownTime);
Draw.color(Color.WHITE, floor.liquidColor, drownTime);
}else{
Draw.tint(Color.WHITE);
Draw.color(Color.WHITE);
}
Draw.rect(mech.region, x, y, rotation - 90);
@@ -344,13 +343,12 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
}
}
Draw.alpha(1f);
Draw.reset();
}
@Override
public void drawStats(){
Draw.color(Color.BLACK, team.color, healthf() + Mathf.absin(Time.time(), healthf() * 5f, 1f - healthf()));
Draw.alpha(hitTime / hitDuration);
Draw.rect(getPowerCellRegion(), x + Angles.trnsx(rotation, mech.cellTrnsY, 0f), y + Angles.trnsy(rotation, mech.cellTrnsY, 0f), rotation - 90);
Draw.color();
}
@@ -365,7 +365,6 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
public void drawStats(){
Draw.color(Color.BLACK, team.color, healthf() + Mathf.absin(Time.time(), healthf()*5f, 1f - healthf()));
Draw.alpha(hitTime);
Draw.rect(getPowerCellRegion(), x, y, rotation - 90);
Draw.color();
}